Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.exe fails to link #40749

Closed
Derailedzack opened this issue Nov 7, 2021 · 14 comments
Closed

Node.exe fails to link #40749

Derailedzack opened this issue Nov 7, 2021 · 14 comments
Labels
build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform.

Comments

@Derailedzack
Copy link

Version

16.13.0

Platform

Microsoft Windows NT 10.0.19043.0 x64

Subsystem

The standalone Interpretor

What steps will reproduce the bug?

1.Run vcbuild.bat
2.Wait for it to link node.exe
3.Observe linker error

How often does it reproduce? Is there a required condition?

Every time,No

What is the expected behavior?

It shouldn't generate any linker errors

What do you see instead?

Looking for Python
Python found in C:\Users\admin\AppData\Local\Programs\Python\Python36\\python.exe
Looking for NASM
Looking for Visual Studio 2022
Looking for Visual Studio 2019
Found MSVS version 16.0
configure  --dest-cpu=x64
Node.js configure: Found Python 3.6.2...
←[1m←[32mINFO←[0m: configure completed successfully
Project files generated.
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  histogram.vcxproj -> ..\..\out\Release\lib\histogram.lib
  uvwasi.vcxproj -> ..\..\out\Release\lib\uvwasi.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  v8_libplatform.vcxproj -> ..\..\out\Release\lib\v8_libplatform.lib
  zlib.vcxproj -> ..\..\out\Release\lib\zlib.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  llhttp.vcxproj -> ..\..\out\Release\lib\llhttp.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  cares.vcxproj -> ..\..\out\Release\lib\cares.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  libuv.vcxproj -> ..\..\out\Release\lib\libuv.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  nghttp2.vcxproj -> ..\..\out\Release\lib\nghttp2.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  brotli.vcxproj -> ..\..\out\Release\lib\brotli.lib
  Assemble
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  ngtcp2.vcxproj -> ..\..\out\Release\lib\ngtcp2.lib
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  Assemble
  nghttp3.vcxproj -> ..\..\out\Release\lib\nghttp3.lib
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  v8_zlib.vcxproj -> ..\..\out\Release\lib\v8_zlib.lib
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  openssl.vcxproj -> ..\..\out\Release\lib\openssl.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  icuucx.vcxproj -> ..\..\out\Release\lib\icuucx.lib
  icui18n.vcxproj -> ..\..\out\Release\lib\icui18n.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  icutools.vcxproj -> ..\..\out\Release\lib\icutools.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  v8_libbase.vcxproj -> ..\..\out\Release\lib\v8_libbase.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  bytecode_builtins_list_generator.vcxproj -> ..\..\out\Release\\bytecode_builtins_list_generator.exe
  torque_base.vcxproj -> ..\..\out\Release\lib\torque_base.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  torque.vcxproj -> ..\..\out\Release\\torque.exe
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  genccode.vcxproj -> ..\..\out\Release\\genccode.exe
  icudata
  generating object code for ../../deps/icu-tmp/icudt69l.dat
  genccode: using architecture cpu=0 bits=64 big-endian=0
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  icudata.vcxproj -> ..\..\out\Release\lib\icudata.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
     Creating library ..\..\out\Release\gen-regexp-special-case.lib and object ..\..\out\Release\gen-regexp-special-case.exp
  openssl-cli.vcxproj -> ..\..\out\Release\\openssl-cli.exe
  gen-regexp-special-case.vcxproj -> ..\..\out\Release\\gen-regexp-special-case.exe
  node_js2c
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  run_gen-regexp-special-case_action
  node_javascript.cc
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  v8_init.vcxproj -> ..\..\out\Release\lib\v8_init.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  v8_compiler.vcxproj -> ..\..\out\Release\lib\v8_compiler.lib
  Assembling ..\..\deps\v8\src\heap\base\asm\x64\push_registers_masm.S...
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  special-case.cc
  libnode.vcxproj -> out\Release\lib\libnode.lib
  v8_base_without_compiler.vcxproj -> ..\..\out\Release\lib\v8_base_without_compiler.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  v8_initializers.vcxproj -> ..\..\out\Release\lib\v8_initializers.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
     Creating library ..\..\out\Release\mksnapshot.lib and object ..\..\out\Release\mksnapshot.exp
  mksnapshot.vcxproj -> ..\..\out\Release\\mksnapshot.exe
  generating: "..\..\out\Release\obj\v8_snapshot\/snapshot.cc" "..\..\out\Release\obj\v8_snapshot\/embedded.S"
  Assembling ..\..\out\Release\obj\v8_snapshot\\embedded.S...
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  snapshot.cc
  v8_snapshot.vcxproj -> ..\..\out\Release\lib\v8_snapshot.lib
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  mkcodecache.vcxproj -> out\Release\\mkcodecache.exe
  node_mksnapshot.vcxproj -> out\Release\\node_mksnapshot.exe
  run_mkcodecache
  node_mksnapshot
  Using triplet "x64-windows" from "C:\Users\admin\Downloads\vcpkg-2020.06\vcpkg-2020.06\installed\x64-windows\"
  node_snapshot.cc
  node_code_cache.cc
     Creating library out\Release\node.lib and object out\Release\node.exp
zlib.lib(adler32.obj) : error LNK2005: adler32 already defined in zlib.lib(zlib1.dll) [I:\node-v16.13.0.tar\node-v16.13.0\node.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32_combine already defined in zlib.lib(zlib1.dll) [I:\node-v16.13.0.tar\node-v16.13.0\node.vcxproj]
zlib.lib(adler32.obj) : error LNK2005: adler32_z already defined in zlib.lib(zlib1.dll) [I:\node-v16.13.0.tar\node-v16.13.0\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32 already defined in zlib.lib(zlib1.dll) [I:\node-v16.13.0.tar\node-v16.13.0\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32_combine already defined in zlib.lib(zlib1.dll) [I:\node-v16.13.0.tar\node-v16.13.0\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: crc32_z already defined in zlib.lib(zlib1.dll) [I:\node-v16.13.0.tar\node-v16.13.0\node.vcxproj]
zlib.lib(crc32.obj) : error LNK2005: get_crc_table already defined in zlib.lib(zlib1.dll) [I:\node-v16.13.0.tar\node-v16.13.0\node.vcxproj]
out\Release\node.exe : fatal error LNK1169: one or more multiply defined symbols found [I:\node-v16.13.0.tar\node-v16.13.0\node.vcxproj]

Additional information

No response

@Derailedzack Derailedzack changed the title Node.lib fails to link Node.exe fails to link Nov 7, 2021
@iam-frankqiu iam-frankqiu added the windows Issues and PRs related to the Windows platform. label Nov 7, 2021
@Mesteery Mesteery added the build Issues and PRs related to build files or the CI. label Nov 7, 2021
@Derailedzack
Copy link
Author

Derailedzack commented Nov 8, 2021

Should I try building it in visual studio 2019? Later today I'm going to try building it on Ubuntu.

@Trott
Copy link
Member

Trott commented Nov 9, 2021

@nodejs/platform-windows

@Derailedzack
Copy link
Author

Do I have to be a member to use that?

@Trott
Copy link
Member

Trott commented Nov 21, 2021

Do I have to be a member to use that?

Are you referring to @nodejs/platform-windows. That was me pinging the folks on the project who are Windows folks. (I do believe you need to be able to be a member to ping folks like that, but I'm not 100% sure.)

@Trott
Copy link
Member

Trott commented Nov 21, 2021

@nodejs/build

@Trott
Copy link
Member

Trott commented Nov 21, 2021

I don't know if this is the source of your problem or not, but https://github.com/nodejs/node/blob/40ab2888f57d11bda4820f871836118d8fec4d22/BUILDING.md#windows says that building on Windows requires Python 3.9, but your output above indicates you are running Python 3.6.

@Derailedzack
Copy link
Author

No that doesn't change anything

@gireeshpunathil
Copy link
Member

@Derailedzack - where is zlib1.dll coming from? that is the one which causes the symbol duplication. Do you have another zlib library installed in your system, which comes in the link path by default?

@Derailedzack
Copy link
Author

It might be coming from vcpkg

@Derailedzack
Copy link
Author

I have zlib installed in vcpkg

@gireeshpunathil
Copy link
Member

I have zlib installed in vcpkg

thanks. Is that an essential component of that installation? is there a way to uninstall that component selectively, for testing purpose?

(if that works then our build scripts might need modification to either i) use the installed zlib, or override that with the one from node, if we are building in windows with the vcpkg. )

@Derailedzack
Copy link
Author

Derailedzack commented Nov 23, 2021

The linker errors are gone.

The system cannot find the file specified.
Junction created for Release <<===>> out\Release

@liudonghua123
Copy link
Contributor

I build on windows and I notice some warnings The system cannot find the file specified in the last. But node binary is built successfully and located in out\Release\node.exe.

> .\vcbuild.bat
......
  Assembling ..\..\out\Release\obj\v8_snapshot\\embedded.S...
  snapshot.cc
  setup-isolate-deserialize.cc
D:\code\node\node\deps\v8\src\base\bits.h(448,31): warning C4146: unary minus operator applied to unsigned type, result still unsign
ed [D:\code\node\node\tools\v8_gypfiles\v8_snapshot.vcxproj]
  (compiling source file '../../deps/v8/src/init/setup-isolate-deserialize.cc')

  v8_snapshot.vcxproj -> ..\..\out\Release\lib\v8_snapshot.lib
  node_pch.cc
D:\code\node\node\deps\v8\include\v8-fast-api-calls.h(1,1): warning C4819: The file contains a character that cannot be represented
in the current code page (936). Save the file in Unicode format to prevent data loss [D:\code\node\node\node_mksnapshot.vcxproj]
  (compiling source file 'tools/msvs/pch/node_pch.cc')

  node_mksnapshot.cc
  node_snapshot_stub.cc
     Creating library out\Release\node_mksnapshot.lib and object out\Release\node_mksnapshot.exp
  node_mksnapshot.vcxproj -> out\Release\\node_mksnapshot.exe
  node_mksnapshot
  reset_openssl_cnf
  node_pch.cc
D:\code\node\node\deps\v8\include\v8-platform.h(1133,17): warning C4244: 'return': conversion from 'double' to 'int64_t', possible l
oss of data [D:\code\node\node\node.vcxproj]
  (compiling source file 'tools/msvs/pch/node_pch.cc')

D:\code\node\node\deps\v8\include\v8-fast-api-calls.h(1,1): warning C4819: The file contains a character that cannot be represented
in the current code page (936). Save the file in Unicode format to prevent data loss [D:\code\node\node\node.vcxproj]
  (compiling source file 'tools/msvs/pch/node_pch.cc')

  node_snapshot.cc
  node_main.cc
     Creating library out\Release\node.lib and object out\Release\node.exp
  node.vcxproj -> out\Release\\node.exe
The system cannot find the file specified.
Junction created for Release <<===>> out\Release

> 

@liudonghua123
Copy link
Contributor

I found The system cannot find the file specified maybe come from this line of build script in the first build.

This should always shown in CI environment due to clean build.

rd %config%

rd test in cmd:

> rd some_not_existed_file
The system cannot find the file specified.

> echo %errorlevel%
0
>
> rd some_not_existed_file >NUL 2>&1

> echo %errorlevel%
0
>

Maybe append >NUL 2>&1 is a good idea to suppress the confusing error like message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

6 participants