Skip to content
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

Build of v8/tools/gyp/mksnapshot fails with -fuse-ld=gold with binutils 2.25.1 #6603

Closed
BlackYoup opened this issue May 5, 2016 · 9 comments
Labels
build Issues and PRs related to build files or the CI. v8 engine Issues and PRs related to the V8 dependency.

Comments

@BlackYoup
Copy link
Contributor

BlackYoup commented May 5, 2016

Hi everyone,

I'm building node from source but I'm getting a gold error at linking phase of v8/tools/gyp/mksnapshot:

x86_64-pc-linux-gnu-c++ -pthread -rdynamic -m64 -fuse-ld=gold -B/var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/third_party/binutils/Linux_x64/Release/bin -m64  -o /var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out/Release/mksnapshot -Wl,--start-group /var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/mksnapshot.o /var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a /var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out/Release/obj.target/deps/v8/tools/gyp/libv8_libplatform.a /var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out/Release/obj.target/deps/v8/tools/gyp/libv8_libbase.a -Wl,--end-group -lz -licui18n -licuuc -licudata -ldl -lrt
/usr/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ld.gold: internal error in sized_finalize_symbol, at /var/tmp/paludis/build/sys-devel-binutils-2.25.1-r5/work/binutils-2.25.1/gold/symtab.cc:2768
collect2: error: ld returned 1 exit status
deps/v8/tools/gyp/mksnapshot.target.mk:145: recipe for target '/var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out/Release/mksnapshot' failed
make[1]: *** [/var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out/Release/mksnapshot] Error 1
make[1]: Leaving directory '/var/tmp/paludis/build/dev-lang-node-5.4.1/work/node-v5.4.1/out'
Makefile:45: recipe for target 'node' failed
make: *** [node] Error 2

My gold version: GNU gold (GNU Binutils 2.25.1) 1.11
I do not have this error with binutils 2.26 or if I set 'linux_use_gold_flags%': 0 in deps/v8/build/toolchain.gypi

I wanted to know if there was a more global flag to disable -fuse-ld ? I checked #4212 but didn't really help.
If I set --without-snapshot it builds too but I'm not a fan of disabling a feature because it doesn't build.
Binutils 2.26 is not yet fully available on my platform, hence my question.

Here is the result of the configure:

./configure --prefix=/usr/x86_64-pc-linux-gnu --shared-zlib --with-intl=system-icu
creating  ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': [ '-lz',
                                      '-licui18n',
                                      '-licuuc',
                                      '-licudata']},
  'variables': { 'asan': 0,
                 'gas_version': '2.25',
                 'host_arch': 'x64',
                 'icu_gyp_path': 'tools/icu/icu-system.gyp',
                 'icu_small': 'false',
                 'node_byteorder': 'little',
                 'node_enable_v8_vtunejit': 'false',
                 'node_install_npm': 'true',
                 'node_prefix': '/usr/x86_64-pc-linux-gnu',
                 'node_release_urlbase': '',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_zlib': 'true',
                 'node_tag': '',
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_lttng': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'openssl_fips': '',
                 'openssl_no_asm': 0,
                 'python': '/usr/bin/python2',
                 'target_arch': 'x64',
                 'uv_parent_path': '/deps/uv/',
                 'uv_use_dtrace': 'false',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 1,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_random_seed': 0,
                 'v8_use_snapshot': 'true',
                 'want_separate_host_toolset': 0}}
creating  ./config.gypi
creating  ./config.mk

Thanks for your help !

@mscdex mscdex added build Issues and PRs related to build files or the CI. v8 engine Issues and PRs related to the V8 dependency. labels May 5, 2016
@mscdex
Copy link
Contributor

mscdex commented May 5, 2016

'linux_use_gold_flags%': 0 was added recently in 3cdb506 by @bnoordhuis. Perhaps it should be backported to v4.x and v5.x as well?

@bnoordhuis
Copy link
Member

#6393 is labeled lts-watch-v4.x so it's scheduled for v4.x and v5.x I'll close, there is nothing left to do except release.

@BlackYoup You can apply https://github.com/nodejs/node/commit/3cdb506.patch for now to work around the issue.

@BlackYoup
Copy link
Contributor Author

BlackYoup commented May 6, 2016

@bnoordhuis Well, I didn't explicitly said it but I tried this patch first and still have the same build issue. But it builds by directly setting the value to 0 in deps/v8/build/toolchain.gypi

