While compiling openssl-3.0.8 via crossdev I kept hitting the "ld libcrypto.so: undefined reference to `__atomic_load_8" I have found a workaround of adding `-latomic`to get around it however, I'm not sure this is the best solution so would like someone else to confirm it. Reproducible: Always Steps to Reproduce: 1. crossdev -s4 i486-gentoo-linux-musl 2. PORTAGE_CONFIGROOT="/usr/i486-gentoo-linux-musl" eselect profile set default/linux/x86/17.0/musl 3.emerge -va dev-libs/openssl Actual Results: /usr/libexec/gcc/i486-gentoo-linux-musl/ld: ./libcrypto.so: undefined reference to `__atomic_load_8' /usr/libexec/gcc/i486-gentoo-linux-musl/ld: ./libcrypto.so: undefined reference to `__atomic_fetch_or_8' /usr/libexec/gcc/i486-gentoo-linux-musl/ld: ./libcrypto.so: undefined reference to `__atomic_is_lock_free' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:19957: apps/openssl] Error 1 make[1]: Leaving directory '/usr/i486-gentoo-linux-musl/tmp/portage/dev-libs/openssl-3.0.8/work/openssl-3.0.8-abi_x86_32.x86' make: *** [Makefile:2242: build_sw] Error 2 I have disabled all the changes from 23.0 testing and removed lto from the host cflags for this bug report but I have included the environment file for you to confirm it's not that causing the issue. # emerge --info Portage 3.0.44 (python 3.10.10-final-0, default/linux/amd64/23.0/desktop, gcc-12, glibc-2.36-r7, 6.1.11-gentoo-dist x86_64) ================================================================= System uname: Linux-6.1.11-gentoo-dist-x86_64-Intel-R-_Core-TM-_i7-6700K_CPU_@_4.00GHz-with-glibc2.36 KiB Mem: 16347936 total, 7261940 free KiB Swap: 25169912 total, 25169912 free Head commit of repository gentoo: e26eaf1ecb3069d31dcf6de494872dd2ffd53ad2 Timestamp of repository menelkir: Mon, 13 Feb 2023 14:17:07 +0000 Head commit of repository menelkir: d3622fd6acca545736fa31db82d136860e250c92 Timestamp of repository raiagent: Fri, 17 Feb 2023 03:31:58 +0000 Head commit of repository raiagent: 7eca517f59dba57c737ee48170cb2cc8dccfc7a8 Timestamp of repository steam-overlay: Tue, 07 Feb 2023 14:47:33 +0000 Head commit of repository steam-overlay: 8121a25bc99056e35ab2dd7924bb01ad8f80df8d sh bash 5.2_p15-r2 ld GNU ld (Gentoo 2.39 p5) 2.39.0 app-misc/pax-utils: 1.3.7::gentoo app-shells/bash: 5.2_p15-r2::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.36.0-r2::gentoo dev-lang/python: 3.10.10::gentoo, 3.11.2::gentoo dev-lang/rust: 1.67.1::gentoo dev-util/cmake: 3.25.2::gentoo dev-util/meson: 1.0.0::gentoo sys-apps/baselayout: 2.13-r1::gentoo sys-apps/openrc: 0.46::gentoo sys-apps/sandbox: 2.30-r1::gentoo sys-devel/autoconf: 2.13-r7::gentoo, 2.71-r5::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.39-r4::gentoo, 2.40-r1::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/gcc: 11.3.1_p20221209::gentoo, 12.2.1_p20230121-r1::gentoo sys-devel/gcc-config: 2.10::gentoo sys-devel/libtool: 2.4.7-r1::gentoo sys-devel/llvm: 14.0.6-r2::gentoo, 15.0.7::gentoo sys-devel/make: 4.4::gentoo sys-kernel/linux-headers: 6.1::gentoo (virtual/os-headers) sys-libs/glibc: 2.36-r7::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: https://github.com/gentoo/gentoo.git sync-user: portage:portage priority: -1000 volatile: True local location: /var/db/repos/local masters: gentoo volatile: True menelkir location: /var/db/repos/menelkir sync-type: git sync-uri: https://github.com/gentoo-mirror/menelkir.git masters: gentoo volatile: True raiagent location: /var/db/repos/raiagent sync-type: git sync-uri: https://github.com/gentoo-mirror/raiagent.git masters: gentoo volatile: True steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/steam-overlay.git masters: gentoo volatile: True ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=native -fuse-linker-plugin -falign-functions=32" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /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="-O2 -pipe -march=native -fuse-linker-plugin -falign-functions=32" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME" FCFLAGS="-O2 -pipe -march=native -fuse-linker-plugin -falign-functions=32" 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 multilib-strict 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="-O2 -pipe -march=native -fuse-linker-plugin -falign-functions=32" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="C.UTF8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LEX="flex" LINGUAS="en en_GB" MAKEOPTS="-j8" 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="/var/tmp" SHELL="/bin/bash" USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr crypt dbus dist-kernel dri dts dvd dvdr elogind encode exif flac fortran gdbm gif gpm graphite gtk gui iconv icu ipv6 jpeg lcms libglvnd libnotify libtirpc logrotate lto lzma mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf pgo png policykit ppds pulseaudio readline sdl seccomp sound spell ssl startup-notification svg test-rust tiff tkip truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xft xml xv xvid zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2021" 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="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" 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-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" QEMU_SOFTMMU_TARGETS="x86_64 i386 sparc64 aarch64 ppc64" QEMU_USER_TARGETS="sparc64 arm aarch64 mips mips64 mipsel" RUBY_TARGETS="ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="nvidia intel" 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, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Created attachment 852768 [details] environment
Created attachment 852770 [details] build log
workaround of adding `-latomic` seems to break a few other programs such as openssh and wpa_supplicant. I don't see a point of including those build logs as it's not the root cause but can rebuild if it helps.
This happens when building natively on 32-bit ARM as well. The correct fix should be to specify machine "latomic" instead of "generic32" when running the Configure script.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abcf1c332125b850a893019e63444c2b93d965bd commit abcf1c332125b850a893019e63444c2b93d965bd Author: Sam James <sam@gentoo.org> AuthorDate: 2023-06-27 18:02:33 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-06-27 18:02:33 +0000 dev-libs/openssl: pass -latomic when needed (e.g. i486/old arm) Closes: https://bugs.gentoo.org/895308 Signed-off-by: Sam James <sam@gentoo.org> dev-libs/openssl/openssl-3.0.9-r1.ebuild | 5 +++++ dev-libs/openssl/openssl-3.1.1-r1.ebuild | 5 +++++ 2 files changed, 10 insertions(+)