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

build: fix openssl link error on windows #13078

Closed
wants to merge 1 commit into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented May 17, 2017

This commit attempts to fix an issue when building on windows using the
following command line options:

.\vcbuild.bat dll debug x64 vc2015

This will result in the following options passed to configure:

configure --debug --shared --dest-cpu=x64 --tag=

This commit excludes the dependency to openssl if node is configured
with --shared.

Also, FP_API to the categories to export in mkssldef when generating
the module definition (openssl.def) allowing the build to compile and
link successfully.

Fixes: #12952

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

build

@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label May 17, 2017
@danbev
Copy link
Contributor Author

danbev commented May 17, 2017

@refack
Copy link
Contributor

refack commented May 17, 2017

@danbev did you try to go the complete other way around? i.e.

'dependencies=': [
            '<(node_core_target_name)',
          ],

Just out of intuition...

@danbev
Copy link
Contributor Author

danbev commented May 17, 2017

did you try to go the complete other way around? i.e.

There is already a dependency to the node core target, the suggestion here is that it be excluded in this particular case.

@refack
Copy link
Contributor

refack commented May 17, 2017

There is already a dependency to the node core target, the suggestion here is that it be excluded in this particular case.

I mean use only node.dll as a dependency (that's the = gyp list operator)

@danbev
Copy link
Contributor Author

danbev commented May 17, 2017

I mean use only node.dll as a dependency (that's the = gyp list operator)

Ah sorry I understand what you mean now.
I'll give that a try and use the gyp assignment operator (=) to replace the dependency.

@mscdex mscdex added the windows Issues and PRs related to the Windows platform. label May 17, 2017
@danbev
Copy link
Contributor Author

danbev commented May 22, 2017

CI: https://ci.nodejs.org/job/node-test-pull-request/8227/

@refack
Copy link
Contributor

refack commented May 22, 2017

I'll test the dll target.

@refack refack self-requested a review May 22, 2017 19:40
@@ -75,7 +75,7 @@ BIO_new 78 EXIST::FUNCTION:
BIO_new_accept 79 EXIST::FUNCTION:
BIO_new_connect 80 EXIST::FUNCTION:
BIO_new_fd 81 EXIST::FUNCTION:
BIO_new_file 82 EXIST::FUNCTION:FP_API
BIO_new_file 82 EXIST::FUNCTION:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] is this still neccecery?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@refack Yeah I had to make that change. If this is not there that symbol will not be exported (will not end up in <PRODUCT_DIR)\obj\global_intermediate\openssl.def) and a link error will occur when linking cctest.exe. At least that is what I am seeing when building and running this. Where you able to build without this change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't adding FP_API to mkssldef_flags in node.gyp work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not aware of that. Let me give that a try. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That work worked like a charm. Thanks @bnoordhuis
I'll update the PR with the changes later today.

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed dll target builds with vcbuild.bat dll debug x64 vc2015
Rubber stamp libeay.num

@refack
Copy link
Contributor

refack commented May 23, 2017

Where you able to build without this change?

I'll check.
But if it's necessary it'll need @shigeki's review.

@refack
Copy link
Contributor

refack commented May 23, 2017

P.S. split the commits, so it could be easily floated onto deps/openssl

@danbev
Copy link
Contributor Author

danbev commented May 23, 2017

P.S. split the commits, so it could be easily floated onto deps/openssl

No problems, I'll do a rebase later and also remove the first or second commit. I'll leave this as is for now so others can see the options we have to move forward and then clean up the commits. Thanks

@refack
Copy link
Contributor

refack commented May 23, 2017

Confirm the need for changing BIO_new_file:

node_crypto.obj : error LNK2019: unresolved external symbol BIO_new_file referenced in function "unsigned long __cdecl node::crypto::AddCertsFromFile(struct x509_store_st *,char const *)" (?AddCertsFromFile@crypto@node@@YAKPEAUx509_store_st@@PEBD@Z) [P:\code\node\cctest.vcxproj]
P:\code\node\Debug\cctest.exe : fatal error LNK1120: 1 unresolved externals [P:\code\node\cctest.vcxproj]

In this case I'm +1 on the first method (include [all] exclude [dll])

Copy link
Member

@gireeshpunathil gireeshpunathil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why renaming the conflicting symbol was never thought as a solution? Circumventing the conflict through build script is not comprehensive in my opinion. We seem to be leveraging a chance that cctest does not require symbols from node core dll - this scenario can change in future and this circuvention will break.

