-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
collect2: fatal error: cannot find 'ld'
compiling v5.2.0 on Alpine Linux
#4212
Comments
It's probably the diff --git a/common.gypi b/common.gypi
index 5b8b2c0..1ebfa7c 100644
--- a/common.gypi
+++ b/common.gypi
@@ -23,6 +23,9 @@
# Don't bake anything extra into the snapshot.
'v8_use_external_startup_data%': 0,
+ # Don't use gold linker.
+ 'linux_use_gold_flags%': 0,
+
'conditions': [
['OS == "win"', {
'os_posix': 0, |
That may very well be it. Compiling now. If so, question is – is it better to require gold linker to be installed (looks like there might be one for Alpine: https://pkgs.alpinelinux.org/package/main/x86_64/binutils-gold) – not use it at all (as your patch does) – or detect whether it's installed during the build and only use it then? |
Hmmm, for some reason it's still including that flag (and failing) After patching Did I need to do something else? |
Now trying with the original |
I wonder if |
The flag is passed in |
Ok – so it just finished compiling successfully (using the original v5.2.0 source) after installing I'm happy for that to be the solution for now (for me anyway) – another dependency in the build chain I guess! Up to you whether you want to mark this as closed, or continue exploring options that don't require the gold linker as a dependency? |
FWIW I just encountered this on CentOS 6 with the compilers provided by |
@mscdex we run the same toolset at ci for centos5/6; haven't seen this error so far. |
Follow up: using Previously I was manually setting |
@mhart, are you sure it was the original 5.2.0 source? I just tried to run your exact Dockerfile code and it fails with:
|
@smebberson Yeah, I built v5.2.0 using this exact Dockerfile and pushed it up to the Docker hub. Also built a static version successfully using this Dockerfile and pushed it up too. |
@smebberson Ah, I see you have an impressively similar Dockerfile here: https://github.com/smebberson/docker-alpine/blob/master/alpine-nodejs/Dockerfile 😆 Try mine as is and let me know how you go |
@mhart, I copied and pasted yours verbatim and it didn't work. I have no idea why though. I've even applied the patch (using my Dockerfile) and it still didn't build. The error message I posted above is what I received when running your exact Dockerfile. |
Try disabling snapshots ( |
@jbergstroem, that worked! Thanks. |
(We recently enabled this by default which is why you didn't see this earlier) |
@jbergstroem. Ah okay. I see. Well, I can confirm that I can also build it with:
|
We also encount this problem when we compile node.js 4.2.4. What's the usage of |
I believe compiling with |
so, could I infer that compile 4.2.4 with |
See commit 49b3c3b, released in 4.2.4. Binaries were supposed to be built with snapshots enabled, but weren't. The snapshot/nosnapshot performance difference is negligible for most use cases; it slows startup by perhaps 50 ms on x86. |
@bnoordhuis Thanks;) |
I've encountered this issues as well trying to compile |
Fix collect2: fatal error: cannot find 'ld' The snapshot feature requires the gold linker. See nodejs/node#4212
The |
Thanks for this! apk add binutils-gold fixed it for me. (node version 4.2.6) |
I guess we can close this now. The workaround is to build with |
Just a follow up to this – installing The only method I've found so far that reliably works is manually editing It looks like this change might be made permanent in #6603 ...? |
This appears to be the only option for now to get this to compile on certain OS/architecture combinations (Docker Hub being one of them). Hopefully this is just a temporary solution. See nodejs/node#4212 and nodejs/node#6603 for more details.
It also works to set the |
Actually, turns out I was just being stupid and the problem before was that I wasn't exporting it. So, you can just do |
This appears to be the only option for now to get this to compile on certain OS/architecture combinations (Docker Hub being one of them). Hopefully this is just a temporary solution. See nodejs/node#4212 and nodejs/node#6603 for more details.
I'm getting this error when compiling Node.js v5.2.0 on Alpine Linux 3.2. This error does not occur with any version <= v5.1.1 – including all io.js versions.
Any idea what may have changed that could cause this, or how to fix it?
You can reproduce using Docker and running
alpine:3.2
. The following packages have been installed:$ apk add --update curl make gcc g++ python linux-headers paxctl libgcc libstdc++
After fetching the v5.2.0 source, here's the configure and make output:
For comparison, here's the same output compiling v5.1.1 on the same setup:
The text was updated successfully, but these errors were encountered: