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 cctest target with --enable-static #17992

Closed
wants to merge 1 commit into from
Closed

build: fix cctest target with --enable-static #17992

wants to merge 1 commit into from

Conversation

liqyan
Copy link
Contributor

@liqyan liqyan commented Jan 5, 2018

ref issue: #17991
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:

  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • 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 Jan 5, 2018
Copy link
Contributor

@mmarchini mmarchini left a comment

Choose a reason for hiding this comment

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

Thanks for working on this and welcome! The changes (adding a check for node_target_type) look fine, but the diff is too big because there's reallocation of some conditions (e.g. moving node_use_dtrace before node_use_openssl), making it harder to review and to look at the git log in the future. Could you try to keep the changes to a minimum, focusing only on what's important to this PR? (unless the reallocations are necessary)

node.gyp Outdated
],
}],
],
}], # end node_target_type conditions block
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understood this comment

Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.
@liqyan
Copy link
Contributor Author

liqyan commented Jan 5, 2018

I updated node.gyp to minimize the changes.

@gibfahn
Copy link
Member

gibfahn commented Jan 7, 2018

Maybe cc/ @danbev @yhwang for review.

@yhwang
Copy link
Member

yhwang commented Jan 8, 2018

The fix looks good for me. However, I am also doing the static/shared lib refine here: #17604
I removed the 'node_target_type!="static_library" in cctest target and made it more general for static/shared lib cases.

I guess the fix here will be overrode by my change if this change lands first.

Copy link
Member

@yhwang yhwang left a comment

Choose a reason for hiding this comment

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

LGTM.

@danbev
Copy link
Contributor

danbev commented Jan 8, 2018

jasnell pushed a commit that referenced this pull request Jan 9, 2018
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: #17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

jasnell commented Jan 9, 2018

Landed in 23c9597

@jasnell jasnell closed this Jan 9, 2018
evanlucas pushed a commit that referenced this pull request Jan 22, 2018
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: #17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 30, 2018
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: #17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Feb 27, 2018
Currently the cctest target build will fail if configured with --enable-static

$ ./configure --enable-static
$ make

There're some function multiple definition errors such as:
  out/Release/obj.target/node/src/node_crypto.o: In function `node::crypto::RandomBytesWork(uv_work_s*)':
  node_crypto.cc:(.text+0x60): multiple definition of `node::crypto::RandomBytesWork(uv_work_s*)'
  out/Release/obj.target/node/src/node_crypto.o:node_crypto.cc:(.text+0x60): first defined here

It's caused by repetition objects in libraries and libnode.a.
This CL makes those libraries guarded by 'node_target_type!="static_library"'.

PR-URL: #17992
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Member

This lands cleanly on v8.x but requires a manual backport for v6.x

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants