With binutils (+default-gold) building of nodejs-13.6.0 fails. The default-gold use flag sets ld to point to ld.gold 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: fail Expected Results: success 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 Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-verify-jobs: 1 sync-rsync-verify-metamanifest: yes sync-rsync-verify-max-age: 24 sync-rsync-extra-opts: steam-overlay location: /usr/local/portage/steam-overlay sync-type: git sync-uri: https://github.com/anyc/steam-overlay.git masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" 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" DISTDIR="/usr/portage/distfiles" ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR" 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" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="de_DE.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="de" MAKEOPTS="-j7" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" 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" PORTAGE_TMPDIR="/var/tmp" 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" Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Please attach the entire build log to this bug report.
Created attachment 602774 [details] build log
ld.gold 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.
But yeah, binutils-config --linker considered harmful.
(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 :-)
(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.
Created attachment 602802 [details, diff] nodejs-13.6.0.ebuild-ld.gold.patch Could you please try this patch, please?
Created attachment 602804 [details, diff] nodejs-13.6.0.ebuild-ld.gold.patch Or rather this one.
Comment on attachment 602804 [details, diff] nodejs-13.6.0.ebuild-ld.gold.patch 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/obj.target/tools/v8_gypfiles/libv8_snapshot.a -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/obj.target/cctest/src/node_snapshot_stub.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/src/node_code_cache_stub.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/gtest/gtest-all.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/gtest/gtest_main.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/node_test_fixture.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_aliased_buffer.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_base64.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_base_object_ptr.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_node_postmortem_metadata.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_environment.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_linked_binding.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_per_process.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_platform.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_traced_value.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_util.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_url.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_inspector_socket.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_inspector_socket_server.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/cctest/test/cctest/test_report_util.o /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/libnode.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/deps/histogram/libhistogram.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/deps/uvwasi/libuvwasi.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libplatform.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/deps/llhttp/libllhttp.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/deps/brotli/libbrotli.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/deps/uv/libuv.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/tools/v8_gypfiles/libv8_base_without_compiler.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libbase.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libsampler.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/tools/v8_gypfiles/libv8_compiler.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a /home/jer/portage/net-libs/nodejs-13.6.0/work/node-v13.6.0/out/Release/obj.target/tools/v8_gypfiles/libv8_initializers.a -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: *** [cctest.target.mk:197: /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
Created attachment 602912 [details] net-libs:nodejs-13.6.0:20200108-204921.log.xz (In reply to Jeroen Roovers from comment #8) > Created attachment 602804 [details, diff] [details, diff] > nodejs-13.6.0.ebuild-ld.gold.patch 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.
Ah, but we set this in the ebuild, too: GYP_DEFINES="linux_use_gold_flags=0
And in tools/v8_gypfiles/toolchain.gypi, linux_use_gold_flags==1 is checked for and that sets: 'ldflags': [ '-fuse-ld=gold', ], 8-\
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.
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 https://github.com/FireBurn/PortageStuff/blob/master/env/clango3lto.conf There are other examples if you don't want LTO or O3
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! :-)
(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: /etc/portage/package.env/ldflags.no.gold: # references /etc/portage/env/* # 2020.0123 doesn't like gold #704966 (CCed) ~net-libs/nodejs-13.7.0 pkg.env/ldflags.no.gold /etc/portage/env/pkg.env/ldflags.no.gold: 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.)
(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.
(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.
Still present in =net-libs/nodejs-13.7.0-r1 Iade
Upstream just closed https://github.com/nodejs/node/issues/31520 via https://github.com/nodejs/node/commit/938abd9535663d45a8ec88d5fa6acc0af8e8fd13. 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.
(In reply to Dennis Schridde from comment #20) > https://github.com/nodejs/node/commit/ > 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.
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 ...
(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.)
Still present in =net-libs/nodejs-13.8.0 too... Iade
The patch in comment #20 applies cleanly to 13.8.0 and resolves the build error (with Gold).
Patch is no longer necessary to build net-libs/nodejs-13.9.0 with Gold.