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

The latest master fails to build on Windows #23909

Closed
zhulika opened this issue Oct 26, 2018 · 16 comments
Closed

The latest master fails to build on Windows #23909

zhulika opened this issue Oct 26, 2018 · 16 comments
Labels
build Issues and PRs related to build files or the CI. openssl Issues and PRs related to the OpenSSL dependency. windows Issues and PRs related to the Windows platform.

Comments

@zhulika
Copy link

zhulika commented Oct 26, 2018

I've just tried building the latest master (482b56a) on Windows (using vcbuild) and I get loads of "already-defined" errors being reported:

openssl.lib(o_str.obj) : error LNK2005: CRYPTO_strdup already defined in libeay32.lib(LIBEAY32.dll) [D:\work\github\node.master\node\deps\openssl\openssl-cli.vcxproj] openssl.lib(mem.obj) : error LNK2005: CRYPTO_malloc already defined in libeay32.lib(LIBEAY32.dll) [D:\work\github\node.master\node\deps\openssl\openssl-cli.vcxproj] openssl.lib(mem.obj) : error LNK2005: CRYPTO_free already defined in libeay32.lib(LIBEAY32.dll) [D:\work\github\node.master\node\deps\openssl\openssl-cli.vcxproj] openssl.lib(mem.obj) : error LNK2005: CRYPTO_realloc already defined in libeay32.lib(LIBEAY32.dll) [D:\work\github\node.master\node\deps\openssl\openssl-cli.vcxproj] openssl.lib(bn_lib.obj) : error LNK2005: BN_bin2bn already defined in libeay32.lib(LIBEAY32.dll) [D:\work\github\node.master\node\deps\openssl\openssl-cli.vcxproj] ... etc

The v8.12.0 tag (731eed2) builds fine on my PC, so I don't think it's a setup/config issue. I've also tried various combinations of vcbuild flags, which fail with the same errors. Not sure what else to say/try.

@addaleax addaleax added build Issues and PRs related to build files or the CI. openssl Issues and PRs related to the OpenSSL dependency. windows Issues and PRs related to the Windows platform. labels Oct 26, 2018
@addaleax
Copy link
Member

@nodejs/platform-windows Ideas?

@refack
Copy link
Contributor

refack commented Oct 26, 2018

Hello @zhulika and thank you for the report.
It would be very helpful if you could try to git bisect and try to find where this issue might have been introduced.
I'm trying to reproduce locally, and make sure this revision passes out CI tests (https://ci.nodejs.org/job/node-test-commit/22688/)

Edit: The following line indicates openssl-cli.exe is build ok in our CI cluster:

15:53:03   openssl-cli.vcxproj -> c:\workspace\node-compile-windows\Release\\openssl-cli.exe

@refack
Copy link
Contributor

refack commented Oct 26, 2018

P.S. In your workspace you should find two files

  1. config.gypi
  2. deps\openssl\openssl-cli.vcxproj
    If would help if you could attach them here.

@refack
Copy link
Contributor

refack commented Oct 26, 2018

Googleling around this issue made me think that you might have a LIB environment variable that includes a directory that has LIBEAY32.dll (which is just renamed openSSL), which could be the result of installing openSSL with NuGet. In this case the linker is asked to link "our" openSSL together with LIBEAY32.dll and that results in name collision.
If you could open a new CMD window and paste here the content of running SET.

@zhulika
Copy link
Author

zhulika commented Oct 26, 2018

Hi. I'm working through the bisect, so will wait until I have a failing version of the build before pasting the gyp and vcxproj files. In the meantime, here is the value of my LIB evar:

Microsoft Windows [Version 10.0.17134.345]
(c) 2018 Microsoft Corporation. All rights reserved.

D:\work>set lib
LIB=C:\Program Files\MySQL\MySQL Server 8.0\lib;

D:\work>dir %LIB%\libeay32.dll
The system cannot find the file specified.

D:\work>dir %LIB%\libeay32.lib
The system cannot find the file specified.

I do have quite a few copies of libeay32.dll on my system, but none of them are in that folder. We may have to wait until tomorrow for the results of the bisect (10 rebuilds required).

@zhulika
Copy link
Author

zhulika commented Oct 26, 2018

The cut-paste failed. Here's the rest of the check:

D:\work>dir "C:\Program Files\MySQL\MySQL Server 8.0\lib\libeay32.*"
 Volume in drive C has no label.
 Volume Serial Number is 860C-67A7

 Directory of C:\Program Files\MySQL\MySQL Server 8.0\lib

File Not Found

@refack
Copy link
Contributor

refack commented Oct 27, 2018

@zhulika, thank you for following up. I'm trying find which tools could cause MSBuild to inject that dependency into the build...

@zhulika
Copy link
Author

zhulika commented Oct 27, 2018

I couldn't find a specific version that failed, because there are a bunch of commits in the final range that all seem to have different problems (in the way that these things often are). Perhaps a failure to find a file, a bunch of raw compilation errors, sometimes ml64 fails, other times it's the original LIBEAY32 issue. Worryingly (for me), they are from way back in March and appear to relate to adding openssl to the build in the first place. I attach a screenshot of the range that git bisect did settle on, FYI.

I assume that someone must have tried building it on Windows in the last six months (!), so there must be something wrong with my setup. It's not that it can't find OpenSSL (which would mean that I'm missing a package), but it fails because there is a clash with LIBEAY32. Do you have any idea what it might be?

Thanks,

Dan

PS, I also attach a config.gypi and openssl.vcxproj that I just got from the master HEAD (6223236), as per your earlier request.

openssl-cli.vcxproj.txt

config.gypi.txt

bisectopensslbuild

@refack
Copy link
Contributor

refack commented Oct 27, 2018

I couldn't find a specific version that failed

PS, I also attach a config.gypi and openssl.vcxproj

Again, thank you very much for following up.

@refack
Copy link
Contributor

refack commented Oct 27, 2018

What might have happened in the above version range is that we upgrade to openSSL1.1.h, so it might be that now our openSSL version syncs with your LIBEAY32, and the Linker can confuse the two.
Or that this this line 99eb744#diff-fce3cab7c870a44f624ffe06f2a5c268R33 has some strage side effect.

As for your config.gypi and openssl.vcxproj, they look the same as mine, so I still don't have a definite answer, but I do have two suspects:

  1. Simply some stale build artifacts. You could try a clean checkout, or rename the Debug and Release directories on the node root and in /deps/openssl, and maybe the .user and .suo MSBuild user settings files.
  2. Global MSBuild "user property sheets" that are referred in
  <ImportGroup Label="PropertySheets">
    <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
  </ImportGroup>

Refs: https://docs.microsoft.com/en-us/visualstudio/extensibility/internals/support-for-user-settings?view=vs-2017
Refs: https://stackoverflow.com/questions/2676417/how-do-include-paths-work-in-visual-studio
Refs: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2017

@zhulika
Copy link
Author

zhulika commented Oct 27, 2018

Thank you for that.

I've only been able to look at this intermittently today so far (it being a Saturday), but I think that I have tracked it down to a clash between the version of openssl in node\deps and the version that is installed by vcpkg (Microsoft's C++ package manager). Things seem to be a little happier if I turn off the VS2017 integration of vcpkg but I haven't quite got as far as doing a full rebuild to prove it.

So please don't spend any more of your time on this until I know one way or the other. I'm sure it's something that is clashing on my PC, not a generic issue. Or you would have had hundreds of people complaining by now.

Dan

@refack
Copy link
Contributor

refack commented Oct 27, 2018

Thank you for that.

So please don't spend any more of your time on this until I know one way or the other.

Thank you for the update. Any kind of solution (even if it's just local for you computer) will be tracked here and might help someone else in the future, so good luck.

@zhulika
Copy link
Author

zhulika commented Oct 27, 2018

Turning off the vcpkg integration does allow me to build the latest Node. The problem was that vcpkg is still stuck on version 1.0.2p of openssl and using its Visual Studio integration mode inserts that obsolete version at the head of the list of include/lib directories for MSBUILD, causing all of the errors.

There is an outstanding ticket to upgrade it but that's out of my pay grade; I'll just have to work without the integration for the moment. NodeJS is much more important to me than is vcpkg (even though they are both great!)

Many thanks for your support,

Dan

@zhulika zhulika closed this as completed Oct 27, 2018
@ras0219-msft
Copy link

Since NodeJS is providing all of its own dependencies, you can add a property to your MSBuild projects that will totally disable vcpkg's integration:

<PropertyGroup>
  <VcpkgEnabled>false</VcpkgEnabled>
</PropertyGroup>

This will totally fix other users like @zhulika from having an issue here (though we'll look at trying to make this better in upstream vcpkg as well :)).

@zhulika
Copy link
Author

zhulika commented Oct 28, 2018

Thanks very much @ras0219-msft; that's a very useful option to know about. Can it be added to the documentation for vcpkg?

https://github.com/Microsoft/vcpkg/blob/master/docs/users/integration.md

@GauthamBanasandra
Copy link
Contributor

GauthamBanasandra commented Jul 7, 2019

Turning off the vcpkg integration does allow me to build the latest Node. The problem was that vcpkg is still stuck on version 1.0.2p of openssl and using its Visual Studio integration mode inserts that obsolete version at the head of the list of include/lib directories for MSBUILD, causing all of the errors.

Running the below command from the directory where vcpkg is checked out worked for me

> .\vcpkg.exe integrate remove

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. openssl Issues and PRs related to the OpenSSL dependency. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

5 participants