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

Nodejs build error when trying to build as static library #1863

Closed
niks3089 opened this issue Apr 12, 2019 · 3 comments
Closed

Nodejs build error when trying to build as static library #1863

niks3089 opened this issue Apr 12, 2019 · 3 comments

Comments

@niks3089
Copy link

  • 11.14.0:
  • Ubuntu 18.04:
  • Building:
  • clang-6.0:

I am trying to build node as a static library, however when I run

./configure --fully-static --enable-static
make -j4

I see the below error:

/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o: In function `dlfcn_load
':                                                                                      
dso_dlfcn.c:(.text+0x4d): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/bio/b_addr.o: In function `BIO_lookup_ex
':                      
b_addr.c:(.text+0x982): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/bio/b_sock.o: In function `BIO_gethostby
name':                                                             
b_sock.c:(.text+0x231): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
  touch 3b2ce0ad5cd0f84a9a09308b6734ccc3560f8ac4.intermediate
  LD_LIBRARY_PATH=/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/lib.host:/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5
d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/gypfiles; mkdir -p /home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d
88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/obj/gen/torque-generated; "/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/torq
ue" ../src/builtins/base.tq ../src/builtins/array.tq ../src/builtins/array-copywithin.tq ../src/builtins/array-foreach.tq ../src/builtins/array-reverse.tq ../src/builtins/typed-array.tq ../src/builtins/da
ta-view.tq ../third_party/v8/builtins/array-sort.tq -o "/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/obj/gen/torque-generated"
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcasecmp' with pointer equality in `/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../x86_64-linux-gnu/libc.a(strcasecmp.o)' can not be used when making an e
xecutable; recompile with -fPIE and relink with -pie
clang: error: linker command failed with exit code 1 (use -v to see invocation)
deps/openssl/openssl-cli.target.mk:237: recipe for target '/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/openssl-cli' failed
make[1]: *** [/home/nikhil/.conan/data/node/11.14.0/includeos/test/build/5d88dc4b26402479b7aa0fcb29ca9b9c28da4c9f/node/out/Release/openssl-cli] Error 1
make[1]: *** Waiting for unfinished jobs....
rm 3b2ce0ad5cd0f84a9a09308b6734ccc3560f8ac4.intermediate addced3c36ef33dba58eeba9a13559ff046244ea.intermediate
Makefile:100: recipe for target 'node' failed
make: *** [node] Error 2
@bnoordhuis
Copy link
Member

The short answer is that static linking to glibc doesn't work in general, google around for reasons. You need to link to a libc like musl if you want to use --fully-static.

@gireeshpunathil
Copy link
Member

ping @niks3089 - is this resolved?

@niks3089
Copy link
Author

yes it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants