too long lines were shrinked: clang++ -o /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/out/Release/embedtest -pthread -rdynamic -m64 -Wl,-z,noexecstack -Wl,--whole-archive /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a -Wl,--no-whole-archive -Wl,- clang++ -o /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/out/Release/cctest -pthread -rdynamic -m64 -Wl,-z,noexecstack -Wl,--whole-archive /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a -Wl,--no-whole-archive -Wl,-z,r clang++ -o /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/out/Release/node_mksnapshot -pthread -rdynamic -m64 -Wl,-z,noexecstack -Wl,--whole-archive /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a -Wl,--no-whole-archive /usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/out/Release/obj.target/libnode/src/node.o: in function `node::RegisterSignalHandler(int, void (*)(int, siginfo_t*, void*), bool)': node.cc:(.text+0x1174): undefined reference to `__atomic_is_lock_free' /usr/bin/x86_64-pc-linux-gnu-ld: /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/out/Release/obj.target/libnode/src/node.o: in function `node::RegisterSignalHandler(int, void (*)(int, siginfo_t*, void*), bool)': node.cc:(.text+0x1174): undefined reference to `__atomic_is_lock_free' ------------------------------------------------------------------- This is an unstable amd64 chroot image at a tinderbox (==build bot) name: 17.1-j4-20220915-203738 ------------------------------------------------------------------- gcc-config -l: [1] x86_64-pc-linux-gnu-12.2.0 * clang/llvm (if any): clang version 15.0.0 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/15/bin /usr/lib/llvm/15 15.0.0 Python 3.10.7 Available Ruby profiles: (none found) Available Rust versions: [1] rust-bin-1.63.0 * The following VMs are available for generation-2: 1) Eclipse Temurin JDK 11.0.16.1_p1 [openjdk-bin-11] *) Eclipse Temurin JDK 17.0.4.1_p1 [openjdk-bin-17] 3) Eclipse Temurin JDK 8.345_p01 [openjdk-bin-8] Available Java Virtual Machines: [1] openjdk-bin-8 [2] openjdk-bin-11 [3] openjdk-bin-17 system-vm The Glorious Glasgow Haskell Compilation System, version 9.0.2 php cli (if any): [1] php8.1 * GNU Make 4.3.90 HEAD of ::gentoo commit 27e349751fc08f79c6f96f84652edf0c93ba9a1f Author: Repository mirror & CI <repomirrorci@gentoo.org> Date: Sat Sep 17 14:46:52 2022 +0000 2022-09-17 14:46:52 UTC emerge -qpvO net-libs/nodejs [ebuild N ] net-libs/nodejs-18.9.0 USE="icu npm snapshot ssl system-icu system-ssl -debug -doc -inspector -lto (-pax-kernel) -systemtap -test" CPU_FLAGS_X86="sse2"
Created attachment 808591 [details] emerge-info.txt
Created attachment 808594 [details] clang.tar.bz2
Created attachment 808597 [details] emerge-history.txt
Created attachment 808600 [details] environment
Created attachment 808603 [details] etc.portage.tar.bz2
Created attachment 808606 [details] net-libs:nodejs-18.9.0:20220917-160936.log.bz2
Created attachment 808609 [details] temp.tar.bz2
This might jsut be a bug with the clang hook we're using, not sure.
It compiles and runs just fine here with the old ebuild and the old patch, without GCC installed. Please check build log attached. Output of emerge --info nodejs: Portage 3.0.36 (python 3.10.7-final-0, default/linux/amd64/17.0/musl/hardened, [unavailable], musl-1.2.3-r3, 5.19.6-gentoo x86_64) ================================================================= System Settings ================================================================= System uname: Linux-5.19.6-gentoo-x86_64-AMD_Ryzen_7_3700X_8-Core_Processor-with-libc KiB Mem: 32799740 total, 28585340 free KiB Swap: 8374268 total, 8374268 free Timestamp of repository gentoo: Sun, 18 Sep 2022 16:31:50 +0000 Head commit of repository gentoo: be85075224304466cbf91e8e2aa61a2222f00911 Head commit of repository clang-musl: 345ce723c511475f6daf319be51b8545d9a8507a Timestamp of repository guru: Sat, 17 Sep 2022 12:01:56 +0000 Head commit of repository guru: 47ad165ee0560c7ddc3c88f969744e20647d15c4 Timestamp of repository musl: Mon, 12 Sep 2022 19:25:25 +0000 Head commit of repository musl: e6dd47112d070c323e0d399bb67845c4d3ae2bac Head commit of repository librewolf: 964d58b3bc9fba0174051ae1c4c42023528fd38a sh bash 5.1_p16-r2 ld LLD 15.0.0 (compatible with GNU linkers) app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r2::gentoo dev-lang/perl: 5.36.0::gentoo dev-lang/python: 3.10.7::gentoo dev-lang/rust: 1.63.0::clang-musl dev-util/cmake: 3.24.2::gentoo dev-util/meson: 0.63.2-r1::gentoo sys-apps/baselayout: 2.8-r3::gentoo sys-apps/openrc: 0.45.2::gentoo sys-apps/sandbox: 2.29::gentoo sys-devel/autoconf: 2.13-r2::gentoo, 2.71-r2::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/clang: 15.0.0-r1::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/lld: 15.0.0::gentoo sys-devel/llvm: 15.0.0::clang-musl sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.19::gentoo (virtual/os-headers) sys-libs/musl: 1.2.3-r3::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo priority: -1000 sync-git-verify-commit-signature: true clang-musl location: /var/db/repos/clang-musl sync-type: git sync-uri: https://github.com/clang-musl-overlay/clang-musl-overlay.git masters: gentoo guru location: /var/db/repos/guru sync-type: git sync-uri: https://github.com/gentoo-mirror/guru.git masters: gentoo local location: /var/db/repos/local masters: gentoo musl location: /var/db/repos/musl sync-type: git sync-uri: https://github.com/gentoo-mirror/musl.git masters: gentoo librewolf location: /var/db/repos/librewolf sync-type: git sync-uri: https://gitlab.com/librewolf-community/browser/gentoo.git masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE" AR="llvm-ar" CBUILD="x86_64-gentoo-linux-musl" CC="clang-15" CFLAGS="-march=native -O3 -pipe -mllvm -polly -flto=thin" CHOST="x86_64-gentoo-linux-musl" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CPP="x86_64-gentoo-linux-musl-clang-cpp" CXX="clang++-15" CXXFLAGS="-march=native -O3 -pipe -mllvm -polly -flto=thin" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH 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 -O3 -pipe -mllvm -polly" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=native -O3 -pipe -mllvm -polly" GENTOO_MIRRORS="http://distfiles.gentoo.org" INSTALL_MASK="charset.alias /usr/share/locale/locale.alias" LANG="de_DE.UTF-8" LDFLAGS="-Wl,-O2 -Wl,--as-needed" MAKEOPTS="-j7" NM="llvm-nm" PKGDIR="/var/cache/binpkgs" 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="/tmp" RANLIB="llvm-ranlib" RUSTFLAGS="-C opt-level=3 -C codegen-units=8 -C target-cpu=native -C llvm-args=--polly" SHELL="/bin/bash" USE="aac acl aes alsa amd64 apparmor avx avx2 bash-completion bzip2 cdda clang compiler-rt cpu-flags-x86-rdrand crypt custom-cflags default-compiler-rt default-libcxx default-lld dvd elogind f16c ffmpeg flac fma3 fontconfig fontforge gdk-pixbuf gegl gif gstreamer gtk3 haptic hardened headless-awt iconv ipv6 jpeg jpeg2k jpg kerberos libass libcxx libcxxabi libglvnd libtirpc lld llvm-libunwind lm-sensors lto mmx mmxext mp3 mpeg ncurses nftables nls nptl ogg opengl openmp opus pam pango pclmul pcre pgo pie pipewire pipewire-alsa png polly popcnt pulseaudio rdrand readline screencast seccomp sha split-usr sse sse2 sse3 sse4_1 sse4_2 sse4a ssl ssp ssse3 svg system-zlib theora threads truetype udev unicode vaapi vcd vdpau verify-sig vorbis vpx vtv vulkan wayland x264 x265 xattr xtpax zink zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en de eo pt-BR de-DE" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86" LUA_SINGLE_TARGET="lua5-3 luajit" LUA_TARGETS="lua5-3 luajit" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby31" USERLAND="GNU" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, ARFLAGS, AS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS ================================================================= Package Settings ================================================================= net-libs/nodejs-18.9.0::local was built with the following: USE="icu lto npm snapshot ssl system-icu system-ssl -debug -doc -inspector -pax-kernel -systemtap -test" CPU_FLAGS_X86="sse2" CFLAGS="-march=native -O3 -pipe -mllvm -polly" CXXFLAGS="-march=native -O3 -pipe -mllvm -polly" FEATURES="qa-unresolved-soname-deps pid-sandbox keeptemp merge-sync parallel-fetch sandbox binpkg-logs unknown-features-warn userpriv assume-digests usersync usersandbox network-sandbox binpkg-multi-instance binpkg-dostrip binpkg-docompress unmerge-logs xattr buildpkg-live strict sfperms preserve-libs distlocks config-protect-if-modified userfetch ebuild-locks ipc-sandbox protect-owned unmerge-orphans fixlafiles news"
Created attachment 812584 [details] Successful build without GCC, with Clang 15 and LLVM 15, and Musl Successful build without GCC, with Clang 15 and LLVM 15, and Musl
Like asdfg, I can't reproduce this issue. A custom ebuild that drops the GCC dependency and flag-editing and re-adds the "don't link atomic" patch works fine, even if GCC is unmerged.
Created attachment 812587 [details] emerge --info output of successful non-gcc build
Ah! The difference is, I think, USE=system-ssl. The only code needing it is there: ``` # grep -rsin "atomic_is_lock_free" /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/ /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/deps/openssl/openssl/crypto/threads_pthread.c:23: * __ATOMIC_ACQ_REL but which expects only one parameter for __atomic_is_lock_free() /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/deps/openssl/openssl/crypto/threads_pthread.c:24: * rather than two which has signature __atomic_is_lock_free(sizeof(_Atomic(T))). /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/deps/openssl/openssl/crypto/threads_pthread.c:25: * All of this makes impossible to use __atomic_is_lock_free here. /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/deps/openssl/openssl/crypto/threads_pthread.c:204: if (__atomic_is_lock_free(sizeof(*val), val)) { /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/deps/openssl/openssl/crypto/threads_pthread.c:231: if (__atomic_is_lock_free(sizeof(*val), val)) { /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0/deps/openssl/openssl/crypto/threads_pthread.c:256: if (__atomic_is_lock_free(sizeof(*val), val)) { ```
(In reply to Sam James from comment #13) > Ah! The difference is, I think, USE=system-ssl. > > The only code needing it is there: But wait, toralf has USE="ssl system-ssl" and the references are on another file anyway when compiled. Can someone saying that it works without GCC try the following, please? /tmp/atomic.cxx: ``` #include <stdio.h> #include <stdatomic.h> _Atomic struct A { int a[100]; } a; _Atomic struct B { int x, y; } b; int main(void) { printf("_Atomic struct A is lock free? %s\n", atomic_is_lock_free(&a) ? "true" : "false"); printf("_Atomic struct B is lock free? %s\n", atomic_is_lock_free(&b) ? "true" : "false"); } ``` ``` clang-musl /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0 # clang++ /tmp/atomic.cxx ld.lld: error: undefined symbol: __atomic_is_lock_free >>> referenced by atomic.cxx >>> /tmp/atomic-cf0ef8.o:(main) clang-15: error: linker command failed with exit code 1 (use -v to see invocation) clang-musl /var/tmp/portage/net-libs/nodejs-18.9.0/work/node-v18.9.0 # clang++ /tmp/atomic.cxx -latomic ld.lld: error: unable to find library -latomic clang-15: error: linker command failed with exit code 1 (use -v to see invocation) ``` I can reproduce this in a freshly grabbed stage3 from https://mirror.bytemark.co.uk/gentoo/releases/amd64/autobuilds/current-stage3-amd64-musl-clang/stage3-amd64-musl-clang-20220821T170533Z.tar.xz.
I wonder if it's relevant that both of the folks who don't need gcc are using ::clang-musl (by the way, I really wish people would upstream stuff to ::gentoo!)
I suspect there's something which causes Clang not to emit this in some cases (hence not needing -latomic) but I have no idea what.
> Can someone saying that it works without GCC try the following, please? $ clang++ atomic.cxx ld.lld: error: undefined symbol: __atomic_is_lock_free >>> referenced by atomic.cxx >>> /tmp/atomic-cedaf3.o:(main) clang-14: error: linker command failed with exit code 1 (use -v to see invocation) Asks for the __atomic_is_lock_free function, as does Gentoo's clang profile. > I suspect there's something which causes Clang not to emit this in some cases (hence not needing -latomic) but I have no idea what. FWIW, both me and asdfg have -O3 and LTO enabled; maybe it's optimized away?
(In reply to Carlos from comment #17) > FWIW, both me and asdfg have -O3 and LTO enabled; maybe it's optimized away? Yeah, that was my guess. In which case, I don't think we can do anything. There's no way to guarantee it doesn't need it.
Hey all, I have new nodejs bumps I'm working on, but it looks like this bug still hasn't been resolved. I guess I'm not sure how to proceed on this bug. Do we need gcc as an rdepend, or can I go back to using flag-o-matic to determine when to use -latomic?
We can't do anything where the symbols literally don't exist.