diff --git a/deps/v8/build/toolchain.gypi b/deps/v8/build/toolchain.gypi
index c2974c5..d77f209 100644
--- a/deps/v8/build/toolchain.gypi
+++ b/deps/v8/build/toolchain.gypi
@@ -126,7 +126,7 @@
       # linux_use_gold_flags: whether to use build flags that rely on gold.
       # On by default for x64 Linux.
       ['OS=="linux" and target_arch=="x64"', {
-        'linux_use_gold_flags%': 1,
+        'linux_use_gold_flags%': 0,
       }, {
         'linux_use_gold_flags%': 0,
       }],

@bnoordhuis
Copy link
Member

bnoordhuis commented May 6, 2016

I'll reopen, perhaps recent changes broke something. With master, -B is used (again) but -fuse-ld=gold is not.

@bnoordhuis bnoordhuis reopened this May 6, 2016
@BlackYoup
Copy link
Contributor Author

@bnoordhuis do you want me to try with current master then ?

@bnoordhuis
Copy link
Member

You can if you want to, there's a decent chance it'll work for you. I still need to look into why it's only partially disabled, though.

@mhart
Copy link
Contributor

mhart commented May 8, 2016

FWIW I've had to overwrite linux_use_gold_flags% to 0 to get it compile on Alpine on Docker Hub too (this was the only change that seemed to work – it also, obviously, didn't require installing binutils-gold anymore). Trying to set GYP_DEFINES had no effect unfortunately (edit: it does work actually, just need to make sure you export it! Duh. export GYP_DEFINES="linux_use_gold_flags=0")

@bnoordhuis the patch you linked to sets linux_use_bundled_gold% to 0, but not linux_use_gold_flags%, which seems to be the magic lever.

mhart added a commit to mhart/alpine-node that referenced this issue May 8, 2016
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.
@mhart
Copy link
Contributor

mhart commented May 8, 2016

@bnoordhuis could it be that these flags in toolchain.gypi aren't overridden by setting them in common.gypi?

@bnoordhuis
Copy link
Member

@mhart Yes, it appears that no longer works. PR: #6650

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue May 10, 2016
It looks like suppressing `-B` and `-fuse-ld=gold` from common.gypi is
not very reliable.  I'm positive it worked when commit 3cdb506 ("build:
don't compile with -B") was merged but subsequent updates appear to have
broken it again.

Take the nuclear option and disable them from `tools/node_gyp.py`.

Fixes: nodejs#6603
PR-URL: nodejs#6650
Refs: nodejs#6393
Reviewed-By: Anna Henningsen <[email protected]>
evanlucas pushed a commit that referenced this issue May 17, 2016
It looks like suppressing `-B` and `-fuse-ld=gold` from common.gypi is
not very reliable.  I'm positive it worked when commit 3cdb506 ("build:
don't compile with -B") was merged but subsequent updates appear to have
broken it again.

Take the nuclear option and disable them from `tools/node_gyp.py`.

Fixes: #6603
PR-URL: #6650
Refs: #6393
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this issue Jun 2, 2016
It looks like suppressing `-B` and `-fuse-ld=gold` from common.gypi is
not very reliable.  I'm positive it worked when commit 3cdb506 ("build:
don't compile with -B") was merged but subsequent updates appear to have
broken it again.

Take the nuclear option and disable them from `tools/node_gyp.py`.

Fixes: #6603
PR-URL: #6650
Refs: #6393
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this issue Jun 24, 2016
It looks like suppressing `-B` and `-fuse-ld=gold` from common.gypi is
not very reliable.  I'm positive it worked when commit 3cdb506 ("build:
don't compile with -B") was merged but subsequent updates appear to have
broken it again.

Take the nuclear option and disable them from `tools/node_gyp.py`.

Fixes: #6603
PR-URL: #6650
Refs: #6393
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this issue Jun 24, 2016
It looks like suppressing `-B` and `-fuse-ld=gold` from common.gypi is
not very reliable.  I'm positive it worked when commit 3cdb506 ("build:
don't compile with -B") was merged but subsequent updates appear to have
broken it again.

Take the nuclear option and disable them from `tools/node_gyp.py`.

Fixes: #6603
PR-URL: #6650
Refs: #6393
Reviewed-By: Anna Henningsen <[email protected]>
PetarKirov pushed a commit to PetarKirov/alpine-node that referenced this issue Nov 15, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

4 participants