Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 704966 - net-libs/nodejs-13.6.0 with sys-devel/binutils' - ld: error: .../work/node-v13.6.0/src/large_pages/ld.implicit.script:10:10: syntax error, unexpected STRING
Summary: net-libs/nodejs-13.6.0 with sys-devel/binutils' - ld: error: .../work...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal with 1 vote (vote)
Assignee: No maintainer - Look at if you want to take care of it
Depends on:
Blocks: systemwide-gold
  Show dependency tree
Reported: 2020-01-08 11:38 UTC by Christopher Frömmel
Modified: 2020-11-09 12:53 UTC (History)
11 users (show)

See Also:
Package list:
Runtime testing required: ---

build log (build.log.bz2,25.26 KB, application/x-bzip)
2020-01-08 11:45 UTC, Christopher Frömmel
Details (,503 bytes, patch)
2020-01-08 20:44 UTC, Jeroen Roovers (RETIRED)
Details | Diff (,504 bytes, patch)
2020-01-08 20:50 UTC, Jeroen Roovers (RETIRED)
Details | Diff
net-libs:nodejs-13.6.0:20200108-204921.log.xz (net-libs:nodejs-13.6.0:20200108-204921.log.xz,855.93 KB, application/x-xz)
2020-01-10 09:54 UTC, Jeroen Roovers (RETIRED)

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Frömmel 2020-01-08 11:38:19 UTC
With binutils (+default-gold) building of nodejs-13.6.0 fails. The default-gold use flag sets ld to point to instead of ld.bfd.

/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: /var/tmp/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/src/large_pages/ld.implicit.script:10:10: syntax error, unexpected STRING
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: fatal error: unable to parse script file /var/tmp/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/src/large_pages/ld.implicit.script
collect2: error: ld returned 1 exit status

Reproducible: Always

Steps to Reproduce:
1. USE="default-gold" emerge -1av binutils
2. emerge -1av nodejs
Actual Results:  

Expected Results:  

emerge --info
Portage 2.3.84 (python 3.6.10-final-0, default/linux/amd64/17.1/desktop, gcc-9.2.0, glibc-2.30-r3, 5.4.8-gentoo+ x86_64)
System uname: Linux-5.4.8-gentoo+-x86_64-Intel-R-_Core-TM-_i7-4790K_CPU_@_4.00GHz-with-gentoo-2.6
KiB Mem:    32848908 total,  25131872 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Wed, 08 Jan 2020 10:00:01 +0000
Head commit of repository gentoo: 185174232edd12a37bc8325994d662cc49614506
Head commit of repository steam-overlay: d77d22779230e23014724e9046225b4f3124df34

sh bash 5.0_p11
ld GNU gold (Gentoo 2.33.1 p2 2.33.1) 1.16
app-shells/bash:          5.0_p11::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.17-r1::gentoo, 3.6.10::gentoo, 3.7.6::gentoo
dev-util/cmake:           3.16.2-r1::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.1-r2::gentoo
sys-devel/binutils:       2.33.1-r1::gentoo
sys-devel/gcc:            9.2.0-r3::gentoo
sys-devel/gcc-config:     2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r3::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24

    location: /usr/local/portage/steam-overlay
    sync-type: git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
FCFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="X a52 aac aacs acpi addc airplay alsa amd64 appindicator archive ayatana bash-completion bcache bdplus berkdb bittorrent bluetooth bluray branding bzip2 cairo calf cdda cdio cdr cgroups chromium clamav clamdtop clang cli client creds cron crypt cryptsetup cups curl custom-cflags custom-optimization cxx dav1d dbus default-gold device-mapper dga dhcp dhcpcd dos dri dri3 dts dvb dvd dvdr editor efi egl elogind emboss encode evdev exif f2fs faad fasttrack fat fdk ffmpeg fftw flac flambda fluidsynth fontconfig fortran fribidi fullscreen fuse gcrypt gdbm geoclue geolocation gif gles gles2 glib glut gme gnome-keyring gnutella gnutls gold googledrive gpg gpgme gpm graph graphite gssapi gstreamer gtk gtk3 haptic hddtemp highlight hpn http http2 hunspell iconv icq icu id3tag idn imagemagick imap inotify inspector ios ipp_autosetup ipv6 java jit joystick jpeg json jumbo-build kbd kerberos kms lcms libcanberra libdrm libevent libinput libnotify libtirpc libuvc libv4l lightdm live lm-sensors lm_sensors logrotate lto lv2 lvm lz4 lzma lzo mad magic man matroska media memcached messages metalink midi mikmod minizip mjpeg mmap mms mng mod modern-top mp3 mp4 mpeg mpeg2 mtp multilib native-headset ncurses netapi network networkmanager nls nntp nptl nss ntfs ntfsdecrypt ntlm ntp nvenc nvidia oauth ocamlopt odf offensive office ogg openal opencl openconnect opengl openh264 openmp openssl openvpn opus pam pango pci pclm pcre pdf pdfimport pgo pidgin plugin-sysinfo png policykit portaudio postproc postscript ppds pptp pulseaudio python qt5 qtaudio rar rdp readline samba sasl scanner script sdl seccomp secure-delete sensors sftp shout silc sip sipe skins smpeg snappy sound speex spell split-usr sqlite srt ssh ssl startup-notification steam steamfonts svg sync-plugin-portage syslog systray taglib tcpd theora threads thunar tiff tpm tray trayicon truetype udev udf udisks unicode update_drivedb upnp upnp-av upower usb uvm v4l v4lutils vaapi vcd vdo vdpau video videoeffects vlc vnc voice vorbis vpnc vpx vte wayland wayland-compositor webcam webdav webp webserver widevine widgets wifi winbind wxwidgets x264 x265 xa xcb xcomposite xfce xinerama xml xps xrandr xv xvfb xvid xvmc xwayland zlib zstd zvbi" ABI_X86="64" ADA_TARGET="gnat_2019" ALSA_CARDS="hda-intel usb-audio" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="nss" ELIBC="glibc" INPUT_DEVICES="libinput joystick" KERNEL="linux" L10N="de" LCD_DEVICES="ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF x86 NVPTX" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" SANE_BACKENDS="net" USERLAND="GNU" VIDEO_CARDS="nvidia"
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-08 11:42:28 UTC
Please attach the entire build log to this bug report.
Comment 2 Christopher Frömmel 2020-01-08 11:45:01 UTC
Created attachment 602774 [details]
build log
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-08 12:02:21 UTC does not support "INSERT", only ld.bfd does. It might work if you could get it to use the llvm/lld linker script instead: src/large_pages/ld.implicit.script.lld. This is automagically configured in node.gypi from line 316-323.
Comment 4 Marek Bartosiewicz 2020-01-08 14:36:52 UTC
But yeah, binutils-config --linker considered harmful.
Comment 5 Adrian Bassett 2020-01-08 16:14:24 UTC
(In reply to Marek Bartosiewicz from comment #4)
> But yeah, binutils-config --linker considered harmful.

Why is that?  This option appears to have disappeared from binutils-config-5.2 (despite the comments at commit bd195f1e0d49e664119adb29100dbd7a094bd008 in the portage git tree which makes no mention of dropping '4. via 'binutils-config --linker'').

Not everything I build (including kernel from git) is done within the portage environment and therefore configurable via package.env;  and the ability to manually select the non-default (for me) ld.bfd for things that don't support it is really useful.  E.g. 'make menuconfig' for a kernel configuration (I know that genkernel.conf allows setting the linker for the actual build).

I have 2597 packages on my system at the moment of which only 35 are excepted in package.env while three absolutely seem to require temporarily setting the system default to ld.bfd via 'binutils-config --linker': dev-lang/fpc, media-libs/libdv, and sys-fs/fuse.

Sorry if this is a bit off-topic :-)
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-08 20:42:45 UTC
(In reply to Adrian Bassett from comment #5)
> (In reply to Marek Bartosiewicz from comment #4)
> > But yeah, binutils-config --linker considered harmful.
> Why is that?

Please just ignore that remark.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-08 20:44:45 UTC
Created attachment 602802 [details, diff]

Could you please try this patch, please?
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-08 20:50:58 UTC
Created attachment 602804 [details, diff]

Or rather this one.
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-08 23:45:57 UTC
Comment on attachment 602804 [details, diff]

Found some CPU time for this issue. It ends in tears:

  x86_64-pc-linux-gnu-g++ -o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/cctest -pthread -rdynamic -m64 -Wl,-z,noexecstack -Wl,--whole-archive /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ -Wl,--no-whole-archive -Wl,-z,relro -Wl,-z,now -Wl,-T /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/src/large_pages/ld.implicit.script -pthread -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,--start-group /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/
/home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/ -lz -luv -lcares -lnghttp2 -lcrypto -lssl -licui18n -licuuc -licudata -lm -ldl -Wl,--end-group
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/cctest: section .tbss._ZN2v88internal12trap_handler21g_thread_in_wasm_codeE lma 0x1ba78f0 adjusted to 0x1ba78f8
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/cctest: section .tbss._ZN2v88internal4wasm12_GLOBAL__N_123current_code_refs_scopeE lma 0x1ba78f0 adjusted to 0x1ba78fc
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libc_nonshared.a(elf-init.oS): in function `__libc_csu_init':
/home/portage/sys-libs/glibc-2.29-r7/work/glibc-2.29/csu/elf-init.c:86: undefined reference to `__init_array_start'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/portage/sys-libs/glibc-2.29-r7/work/glibc-2.29/csu/elf-init.c:86: undefined reference to `__init_array_end'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/cctest: hidden symbol `__init_array_end' isn't defined
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [ /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/cctest] Error 1
rm 9b618608d1836b86d89bfa1177c55f98dcf5ad7d.intermediate 8d4d4fd8099490bb1c411491e03d2eaab3ab9f32.intermediate d72a3078e7785df8935aac9322b213abaddb011f.intermediate 8c42cd33c4f5575ff535a73ba612b012bb58984f.intermediate
make: Leaving directory '/home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out'
 * ERROR: net-libs/nodejs-13.6.0::gentoo failed (compile phase):
 *   emake failed
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-10 09:54:12 UTC
Created attachment 602912 [details]

(In reply to Jeroen Roovers from comment #8)
> Created attachment 602804 [details, diff] [details, diff]

For reference, this is the build log with the linker script switched as per attachment #602804 [details, diff] and with C/CXXFLAGS+=-fuse-ld=gold. Maybe I simply forgot a step and maybe it should work after all.
Comment 11 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-10 10:47:54 UTC
Ah, but we set this in the ebuild, too:

Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2020-01-10 10:52:38 UTC
And in tools/v8_gypfiles/toolchain.gypi, linux_use_gold_flags==1 is checked for and that sets:

        'ldflags': [ '-fuse-ld=gold', ],

Comment 13 Rainer Hihn 2020-01-23 12:55:33 UTC
Is there a solution for this issue?

I'm unable to emerge either net-libs/nodejs-13.6.0 nor net-libs/nodejs-13.7.0, with or without the appended patch.
Comment 14 Mike Lothian 2020-01-23 15:34:17 UTC
I've worked around it by building with clang and linking with ld.lld

I already had an env set up for building chromium so I reused that

There are other examples if you don't want LTO or O3
Comment 15 Jan Psota 2020-01-23 18:17:58 UTC
I confirm proper merge of 13.7.0 with env/clang:
LDFLAGS="${CFLAGS} -Wl,-O1 -Wl,--as-needed -fuse-ld=lld"

and package.env:
net-libs/nodejs clang

...of course. Thanks! :-)
Comment 16 Duncan 2020-01-25 21:52:44 UTC
(In reply to Rainer HIhn from comment #13)
> Is there a solution for this issue?
> I'm unable to emerge either net-libs/nodejs-13.6.0 nor
> net-libs/nodejs-13.7.0, with or without the appended patch.

[FWIW, initially I simply masked 13.6 and stayed on 13.5 until I had more time to look into it.  I had more time and there were more hints for a minimal workaround on this bug when I tried 13.7.  So...]

Akin comment #15 but more minimal workaround, two files:


# references /etc/portage/env/*

# 2020.0123 doesn't like gold #704966 (CCed)
~net-libs/nodejs-13.7.0         pkg.env/


LDFLAGS="${LDFLAGS} -fuse-ld=bfd"

(Usage notes:  package.env functionality covered in the portage (5) manpage.  Adjust filenames as desired and package atoms as required.  For me, individual functional-change-named files are most useful here, with a comment including the date, a bug number, and whether it's my bug or I'm simply CCed.  That makes it easier to remember the issue and clean up if it's fixed or extend the covered version numbers at the next package update if not, later.)
Comment 17 Matt Whitlock 2020-01-25 22:41:48 UTC
(In reply to Duncan from comment #16)
> LDFLAGS="${LDFLAGS} -fuse-ld=bfd"

toolchain-funcs.eclass has a helper function, tc-ld-disable-gold, to deal with exactly this scenario. The ebuild just needs to use it.
Comment 18 cyrillic 2020-01-25 23:01:37 UTC
(In reply to Jan Psota from comment #15)
> I confirm proper merge of 13.7.0 with env/clang:
> CC=clang
> CXX=clang++
> LDFLAGS="${CFLAGS} -Wl,-O1 -Wl,--as-needed -fuse-ld=lld"
> AR=llvm-ar
> NM=llvm-nm
> RANLIB=llvm-ranlib
> and package.env:
> net-libs/nodejs clang
> ...of course. Thanks! :-)

This may be true with older versions of clang, but when I use llvm/clang/lld-11, I am getting the same failure as when using gold.
Comment 19 Iade Gesso 2020-01-26 21:00:35 UTC
Still present in =net-libs/nodejs-13.7.0-r1

Comment 20 Dennis Schridde 2020-02-01 15:08:41 UTC
Upstream just closed via  It probably does not fix the issue that the build system ignores $LD in at least one case, but it makes nodejs-13.7.0-r1 build on my system.
Comment 21 Matt Whitlock 2020-02-03 23:46:36 UTC
(In reply to Dennis Schridde from comment #20)
> 938abd9535663d45a8ec88d5fa6acc0af8e8fd13

I confirm that the linked patch solves the problem for me. Placing it in /etc/portage/patches/net-libs/nodejs-13.7.0/ works perfectly.
Comment 22 cyrillic 2020-02-07 00:10:56 UTC
The good news is that net-libs/nodejs-13.8.0 no longer fails with gcc/gold.

The bad news is that it still fails with llvm/clang/lld-11.

Oh well, better luck next time ...
Comment 23 Duncan 2020-02-07 06:27:43 UTC
(In reply to cyrillic from comment #22)
> The good news is that net-libs/nodejs-13.8.0 no longer fails with gcc/gold.

13.8.0 still fails with gcc/gold here, but the same workaround, using bfd via package.env as in comment #16, continues to function.

(I deliberately limit package.env workarounds to specific versions so as to have some idea when there's a fix/workaround in-tree and I can delete my package.env workaround.)
Comment 24 Iade Gesso 2020-02-08 14:48:34 UTC
Still present in =net-libs/nodejs-13.8.0 too...

Comment 25 Matt Whitlock 2020-02-11 04:12:52 UTC
The patch in comment #20 applies cleanly to 13.8.0 and resolves the build error (with Gold).
Comment 26 Matt Whitlock 2020-02-23 19:48:39 UTC
Patch is no longer necessary to build net-libs/nodejs-13.9.0 with Gold.