Skip to content

build: fix openssl link error on windows - #13078

Closed
danbev wants to merge 1 commit into
nodejs:masterfrom
danbev:build-win-cctest-link-error
Closed

build: fix openssl link error on windows#13078
danbev wants to merge 1 commit into
nodejs:masterfrom
danbev:build-win-cctest-link-error

Conversation

@danbev

@danbevdanbev commented May 17, 2017

Copy link
Copy Markdown
Contributor

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-botnodejs-github-bot added the build Issues and PRs related to build files or the CI. label May 17, 2017
@danbev

Copy link
Copy Markdown
ContributorAuthor

@refack

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Contributor

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 onlynode.dll as a dependency (that's the = gyp list operator)

@danbev

Copy link
Copy Markdown
ContributorAuthor

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.

@mscdexmscdex added the windows Issues and PRs related to the Windows platform. label May 17, 2017
@danbev

Copy link
Copy Markdown
ContributorAuthor

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

@refack

Copy link
Copy Markdown
Contributor

I'll test the dll target.

@refack
refack self-requested a review May 22, 2017 19:40
Comment threaddeps/openssl/openssl/util/libeay.num Outdated

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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.

@refackrefack left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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

@danbev

Copy link
Copy Markdown
ContributorAuthor

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

refack commented May 23, 2017

Copy link
Copy Markdown
Contributor

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])

@gireeshpunathilgireeshpunathil left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

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
Copy Markdown
Member

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

Comment threadnode.gyp Outdated

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Nice!

@refack

Copy link
Copy Markdown
Contributor

+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
danbevforce-pushed the build-win-cctest-link-error branch from 5f86152 to 13515e5CompareMay 24, 2017 05:37
@danbevdanbev changed the title build: don't link node.dll for cctest targetbuild: fix openssl link error on windowsMay 24, 2017
@danbev

Copy link
Copy Markdown
ContributorAuthor

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

@danbev

Copy link
Copy Markdown
ContributorAuthor
test/linux has completed

console output:

TAP Reports Processing: FINISHChecking ^not okNotifying upstream projects of job completionFinished: SUCCESS

@refackrefack left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor
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/fedora23java.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: STARTLooking for TAP results report in workspace using pattern: *.tapDid not find any matching files. Setting build result to FAILURE.Checking ^not okJenkins Text Finder: File set '*.tap' is emptyNotifying upstream projects of job completionFinished: FAILURE

@bnoordhuis

Copy link
Copy Markdown
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

danbev commented May 25, 2017 via email

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

Landed in 1cde375

@danbevdanbev 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>
@jasnelljasnell 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>
@gibfahngibfahn 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>
@MylesBorinsMylesBorins mentioned this pull request Jul 18, 2017
@refackrefack added the embedding Issues and PRs related to embedding Node.js in another project. label Aug 17, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buildIssues and PRs related to build files or the CI.embeddingIssues and PRs related to embedding Node.js in another project.windowsIssues 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

@danbev@refack@gireeshpunathil@bnoordhuis@mscdex@nodejs-github-bot