Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 802162

Summary: media-video/pipewire-0.3.31 Missing atomic symbol when building pipewire with jack support using clang/lld
Product: Gentoo Linux Reporter: GoGoOtaku
Component: Current packagesAssignee: Sam James <sam>
Status: UNCONFIRMED ---    
Severity: minor CC: asturm, ionen, leio, mscardovi
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 721344    
Attachments: Build Log

Description GoGoOtaku 2021-07-14 14:10:02 UTC
media-video/pipewire with jack support fails building with Clang and LLD with error:
ld.lld: error: undefined symbol: __atomic_store_8
>>> referenced by ld-temp.o
>>>               lto.tmp:(jack_set_sync_timeout)

This error existed since at least version 0.3.28.
It is easily fixable by having an environment with:
LDFLAGS="${LDFLAGS} -latomic"

I am not sure if lld should use default libraries, this should be added in the ebuild, or if this is an upstream issue.
Building with GCC/Gold works fine.

Reproducible: Always

Steps to Reproduce:
1. Set compiler to clang/clang++ and linker to ld.lld
2. USE=jack emerge media-video/pipewire
3. :(
Actual Results:  
ld.lld: error: undefined symbol: __atomic_store_8
>>> referenced by ld-temp.o
>>>               lto.tmp:(jack_set_sync_timeout)

Expected Results:  
-latomic Should not have to be added manually

Portage 3.0.20 (python 3.9.6-final-0, default/linux/amd64/17.1, gcc-11.1.0, glibc-2.33-r1, 5.12.13-gentoo-x86_64 x86_64)
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-O2 -pipe -march=bdver2 -mtune=bdver2 -O3 -pipe -flto"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.8/conf"
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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXX="clang++"
CXXFLAGS="-O2 -pipe -march=bdver2 -mtune=bdver2 -O3 -pipe -flto"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--ask"
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="-O2 -pipe -march=bdver2 -mtune=bdver2 -O3 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance 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=bdver2 -mtune=bdver2 -O3 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-ld=lld -Wl,-O3 -Wl,--as-needed"
MAKEOPTS="-j4"
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"
USE="X acl alsa amd64 apparmor bash-completion bzip2 cjk clang cli crypt cxx dbus dga djvu dri drm egl elogind encode expat fbcon ffmpeg fftw flac fluidsynth fontconfig fortran gbm gdbm gif gimp git gphoto2 gpm graphviz gstreamer gtk ibus iconv icu ipv6 jack jbig joystick jpeg jpeg2k lapack latex lcms libcaca libglvnd librtmp libsamplerate libtirpc lm_sensors lzma mad man midi mikmod modplug mp3 mtp multilib nautilus ncurses nls nptl ogg openal opencl openexr opengl openmp opus pam pcre perl png postscript pulseaudio python qt5 raw readline rtmp samba sdl seccomp sf2 sftp spell split-usr sqlite ssl svg tcpd threads tiff timidity truetype udev unicode usb vaapi vorbis vulkan wav wayland webp x264 x265 xattr xine xinerama xml xpm xv zlib zsh-completion" ABI_X86="64 32" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 f16c fma3 fma4 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 xop" 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 wacom" KERNEL="linux" L10N="de en en-GB en-US ja" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AArch64 AMDGPU ARM AVR WebAssembly" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9 python3_8" RUBY_TARGETS="ruby26 ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" 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:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 1 GoGoOtaku 2021-07-14 14:19:20 UTC
A friend mentioned that compiler-rt might be enabled but this is not the case. These are my clang uses:

+abi_x86_32
-debug
-default-compiler-rt
-default-libcxx
-default-lld
-doc
-llvm-libunwind
+llvm_targets_AArch64
+llvm_targets_AMDGPU
-llvm_targets_ARC
+llvm_targets_ARM
+llvm_targets_AVR
+llvm_targets_BPF
-llvm_targets_CSKY
-llvm_targets_Hexagon
-llvm_targets_Lanai
-llvm_targets_MSP430
-llvm_targets_Mips
+llvm_targets_NVPTX
-llvm_targets_PowerPC
-llvm_targets_RISCV
-llvm_targets_Sparc
-llvm_targets_SystemZ
-llvm_targets_VE
+llvm_targets_WebAssembly
-llvm_targets_XCore
-python_single_target_python3_10
-python_single_target_python3_8
+python_single_target_python3_9
+static-analyzer
-test
+xml
Comment 2 Niklāvs Koļesņikovs 2021-07-15 20:48:39 UTC
Without the full build log this is just a guess but it likely fails the -m32 build with some Clang 32 bit runtime function requiring libatomic, which, I suspect, makes it a Clang not PipeWire issue. For what it's worth GCC/lld combo works just fine, so I doubt the linker itself is relevant here.
Comment 3 GoGoOtaku 2021-07-16 13:02:27 UTC
Created attachment 724321 [details]
Build Log
Comment 4 GoGoOtaku 2021-07-16 13:03:50 UTC
(In reply to Niklāvs Koļesņikovs from comment #2)
> Without the full build log this is just a guess but it likely fails the -m32
> build with some Clang 32 bit runtime function requiring libatomic, which, I
> suspect, makes it a Clang not PipeWire issue. For what it's worth GCC/lld
> combo works just fine, so I doubt the linker itself is relevant here.

I attached the build log and also checked if it would compile with `ABI_X86 -32` which it did so you are probably right.
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2021-07-23 22:55:24 UTC
Please report upstream, similar to https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/299.