You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem Building Node (had errors about multiply-defined symbols and such) #24448
Version: Currently 11.1.0, but am installing 11.2.0
Platform: Windows 10 Home Single Language
Subsystem: Need to build Node (pulled from Node GitHub repo)
I went into my Node root with the .git folder and ran .\vcbuild, and it built a lot of the stuff but then ended with the errors:
zlib.lib(adler32.obj) : error LNK2005: adler32 already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32_combine already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32_z already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32 already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32_combine already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32_z already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: get_crc_table already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
C:\node\Release\node.exe : fatal error LNK1169: one or more multiply defined symbols found [C:\node\node.vcxproj]
I want to build Node and then V8. Any help would be greatly appreciated.
Hello @DragonOsman and thank you for the report.
It seems like you computer has a previously installed zlib1.dll, and it's added the the linker's LIBPATH so it finds two library files that defines those symbols (your zlib1.dll and the zlib.lib we build from our tree).
One option is to disable you globally installed zlib (it's usually installed with Chocolatery or NuGet)
Another option is to run the configure script with --shared-zlib:
rand_egd.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library [C:\node\deps\openssl\openssl.vcxproj]
ecp_nistputil.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library [C:\node\deps\openssl\openssl.vcxproj]
ecp_nistp521.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library [C:\node\deps\openssl\openssl.vcxproj]
ecp_nistp256.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library [C:\node\deps\openssl\openssl.vcxproj]
ecp_nistp224.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library [C:\node\deps\openssl\openssl.vcxproj]
ebcdic.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library [C:\node\deps\openssl\openssl.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32 already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32_combine already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32_z already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32 already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32_combine already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32_z already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: get_crc_table already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
C:\node\Release\node.exe : fatal error LNK1169: one or more multiply defined symbols found [C:\node\node.vcxproj]
I had zlib installed in the C drive in a folder called "libraries". I completely deleted that folder and then tried to build Node again, but had the same errors as before.
So what do you mean by renaming them all? What should I rename them to? And what if I just delete them all?
I wonder if you could help me with compiling a C++ webserver app I have to WebAssembly? I want to use it on the backend as a Node.js module. I can't get em++ to generate .wasm code for it, though. I get .o and .js, but no .wasm. The source code is here: https://github.com/DragonOsman/currency_converter , and the command I used is:
I understand that when wanting to call embind for std::shared_ptr in JavaScript code, one has to use EMSCRIPTEN_BINDINGS and some other code in there to be able to do it. Does this apply to Node.js? Could this be why it won't generate WebAssembly code? If so, how do I use EMSCRIPTEN_BINDINGS on std::make_shared_from_this<>? I want to use the one that will let the pointer translate to an actual std::shared_ptr on the Node.js side rather than a regular, raw pointer.
I also tried asking about this in the emsdk GitHub. That's here (the two replies there is just me giving more info and updates) and here. I also asked something else two months ago about cwrap, and I asked about this there as well: link. As you can see, I don't have replies on the latest comments I made. If you can help me on this, that'd be great.
Note: The "same errors" I mentioned before are the same ones I was getting at first:
zlib.lib(adler32.obj) : error LNK2005: adler32 already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32_combine already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32_z already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32 already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32_combine already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32_z already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: get_crc_table already defined in zlib.lib(zlib1.dll) [C:\node\node.vcxproj]
C:\node\Release\node.exe : fatal error LNK1169: one or more multiply defined symbols found [C:\node\node.vcxproj]
I need advice on what to rename zlib1.dll into. I have lots of instances of it; some in vcpkg's files, some in Visual Studio 2017's files. If I try to set the --shared-zlib flag, I get a linker error saying that it can't open z.lib.
Looking for WiX installation for Visual Studio 2017...
Failed to find WiX install for Visual Studio 2017
VS2017 support for WiX is only present starting at version 3.11
Failed to find a suitable Visual Studio installation.
Try to run in a "Developer Command Prompt" or consult
https://github.com/nodejs/node/blob/master/BUILDING.md#windows-1
even after I both installed WiX and added it to the PATH, and also installed a Visual Studio 2017 Extension for WiX. Do I put WiX as the first thing mentioned in the PATH, or is that not a problem?
I think I'll just run the fetch v8 command and get only V8, that way. And quit trying to build all of Node.js since it's giving me trouble because of zlib.
I have zlib dll instances in vcpkg and VS2017 installation directories, and I've also built zlib myself. I want to know if it's possible to just use the zlib I built myself with Node and just make Node ignore the one inside its source tree. Is this possible, and if so, how do I do it?
I mainly just want V8, so I've also been trying to build it. Haven't had any luck. I'm using VS2017 and have tried to follow the instructions here: https://medium.com/dailyjs/how-to-build-v8-on-windows-and-not-go-mad-6347c69aacd4 because the ones on the main documentation for V8 also didn't really help. But I got errors when I ran the command mentioned there, I got this error message:
Hint: You can raise verbosity (-vv) to see the output of failed commands.
Traceback (most recent call last):
File "C:\v8\tools\dev\v8gen.py", line 304, in <module>
sys.exit(gen.main())
File "C:\v8\tools\dev\v8gen.py", line 298, in main
return self._options.func()
File "C:\v8\tools\dev\v8gen.py", line 166, in cmd_gen
gn_outdir,
File "C:\v8\tools\dev\v8gen.py", line 208, in _call_cmd
stderr=subprocess.STDOUT,
File "C:\Python27\lib\subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['C:\\Python27\\python.exe', '-u', 'tools\\mb\\mb.py', 'gen', '-f', 'infra\\mb\\mb_config.pyl', '-m', 'developer_default', '-b', 'x64.release', 'out.gn/x64.release']' returned non-zero exit status 1
The command I ran was: python tools/dev/v8gen.py x64.release. I also tried going inside the tools/dev directory and executing it there, though I left out the python command from the beginning of it. Same result.
When I try to follow the instructions on the official documentation, it tries to run the termios module which of course it can't because it's not there on Windows.
@Trott Why did you post that? Is there something for me to do there?
I still need to try building it with the Release configuration, since I've only tried with the Debug one so far, but it seems choosing dll in the vcbuild arguments, instead of static, did it. I still have .lib files, though. I didn't set build-release, and built it manually using the IDE itself. IIRC (I already closed the command prompt window I did it in, so I'll have to say from memory), the command I ran was vcbuild release no-cctest x64 dll. I may have gotten the order wrong on some of that, but that's the gist of it. And I still managed to build cctest even though I'd put no-cctest. Also, I'm not sure if it made a difference, but I build node.vcxproj first.
Update to above post: Turns out that although it worked with the Debug configuration, it didn't work with the Release configuration. I get "undefined symbol" errors because of zlib1.dll when I try to build node.vcxproj. I do have node.lib and zlib.lib in my Release/lib directory, though.
Again, I'd like to know how I can make it ignore those zlib1.dlls and use the zlib I built myself. If this possible, I'd really like to know how to do it. Thanks in advance.
Is there a way for me to provide the path to the zlib I built when trying to use shared-zlib? So that it doesn't look for z.lib (I have zlib.lib and zlibstatic.lib, and I built the latest version of zlib).
Edit to add: I put in the path to the zlib include and lib directories in the project property pages, and also put in zlib.lib as the input file name for the linker to look for. I'm trying to build node.vcxproj again now.
In the node.vcxproj linker command line, it has `C:/node/lib/Release/node.lib" as one of the linker input files. Why? I don't even see it under the linker input settings under "Linker" in Project Properties, so I don't know how to take it out of there. It's causing the project to fail to build. I asked on MSDN forums here, as well: link . Originally it was to ask about how to add library input files to the linker command line, but I decided to ask about this there, as well.
I tried specifying static and nobuild for vcbuild when generating project files and then tried to build the other projects before the main node.vcxproj one. But node.vcxproj keeps failing with linker errors. I have the log file. Gist link: https://gist.github.com/DragonOsman/ea32bd66414064d5c390854ce3ac1db2 . The reason it's so long with so much info is because I chose the setting for the most detailed diagnostic in MSBuild. It gives you info on the whole build environment everything too, not just on the build information.
Anyway, I'd really like some help here.
I already have this issue where I'm asking about this (in the Nodejs Help repo): nodejs/help#1656
I downloaded the source code for version 11.6.0 from the Nodejs website and tried to build it (directly using IDE GUI). Before running vcbuild, I ran this command:
set config_flags=--shared-zlib --shared-zlib-libname=zlibstatic.lib --shared-zlib-libpath="C:\\zlib_library\\lib" --shared-zlib-includes="C:\\zlib_library\\include" --fully-static --with-ltcg --dest-cpu=x64 --without-etw
@DragonOsman I think you can do vcpkg integration remove, and then it should work, this works for me
Tips: even if you do not install vcpkg yourself, Visual Studio may install automate as it's part of Visual Studio solution
Activity
refack commentedon Nov 17, 2018
Hello @DragonOsman and thank you for the report.
It seems like you computer has a previously installed
zlib1.dll, and it's added the the linker's LIBPATH so it finds two library files that defines those symbols (yourzlib1.dlland thezlib.libwe build from our tree).--shared-zlib:python configure --shared-zlib --with-pch --dest-cpu=x64 --verbose ^^^^^^^^^^^^^DragonOsman commentedon Nov 17, 2018
Thanks for the reply. I'll try the second option.
By the way, I forgot to mention earlier that I'm using Visual Studio 2017 (latest version).
DragonOsman commentedon Nov 17, 2018
I have these warnings:
Do I need to worry?
refack commentedon Nov 17, 2018
No, it's expected. I often see it while building locally.
DragonOsman commentedon Nov 17, 2018
I got the same errors again:
How do I disable the other zlib installation?
refack commentedon Nov 17, 2018
You can try:

DragonOsman commentedon Nov 17, 2018
I had zlib installed in the C drive in a folder called "libraries". I completely deleted that folder and then tried to build Node again, but had the same errors as before.
refack commentedon Nov 17, 2018
What I forgot to say is that if you build with
vcbuild.batthen you need to set an env varconfig_flags. So:DragonOsman commentedon Nov 17, 2018
I even removed the vcpkg for zlib from my system and tried to build again with the commands you just gave. Got these errors at the end:
Any ideas?
refack commentedon Nov 17, 2018
So it's either/or. If you removed the global zlib.dll you need to build the "in tree" version (i.e. "not share zlib"):
If that doesn't work, try searching your whole computer for
zlib.dlland rename them all.DragonOsman commentedon Nov 18, 2018
Got the same errors.
So what do you mean by renaming them all? What should I rename them to? And what if I just delete them all?
I wonder if you could help me with compiling a C++ webserver app I have to WebAssembly? I want to use it on the backend as a Node.js module. I can't get
em++to generate .wasm code for it, though. I get .o and .js, but no .wasm. The source code is here: https://github.com/DragonOsman/currency_converter , and the command I used is:I understand that when wanting to call
embindforstd::shared_ptrin JavaScript code, one has to useEMSCRIPTEN_BINDINGSand some other code in there to be able to do it. Does this apply to Node.js? Could this be why it won't generate WebAssembly code? If so, how do I useEMSCRIPTEN_BINDINGSonstd::make_shared_from_this<>? I want to use the one that will let the pointer translate to an actualstd::shared_ptron the Node.js side rather than a regular, raw pointer.I also tried asking about this in the emsdk GitHub. That's here (the two replies there is just me giving more info and updates) and here. I also asked something else two months ago about
cwrap, and I asked about this there as well: link. As you can see, I don't have replies on the latest comments I made. If you can help me on this, that'd be great.Note: The "same errors" I mentioned before are the same ones I was getting at first:
6 remaining items
DragonOsman commentedon Nov 27, 2018
I need advice on what to rename zlib1.dll into. I have lots of instances of it; some in vcpkg's files, some in Visual Studio 2017's files. If I try to set the
--shared-zlibflag, I get a linker error saying that it can't open z.lib.DragonOsman commentedon Nov 27, 2018
I tried to run this command to try to build it this way:
But I keep getting this message:
even after I both installed WiX and added it to the PATH, and also installed a Visual Studio 2017 Extension for WiX. Do I put WiX as the first thing mentioned in the PATH, or is that not a problem?
DragonOsman commentedon Nov 27, 2018
I think I'll just run the
fetch v8 commandand get only V8, that way. And quit trying to build all of Node.js since it's giving me trouble because of zlib.Trott commentedon Nov 29, 2018
@nodejs/platform-windows ☝️
DragonOsman commentedon Nov 30, 2018
I have zlib dll instances in vcpkg and VS2017 installation directories, and I've also built zlib myself. I want to know if it's possible to just use the zlib I built myself with Node and just make Node ignore the one inside its source tree. Is this possible, and if so, how do I do it?
I mainly just want V8, so I've also been trying to build it. Haven't had any luck. I'm using VS2017 and have tried to follow the instructions here: https://medium.com/dailyjs/how-to-build-v8-on-windows-and-not-go-mad-6347c69aacd4 because the ones on the main documentation for V8 also didn't really help. But I got errors when I ran the command mentioned there, I got this error message:
The command I ran was:
python tools/dev/v8gen.py x64.release. I also tried going inside thetools/devdirectory and executing it there, though I left out thepythoncommand from the beginning of it. Same result.When I try to follow the instructions on the official documentation, it tries to run the
termiosmodule which of course it can't because it's not there on Windows.@Trott Why did you post that? Is there something for me to do there?
DragonOsman commentedon Nov 30, 2018
I still need to try building it with the Release configuration, since I've only tried with the Debug one so far, but it seems choosing
dllin thevcbuildarguments, instead ofstatic, did it. I still have .lib files, though. I didn't setbuild-release, and built it manually using the IDE itself. IIRC (I already closed the command prompt window I did it in, so I'll have to say from memory), the command I ran wasvcbuild release no-cctest x64 dll. I may have gotten the order wrong on some of that, but that's the gist of it. And I still managed to buildcctesteven though I'd putno-cctest. Also, I'm not sure if it made a difference, but I build node.vcxproj first.DragonOsman commentedon Nov 30, 2018
Update to above post: Turns out that although it worked with the Debug configuration, it didn't work with the Release configuration. I get "undefined symbol" errors because of zlib1.dll when I try to build node.vcxproj. I do have node.lib and zlib.lib in my
Release/libdirectory, though.Again, I'd like to know how I can make it ignore those
zlib1.dlls and use the zlib I built myself. If this possible, I'd really like to know how to do it. Thanks in advance.DragonOsman commentedon Dec 1, 2018
Is there a way for me to provide the path to the zlib I built when trying to use shared-zlib? So that it doesn't look for z.lib (I have zlib.lib and zlibstatic.lib, and I built the latest version of zlib).
Edit to add: I put in the path to the zlib include and lib directories in the project property pages, and also put in
zlib.libas the input file name for the linker to look for. I'm trying to build node.vcxproj again now.DragonOsman commentedon Dec 1, 2018
In the node.vcxproj linker command line, it has `C:/node/lib/Release/node.lib" as one of the linker input files. Why? I don't even see it under the linker input settings under "Linker" in Project Properties, so I don't know how to take it out of there. It's causing the project to fail to build. I asked on MSDN forums here, as well: link . Originally it was to ask about how to add library input files to the linker command line, but I decided to ask about this there, as well.
Trott commentedon Dec 4, 2018
@nodejs/build
DragonOsman commentedon Dec 6, 2018
I tried specifying
staticandnobuildforvcbuildwhen generating project files and then tried to build the other projects before the main node.vcxproj one. But node.vcxproj keeps failing with linker errors. I have the log file. Gist link: https://gist.github.com/DragonOsman/ea32bd66414064d5c390854ce3ac1db2 . The reason it's so long with so much info is because I chose the setting for the most detailed diagnostic in MSBuild. It gives you info on the whole build environment everything too, not just on the build information.Anyway, I'd really like some help here.
I already have this issue where I'm asking about this (in the Nodejs Help repo): nodejs/help#1656
DragonOsman commentedon Dec 28, 2018
I downloaded the source code for version 11.6.0 from the Nodejs website and tried to build it (directly using IDE GUI). Before running
vcbuild, I ran this command:And then I ran
vcbuildlike this:Most of it builds successfully, but I have these linker errors when I try to build node.vcxproj:
What library am I missing? Could someone please help me out? Thanks in advance.
jasnell commentedon Jun 19, 2020
There's been no further activity on this. Closing. Can reopen if necessary
congzhangzh commentedon Mar 17, 2024
@DragonOsman I think you can do vcpkg integration remove, and then it should work, this works for me
Tips: even if you do not install vcpkg yourself, Visual Studio may install automate as it's part of Visual Studio solution