I cross compiled a more recent version of node.js (v0.8.14) for the Raspberry Pi. Comparing the new version to the node v0.6.19 installed via apt-get, I was surprised that the size of the executable jumped from 1.2Mb to 6.2Mb.
Is the 5x increase in size due to
pi@raspberrypi ~ $ /usr/bin/node -v; ll -h /usr/bin/node; file /usr/bin/node v0.6.19 -rwxr-xr-x 1 root root 1.2M Jun 30 18:55 /usr/bin/node /usr/bin/node: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26,uildID[sha1]=0xb29e21fbf3e8a7db733fbcd0539e593264d88c94, stripped pi@raspberrypi ~ $ ./node -v; ll -h ./node; file ./node v0.8.14 -rwxr-xr-x 1 pi pi 6.2M Oct 28 20:43 ./node ./node: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.5.0, stripped
After taking a closer look at both binaries with readelf
, the majority of the size increase is because the larger binary is using a number of statically linked code -- the smaller binary is linked against more shared libraries.
FYI: The shared libraries linked in the smaller node were [libssl.so.1.0.0], [libz.so.1], [libv8.so.3.8.9.20], [ld-linux-armhf.so.3], [libcares.so.2], [libcrypto.so.1.0.0], [libev.so.4], & [libutil.so.1].