@refack
Copy link
Contributor

refack commented May 23, 2017

Why renaming the conflicting symbol was never thought as a solution?

@gireeshpunathil it's not just a one, it's the whole openSSL that gets included twice: #12952 (comment)

@gireeshpunathil
Copy link
Member

@refack - ah, I see! thanks for the clarification.

node.gyp Outdated
'<(node_core_target_name)',
'deps/gtest/gtest.gyp:gtest',
],
'dependencies!': [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked, these 5 lines are unnecessary to this approach (only dll & gtest).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@refack
Copy link
Contributor

refack commented May 23, 2017

+1 for second approach (with the gyp:mkssldef_flags and 5 lines remove)

This commit attempts to fix an issue when building on windows using the
following command line options:
.\vcbuild.bat dll debug x64 vc2015

This will result in the following options passed to configure:
configure --debug --shared --dest-cpu=x64 --tag=

This commit excludes the dependency to openssl if node is configured
with --shared.

Also, FP_API to the categories to export in mkssldef when generating
the module definition (openssl.def) allowing the build to compile and
link successfully.

Fixes: nodejs#12952
@danbev danbev force-pushed the build-win-cctest-link-error branch from 5f86152 to 13515e5 Compare May 24, 2017 05:37
@danbev danbev changed the title build: don't link node.dll for cctest target build: fix openssl link error on windows May 24, 2017
@danbev
Copy link
Contributor Author

danbev commented May 24, 2017

Rebased and squashed CI: https://ci.nodejs.org/job/node-test-pull-request/8270/

@danbev
Copy link
Contributor Author

danbev commented May 24, 2017

test/linux has completed

console output:

TAP Reports Processing: FINISH
Checking ^not ok
Notifying upstream projects of job completion
Finished: SUCCESS

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that's minimal!

@danbev
Copy link
Contributor Author

danbev commented May 25, 2017

test/linux failure does not look related

console output:

EnvInject] - Loading node environment variables.
Building remotely on test-digitalocean-fedora23-x64-1 (fedora23) in workspace /home/iojs/build/workspace/node-test-commit-linux/nodes/fedora23
java.lang.NoClassDefFoundError: Could not initialize class com.sun.proxy.$Proxy11
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:739)
	at hudson.remoting.RemoteInvocationHandler.wrap(RemoteInvocationHandler.java:143)
	at hudson.remoting.Channel.export(Channel.java:618)
	at hudson.remoting.Channel.export(Channel.java:587)
	at org.jenkinsci.plugins.gitclient.LegacyCompatibleGitAPIImpl.writeReplace(LegacyCompatibleGitAPIImpl.java:198)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1118)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1136)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at hudson.remoting.UserRequest._serialize(UserRequest.java:158)
	at hudson.remoting.UserRequest.serialize(UserRequest.java:167)
	at hudson.remoting.UserRequest.perform(UserRequest.java:129)
	at hudson.remoting.UserRequest.perform(UserRequest.java:49)
	at hudson.remoting.Request$2.run(Request.java:326)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at hudson.remoting.Engine$1$1.run(Engine.java:69)
	at java.lang.Thread.run(Thread.java:745)
	at ......remote call to Channel to /162.243.63.132(Native Method)
	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
	at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
	at hudson.remoting.Channel.call(Channel.java:830)
Caused: java.io.IOException: Remote call on Channel to /162.243.63.132 failed
	at hudson.remoting.Channel.call(Channel.java:838)
	at hudson.FilePath.act(FilePath.java:985)
Caused: java.io.IOException: remote file operation failed: /home/iojs/build/workspace/node-test-commit-linux/nodes/fedora23 at hudson.remoting.Channel@16fc6ec9:Channel to /162.243.63.132
	at hudson.FilePath.act(FilePath.java:992)
	at hudson.FilePath.act(FilePath.java:974)
	at org.jenkinsci.plugins.gitclient.Git.getClient(Git.java:137)
	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:751)
	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:743)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)
	at hudson.scm.SCM.checkout(SCM.java:496)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1281)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
	at hudson.model.Run.execute(Run.java:1728)
	at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:405)
