Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Fully static linking #72

Closed
wants to merge 4 commits into from
Closed

Fully static linking #72

wants to merge 4 commits into from

Conversation

nickgrealy
Copy link

@nickgrealy nickgrealy commented Oct 16, 2019

  • Added ability to configure "fully static" linking when building
  • Added documentation to readme.md

Hopefully closes vercel/pkg#555

@nickgrealy
Copy link
Author

nickgrealy commented Oct 16, 2019

Just created PR so it was "ready to go"... building locally atm...

--UPDATE--

node8 WORKS! -> pkg-fetch -b -s node8 linux x64

node10 DOESN'T -> but it's because of the Node version (see here)

Segmentation fault
deps/v8/gypfiles/v8_torque.host.mk:16: recipe for target '4b1666e50775e7c9a42468e40b1c173e293b7533.intermediate' failed
make[1]: *** [4b1666e50775e7c9a42468e40b1c173e293b7533.intermediate] Error 139
rm 4b1666e50775e7c9a42468e40b1c173e293b7533.intermediate
Makefile:99: recipe for target 'node' failed
make: *** [node] Error 2
> Error! Error: make failed with code 2
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/pkg-fetch/lib-es5/spawn.js:68:23)
    at ChildProcess.emit (events.js:215:7)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:210:5)
    at Pipe.<anonymous> (net.js:658:12)
The command '/bin/sh -c pkg-fetch -b -s ${NODE} ${PLATFORM} ${ARCH}' returned a non-zero code: 2

@igorklopov - not sure what to test re: "prevents native modules to be required" - but I think we should at least give people the option to have fully static linking.

Ready for merge (if you're happy with the PR?)

@einsqing
Copy link

need

@awjreynolds
Copy link

Be extremely careful with full static linking as you are now including libraries with copy-left license agreements. Particularly Ubuntu distributions. This could get you into a huge amount of legal hot water.

@igorklopov
Copy link
Contributor

igorklopov commented Apr 26, 2020

This may need -static component to be added to target naming scheme, like node12-linux-x64-static so that both original and fully static can coexist and be used separately.

@jesec
Copy link
Contributor

jesec commented Apr 16, 2021

We support a fully static "linuxstatic" variant now. Just specify "linuxstatic" as the platform.

Note that if you want to build/compile, you have to build on Alpine (musl libc), because it is not practical to statically link against GNU libc:

  • GNU libc is licensed under LGPL, which is basically GPL with dynamic linking exceptions. Static linking does not fall under this exception. If statically linked to glibc, the whole executable becomes effectively GPL, which could subject your own codes to the requirements of GPL if you distribute the result executable of pkg.
  • glibc is unreliable when statically linked, and the program would crash in certain cases, potentially due to NSS.

@jesec
Copy link
Contributor

jesec commented May 11, 2021

Closing per #72 (comment) .

@jesec jesec closed this May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Static link libstdc++
5 participants