Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 820095 - media-video/ffmpeg-4.4-r1 fails to compile because latomic library not found
Summary: media-video/ffmpeg-4.4-r1 fails to compile because latomic library not found
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: libatomic-linking
  Show dependency tree
 
Reported: 2021-10-25 00:45 UTC by Matt
Modified: 2022-07-20 23:35 UTC (History)
1 user (show)

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


Attachments
build.log file (media-video:ffmpeg-4.4-r1:20211025-004013.log,6.99 KB, text/x-log)
2021-10-25 00:45 UTC, Matt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt 2021-10-25 00:45:21 UTC
Created attachment 746544 [details]
build.log file

It appears that the bugfix for https://bugs.gentoo.org/782811 has broken my ebuild on arm32. After investigation, the core issue is that my compiler (armv7a-cros-linux-gnueabihf-clang) doesn't support -latomic for -march=armv7, because it comes prepackaged with atomics (it successfully compiles when I remove the bugfix).

Note: When reproducing the issue, it fails the "compiler test" created by configure, rather than coming up with a meaningful error, but when you dig down, the -latomic flag is why the compiler test fails.

This seems similar to https://bugs.gentoo.org/667016.

I know nothing of gentoo, but my initial suggestion would be to create a compiler test to determine if the library -latomic exists, and only then enable that flag.

FYI: My setup is relatively different - I'm using chrome OS, and got this error when upgrading ffmpeg from 4.1.3 to 4.4-r1 (https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/3184984). However, based on my understanding, this is not specific to chrome OS (I think it's an issue for any clang arm32 compiler?).

emerge --info results:



