This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
statically linked executable
Jesús Leganés Combarro edited this page Sep 2, 2014
·
4 revisions
Node.js has support to be compiled as a fully statically linked executable just by using the --fully-static
configure flag. This allow to don't need external dynamic libraries (.so, .dll, .dylib...) and it's main purpose is for embebed platforms. Thought, it's somewhat experimental and has some issues you need to know before using it:
-
it's dependent of the C lib used: the standard glibc (found on Ubuntu, for example) don't build true fully statically linked executables, since by design it load internally some dynamic libraries due to portability purposses, so glibc
libc.so
file needs to be accesible. This doesn't happens with other alternative C libs like musl, uclib or DietLib, for example. -
doesn't work with MacOS X developer tools: vanilla gcc compiler on MacOS X don't recognize the
-static
flag since it's intended to use only dynamic linking. It could work with other compilers (installed with homebrew or macports, for example), but this has not been tested. -
there can be compilation issues: not directly related with static compilation, but for example OpenSSL doesn't compile correctly using the musl C lib. Only solution found so far is to use the
--no-ssl
configure flag. If you find any of this, please open an issue. -
it could not load compiled modules: some C libs like musl (and seems glibc too) use a stripped-down version of the
dlopen()
function when included in statically linked execubles, so maybe loading of Node.js compiled modules would fail. Requiring pure Javascript modules will work as expected, thought.