Run condition [Always] enabling perform for step [[Execute a set of scripts]]
Run condition [Always] enabling perform for step [[Execute a set of scripts]]
TAP Reports Processing: START
Looking for TAP results report in workspace using pattern: *.tap
Did not find any matching files. Setting build result to FAILURE.
Checking ^not ok
Jenkins Text Finder: File set '*.tap' is empty
Notifying upstream projects of job completion
Finished: FAILURE

@bnoordhuis
Copy link
Member

That's a Jenkins error. The other linux buildbots are green. I think this should be good to go (the more so because the mkssldef target isn't used on UNIX.)

@danbev
Copy link
Contributor Author

danbev commented May 25, 2017 via email

danbev added a commit to danbev/node that referenced this pull request May 25, 2017
This commit attempts to fix an issue when building on windows using the
following command line options:
.\vcbuild.bat dll debug x64 vc2015

This will result in the following options passed to configure:
configure --debug --shared --dest-cpu=x64 --tag=

This commit excludes the dependency to openssl if node is configured
with --shared.

Also, FP_API to the categories to export in mkssldef when generating
the module definition (openssl.def) allowing the build to compile and
link successfully.

Fixes: nodejs#12952
PR-URL: nodejs#13078
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
@danbev
Copy link
Contributor Author

danbev commented May 25, 2017

Landed in 1cde375

@danbev danbev closed this May 25, 2017
@danbev danbev deleted the build-win-cctest-link-error branch May 25, 2017 16:43
jasnell pushed a commit that referenced this pull request May 25, 2017
This commit attempts to fix an issue when building on windows using the
following command line options:
.\vcbuild.bat dll debug x64 vc2015

This will result in the following options passed to configure:
configure --debug --shared --dest-cpu=x64 --tag=

This commit excludes the dependency to openssl if node is configured
with --shared.

Also, FP_API to the categories to export in mkssldef when generating
the module definition (openssl.def) allowing the build to compile and
link successfully.

Fixes: #12952
PR-URL: #13078
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
jasnell pushed a commit that referenced this pull request May 28, 2017
This commit attempts to fix an issue when building on windows using the
following command line options:
.\vcbuild.bat dll debug x64 vc2015

This will result in the following options passed to configure:
configure --debug --shared --dest-cpu=x64 --tag=

This commit excludes the dependency to openssl if node is configured
with --shared.

Also, FP_API to the categories to export in mkssldef when generating
the module definition (openssl.def) allowing the build to compile and
link successfully.

Fixes: #12952
PR-URL: #13078
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
@jasnell jasnell mentioned this pull request May 28, 2017
danbev added a commit to danbev/node that referenced this pull request May 30, 2017
This commit attempts to fix an issue when building on windows using the
following command line options:
.\vcbuild.bat dll debug x64 vc2015

This will result in the following options passed to configure:
configure --debug --shared --dest-cpu=x64 --tag=

This commit excludes the dependency to openssl if node is configured
with --shared.

Also, FP_API to the categories to export in mkssldef when generating
the module definition (openssl.def) allowing the build to compile and
link successfully.

Fixes: nodejs#12952
PR-URL: nodejs#13078
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
@gibfahn gibfahn mentioned this pull request Jun 15, 2017
3 tasks
gibfahn pushed a commit to gibfahn/node that referenced this pull request Jun 17, 2017
This commit attempts to fix an issue when building on windows using the
following command line options:
.\vcbuild.bat dll debug x64 vc2015

This will result in the following options passed to configure:
configure --debug --shared --dest-cpu=x64 --tag=

This commit excludes the dependency to openssl if node is configured
with --shared.

Also, FP_API to the categories to export in mkssldef when generating
the module definition (openssl.def) allowing the build to compile and
link successfully.

Fixes: nodejs#12952
PR-URL: nodejs#13078
Backport-PR-URL: nodejs#12948
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2017
This commit attempts to fix an issue when building on windows using the
following command line options:
.\vcbuild.bat dll debug x64 vc2015

This will result in the following options passed to configure:
configure --debug --shared --dest-cpu=x64 --tag=

This commit excludes the dependency to openssl if node is configured
with --shared.

Also, FP_API to the categories to export in mkssldef when generating
the module definition (openssl.def) allowing the build to compile and
link successfully.

Fixes: #12952
PR-URL: #13078
Backport-PR-URL: #12948
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Jul 18, 2017
@refack refack added the embedding Issues and PRs related to embedding Node.js in another project. label Aug 17, 2017
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. embedding Issues and PRs related to embedding Node.js in another project. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenSSL have collisions in node.dll
6 participants