!!! CONFIG_PROTECT is empty for '/build/hana/'
Portage 2.3.75 (python 3.6.12-final-0, base, gcc-10.2.0, unavailable, 5.10.46-4rodete4-amd64 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.10.46-4rodete4-amd64-x86_64-Intel-R-_Xeon-R-_Gold_6154_CPU_@_3.00GHz-with-glibc2.2.5
KiB Mem:   196646708 total, 111943444 free
KiB Swap:  178249724 total, 178249724 free
sh bash 4.4_p23-r1
ld GNU ld (GNU Binutils) 2.36.1
ccache version 3.7.7 [disabled]
dev-lang/python:          3.6.12-r5::chromiumos
sys-apps/baselayout:      2.2-r1::chromiumos
sys-devel/autoconf:       2.69::portage-stable
sys-devel/automake:       1.15.1-r2::portage-stable
sys-devel/libtool:        2.4.6-r6::chromiumos
sys-devel/make:           4.2.1-r4::portage-stable
sys-kernel/linux-headers: 4.14-r40::chromiumos (virtual/os-headers)
Repositories:

portage-stable
    location: /mnt/host/source/src/third_party/portage-stable
    masters: eclass-overlay
    priority: -1000

chromiumos
    location: /mnt/host/source/src/third_party/chromiumos-overlay
    masters: portage-stable eclass-overlay
    priority: 0

eclass-overlay
    location: /mnt/host/source/src/third_party/eclass-overlay
    priority: 1

chromeos
    location: /mnt/host/source/src/private-overlays/chromeos-overlay
    masters: portage-stable chromiumos eclass-overlay
    priority: 2

chromeos-partner
    location: /mnt/host/source/src/private-overlays/chromeos-partner-overlay
    masters: portage-stable chromiumos eclass-overlay
    priority: 3

chipset-mt8173
    location: /mnt/host/source/src/overlays/chipset-mt8173
    masters: portage-stable chromiumos eclass-overlay
    priority: 4

chipset-mt8173-private
    location: /mnt/host/source/src/private-overlays/chipset-mt8173-private
    masters: portage-stable chromiumos eclass-overlay
    priority: 5

baseboard-oak
    location: /mnt/host/source/src/overlays/baseboard-oak
    masters: portage-stable chromiumos eclass-overlay chipset-mt8173
    priority: 6

baseboard-oak-private
    location: /mnt/host/source/src/private-overlays/baseboard-oak-private
    masters: portage-stable chromiumos eclass-overlay chipset-mt8173-private
    priority: 7

hana
    location: /mnt/host/source/src/overlays/overlay-hana
    masters: portage-stable chromiumos eclass-overlay baseboard-oak
    priority: 8

cheets-private
    location: /mnt/host/source/src/private-overlays/project-cheets-private
    masters: portage-stable chromiumos eclass-overlay
    priority: 9

hana-private
    location: /mnt/host/source/src/private-overlays/overlay-hana-private
    masters: portage-stable chromiumos eclass-overlay baseboard-oak-private cheets-private
    priority: 10

ACCEPT_KEYWORDS="arm"
ACCEPT_LICENSE="* -@EULA @CHROMEOS"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS=" -Os -pipe  -march=armv8-a+crc -mtune=cortex-a57 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections"
CHOST="armv7a-cros-linux-gnueabihf"
CONFIG_PROTECT=""
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"
CXXFLAGS=" -Os -pipe  -march=armv8-a+crc -mtune=cortex-a57 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -g -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--oneshot --autounmask-backtrack=y --autounmask=n"
FCFLAGS="-O2"
FEATURES="allow-missing-manifests assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg clean-logs config-protect-if-modified distlocks fixlafiles force-mirror ipc-sandbox multilib-strict network-sandbox nodoc noinfo noman parallel-fetch parallel-install protect-owned sandbox sfperms splitdebug unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2"
GENTOO_MIRRORS="https://commondatastorage.googleapis.com/chromeos-localmirror https://commondatastorage.googleapis.com/chromeos-mirror/gentoo"
INSTALL_MASK="   /usr/lib*/*.la   /etc/init.d /etc/conf.d   /etc/logrotate.d   /etc/sandbox.d   /usr/share/bash-completion   /usr/share/locale "
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O2 -Wl,--as-needed  -Wl,--gc-sections -Wl,--icf=all"
MAKEOPTS="-j72"
PKGDIR="/build/hana/packages/"
PORTAGE_BINHOST=" gs://chromeos-prebuilt/board/arm-generic/postsubmit-R97-14291.0.0-25292-8833008242395591217/packages gs://chromeos-prebuilt/board/hana/postsubmit-R97-14291.0.0-55614-8833007094282461057/packages"
PORTAGE_BUNZIP2_COMMAND="pbunzip2 --ignore-trailing-garbage=1"
PORTAGE_BZIP2_COMMAND="pbzip2"
PORTAGE_CONFIGROOT="/build/hana/"
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="/build/hana/tmp/"
USE="acpi acpi_ac android-container-pi arc arc-camera3 arc-launched-32bit-abi arc_adb_sideloading arc_first_release_n arcpp arm bindist bluetooth bt_deprecated_tools bzip2 cellular cheets cheets_user_64 compupdates containers cros-debug cros_arm64 cros_i686 cros_p2p crosfonts crosvm-gpu crypt cups cxx device_tree diagnostics direncryption disable_cros_video_decoder disable_instant_tethering dlc dlc_test dlp dns-proxy dri drm_atomic eclog esdfs evdev_gestures featured frecon fwupd hana hardfp has-kernelnext iconv iioservice ime internal ipv6 kerberos_daemon kernel-4_19 kvm_host lacros_rootfs legacy_firmware_ui mbim memd midis missive mist ml_service mmc modules mosys_eventlog mudflap native_gpu_memory_buffers ncurses neon nptl nptlonly ondevice_speech opengles pam pd_sync perfetto pinweaver postscript racc readline resourced scanner secanomalyd smartdim smbprovider ssl sysfs system_proxy touchview tpm tpm_slb9645 transparent_hugepage udev unicode usb usb_bouncer usbguard v4l2_codec vlan vulkan watchdog xattr xkbcommon xorg zlib" 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" BOARD_USE="hana" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="synaptics pixart g2touch cmt evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" LINUX_FIRMWARE="mt8173-vpu cros-pd rt2870 rtl8153" OFFICE_IMPLEMENTATION="libreoffice" OZONE_PLATFORM="gbm headless default_gbm" OZONE_PLATFORM_DEFAULT="gbm" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python3_6" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="mediatek powervr" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, ENV_UNSET, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

media-video/ffmpeg-4.1.3::portage-stable was built with the following:
USE="bzip2 encode gpl hardcoded-tables iconv libdrm network openssl postproc threads vpx zlib -X -alsa (-altivec) (-amr) -amrenc -appkit -bluray -bs2b -cdio -chromaprint -chromium -codec2 -cpudetection -debug -doc -fdk -flite -fontconfig -frei0r -fribidi -gcrypt -gme -gmp -gnutls -gsm -iec61883 (-ieee1394) -jack -jpeg2k -kvazaar -ladspa -libaom -libass -libcaca -libilbc -libressl -librtmp -libsoxr -libv4l -libxml2 -lv2 -lzma -mipsdspr1 -mipsdspr2 -mipsfpu -mmal -modplug -mp3 -openal -opencl -opengl -openh264 -opus -oss -pic -pulseaudio -rubberband -samba -sdl -snappy -speex -srt -ssh -static-libs -svg -test -theora -truetype -twolame -v4l -vaapi -vdpau -vorbis -wavpack -webp (-x264) -x265 -xcb -xvid -zeromq -zimg (-zvbi)" ABI_ARM="(-32) (-64)" CPU_FLAGS_ARM="thumb thumb2 v6 vfp vfpv3 -neon -v8" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher" VIDEO_CARDS="(-nvidia)"
FEATURES="fixlafiles protect-owned parallel-fetch nodoc assume-digests network-sandbox noinfo unmerge-orphans usersync clean-logs usersandbox ipc-sandbox userpriv sandbox buildpkg noman allow-missing-manifests binpkg-docompress distlocks binpkg-dostrip parallel-install sfperms xattr force-mirror unmerge-logs multilib-strict binpkg-logs config-protect-if-modified splitdebug userfetch"
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-10-25 00:52:00 UTC
Oh, this is fun. We can workaround this with test-flags-CC for now, but I think we might want to add something especially for this given how common it is to either flag-o-matic or toolchain-funcs (like append-lfs-flags).

See: https://devmanual.gentoo.org/eclass-reference/flag-o-matic.eclass/index.html.

Thanks for explaining how your environment is different and such. Quite happy to poke at things as long as I know what's weird and what isn't.
Comment 2 Larry the Git Cow gentoo-dev 2021-10-25 01:06:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0a2de862f66a5914234dd7561bc8dc63eb7e9ca

commit a0a2de862f66a5914234dd7561bc8dc63eb7e9ca
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-10-25 01:05:47 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-10-25 01:05:59 +0000

    media-video/ffmpeg: only add -latomic when supported by compiler/linker
    
    Closes: https://bugs.gentoo.org/820095
    Signed-off-by: Sam James <sam@gentoo.org>

 media-video/ffmpeg/ffmpeg-4.4-r1.ebuild |  2 +-
 media-video/ffmpeg/ffmpeg-9999.ebuild   | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
Comment 3 Larry the Git Cow gentoo-dev 2022-07-20 23:35:20 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29cf769f4de6550851e74829c2011c2e23554cc7

commit 29cf769f4de6550851e74829c2011c2e23554cc7
Author:     matoro <matoro@users.noreply.github.com>
AuthorDate: 2022-07-10 22:41:17 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-07-20 23:35:14 +0000

    flag-o-matic.eclass: implement append-atomic-flags
    
    My take on implementing bug 820101 as conservatively as possible. This
    will append -latomic only when absolutely necessary (even though it's
    probably not required to be that conservative due to our use of
    --as-needed).
    
    This will take flags into account when testing as well. For example, if
    you compile with -march=i386, this would require linking libatomic even
    if the same toolchain with a higher -march level would not require it.
    So rebuilding the same package with the same flags may change whether
    -latomic is linked at build time if the CFLAGS change. Another instance
    might be switching from GCC to clang - the former requires explicitly
    linking -latomic, while the latter does not even HAVE libatomic (see bug
    820095) as all atomic intrinsics are built-in internally. This function
    would safely detect this and not append -latomic.
    
    There is an optional parameter [bytes]. You can use this if you want to
    be specific about what size atomic support is required. For example,
    there are several platforms like MIPS where the 32-bit version has 1-,
    2-, and 4-byte atomics builtin but requires libatomic linkage for 8-byte
    atomics. If your program only requires, say, 4-byte atomics, you can use
    append-atomic-flags 4 and this will then not attempt to link libatomic
    on 32-bit MIPS.
    
    I tested using this to solve bug 688574 on 32-bit SPARC.
    
    Bug: https://bugs.gentoo.org/688574
    Bug: https://bugs.gentoo.org/820095
    Closes: https://bugs.gentoo.org/820101
    Closes: https://github.com/gentoo/gentoo/pull/26334
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/flag-o-matic.eclass | 145 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)