Skip to content

Commit

Permalink
build: fix cctest target with --enable-static
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
liqyan authored and evanlucas committed Jan 24, 2018
1 parent 8f8e747 commit dd72f9c
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions node.gyp
Expand Up @@ -855,11 +855,15 @@
],
}],
[ 'node_use_openssl=="true"', {
'libraries': [
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_bio.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_clienthello.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)tls_wrap.<(OBJ_SUFFIX)',
'conditions': [
['node_target_type!="static_library"', {
'libraries': [
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_bio.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_crypto_clienthello.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)tls_wrap.<(OBJ_SUFFIX)',
],
}],
],
'defines': [
'HAVE_OPENSSL=1',
Expand All @@ -870,18 +874,22 @@
'test/cctest/test_inspector_socket.cc',
'test/cctest/test_inspector_socket_server.cc'
],
'libraries': [
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_agent.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_io.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_js_api.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_socket.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_socket_server.<(OBJ_SUFFIX)',
'conditions': [
['node_target_type!="static_library"', {
'libraries': [
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_agent.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_io.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_js_api.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_socket.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)inspector_socket_server.<(OBJ_SUFFIX)',
],
}],
],
'defines': [
'HAVE_INSPECTOR=1',
],
}],
[ 'node_use_dtrace=="true"', {
[ 'node_use_dtrace=="true" and node_target_type!="static_library"', {
'libraries': [
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace.<(OBJ_SUFFIX)',
],
Expand All @@ -899,14 +907,18 @@
}],
],
}],
[ 'OS=="win"', {
[ 'OS=="win" and node_target_type!="static_library"', {
'libraries': [
'<(OBJ_PATH)<(OBJ_SEPARATOR)backtrace_win32.<(OBJ_SUFFIX)',
],
],
}, {
'libraries': [
'<(OBJ_PATH)<(OBJ_SEPARATOR)backtrace_posix.<(OBJ_SUFFIX)',
],
'conditions': [
['node_target_type!="static_library"', {
'libraries': [
'<(OBJ_PATH)<(OBJ_SEPARATOR)backtrace_posix.<(OBJ_SUFFIX)',
],
}],
],
}],
[ 'node_shared_zlib=="false"', {
'dependencies': [
Expand Down

0 comments on commit dd72f9c

Please sign in to comment.