-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Node compilation option error #3207
Comments
@luisfpinto what architecture and operating system are you running on? |
I' trying to compile node in two operative systems: If I compile node without --fully-static flag, I don't get any problems. But I need it. |
Thank you! @jbergstroem . |
FWIW I've only had good luck with musl as far as compiling a fully static binary goes. Static binaries compiled with glibc still need to access shared libraries like nss modules (e.g. for resolving hostnames through dns and /etc/hosts) and such. The one downside is that most libc implementations do not provide dlopen() when compiling statically, which is needed to load compiled node addons (like the |
@luisfpinto have you had a look at the wiki? It fails for me also, but due to this is expected due to Mac OS's gcc issue and so it would be expected. I see |
Just to be clear: the static issues on mac ( |
I've also tried to compile on Ubuntu and It has the same error. |
I have a similar issue, I think. I'm cross-compiling nodejs 4.1.2 for mipsel and I've run into a snag trying to get a static binary image build. At the moment our runtime MIPS environment is running an older linux built with gcc 3.4 -- but our application requires 4.9. It's a long story, but bottom line is that for the next couple of weeks I need to build with 4.9 and run in this older 3.4 environment -- if possible. My strategy was to build nodejs with static libraries by building/making it like this:
But when I tried running a test "hello world" node app, I can see that something is not quite right. I'm not sure if I am reading the error messages right, either, because it appears that nodejs has somehow loaded libstdc++.so.6 (which I didn't think it would do, being statically linked). Further, it also appears that the
So maybe I need to back up for a moment and ask some questions:
|
I think you'll need to make sure that your host and target machines match up (host = the system you're cross-compiling on), at least when it comes to standard libraries. Linking glibc statically almost never works, just google for the horror stories. You could try linking in musl or uclibc instead. Linking libstdc++ statically is probably okay (although native add-ons may not work) but you're going to have to hack the build system to ensure it links against libstdc++.a, not the .so. If your compiler knows about |
@pmclee I was able to build a fully static v4.2.1 binary for mipsel using musl. If you want to build one yourself, you'll need to build a cross compiler compatible with musl (if you want to use the cross compiler (uses musl 1.1.11) I built, you can get that here and skip to step 5 if you are using that). Here's what I did to build the cross compiler:
|
@mscdex -- thanks so much for the detailed instructions! As it turned out, we got the linux root fs recompiled sooner than I expected. I followed your advice and used the 4.2.1 source. Everything seems to have built correctly and I ran a "hello, world" test app this morning. Thanks again for the help! |
Closing as this seems to have been resolved. Should we perhaps document these instructions on the wiki? |
Hi guys!
I'm trying to compile nodejs with --fully-static flag, in order to get a fully statically linked executable. However, when I try to compile, this error appears:
Do you know how to solve this problem?
Thank you in advance!
The text was updated successfully, but these errors were encountered: