Updated Statically linked executable (markdown)

Gabriel "_|Nix|_" Schulhof 2018-03-20 16:06:04 -04:00
parent 1b5dd717cc
commit 1b57a257ea

@ -1,5 +1,5 @@
Node.js has support to be compiled as a [fully statically linked executable](https://github.com/joyent/node/pull/8274) just by using the ```--fully-static``` configure flag. That way it doesn't require external dynamic libraries (.so, .dll, .dylib...) and its main purpose is for embedded platforms. Nevertheless, 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) cannot be used to build fully statically linked executables, as some components are designed such that they require loading dynamic libs for some functionality. This doesn't happen with other alternative C libs like musl, uclib or DietLib, for example.
* **It 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](http://stackoverflow.com/questions/5259249/creating-static-mac-os-x-c-build). It could work with other compilers (installed with homebrew or macports, for example), but this has not been tested.
* **It doesn't work with MacOS X developer tools**: the vanilla gcc compiler on MacOS X doesn't recognize the ```-static``` flag since [it's intended to use only dynamic linking](http://stackoverflow.com/questions/5259249/creating-static-mac-os-x-c-build). It could work with other compilers (installed with homebrew or macports, for example), but this has not been tested.
* **It could not load compiled modules**: some C libs like musl (and seems glibc too) either use a stripped-down version of the ```dlopen()``` function or dynamic loading functionality is stubbed out entirely ([at least with musl 1.1.11](http://git.musl-libc.org/cgit/musl/tree/src/ldso/dynlink.c?h=v1.1.11#n1711)) when included in statically linked executables, so loading of Node.js compiled modules could fail. Requiring pure Javascript modules will work as expected, though.