Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 782811 - media-video/ffmpeg-4.4 fails to link to libatomic on ARM
Summary: media-video/ffmpeg-4.4 fails to link to libatomic on ARM
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM Linux
: Normal normal (vote)
Assignee: media-video herd
URL:
Whiteboard:
Keywords:
Depends on: 790590
Blocks: libatomic-linking
  Show dependency tree
 
Reported: 2021-04-14 09:31 UTC by Gordon Bos
Modified: 2021-05-30 10:13 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gordon Bos 2021-04-14 09:31:09 UTC
Building media-video/ffmpeg-4.4 on ARM ends with the following error message:

```
armv5tel-softfloat-linux-gnueabi-gcc -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,-O1 -Wl,--as-needed  -march=armv5te -Wl,--as-needed -Wl,-z,noexecstack -Wl,--warn-common -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample   -o ffmpeg_g fftools/ffmpeg_opt.o fftools/ffmpeg_filter.o fftools/ffmpeg_hw.o fftools/cmdutils.o fftools/ffmpeg.o  -lavdevice -lavfilter -lavformat -lavcodec -lavresample -lpostproc -lswresample -lswscale -lavutil  -lm -pthread -lm -lm -lbz2 -lz -lgnutls -pthread -lm -ldav1d -lz -lm -lm -lm -lm -pthread -lm  
/usr/libexec/gcc/armv5tel-softfloat-linux-gnueabi/ld: libavformat/libavformat.so: undefined reference to `__atomic_fetch_sub_8'
/usr/libexec/gcc/armv5tel-softfloat-linux-gnueabi/ld: libavformat/libavformat.so: undefined reference to `__atomic_store_8'
/usr/libexec/gcc/armv5tel-softfloat-linux-gnueabi/ld: libavformat/libavformat.so: undefined reference to `__atomic_load_8'
/usr/libexec/gcc/armv5tel-softfloat-linux-gnueabi/ld: libavformat/libavformat.so: undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
```


Reproducible: Always




Expanding the link command with `-latomic` (needs to be done several times if manually executed) allows the ebuild to finish successfully.

Suggested fix: pass `--extra-ldflags="-latomic"` to the `configure` command.
Comment 1 Gordon Bos 2021-04-14 11:35:48 UTC
Testing the (external) suggested fix, it appears to place libatomic before the objects and the build still fails. It does work with:

`--extra-libs=-latomic`
Comment 2 Sam James archtester gentoo-dev Security 2021-05-09 07:22:32 UTC
In general, the full build.log and emerge --info helps us debug this stuff.

Where was the fix suggested?
Comment 3 Gordon Bos 2021-05-09 11:21:27 UTC
Ooff, a month ago... I think it was on StackOverflow. I also found multiple other issues referencing libatomic link failures on ARM and it was hinted that if you use an older version of GCC the failing jobs will complete correctly.

As far as I understand the issue is restricted to ARM only and with GCC >= 10.2
Comment 4 Larry the Git Cow gentoo-dev 2021-05-30 10:13:20 UTC
The bug has been closed via the following commit(s):

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

commit 31e3918f3db9351651fd8d4b787097c08a0ccafc
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-05-30 10:12:28 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-05-30 10:12:36 +0000

    media-video/ffmpeg: fix libatomic on arm/ppc
    
    Closes: https://bugs.gentoo.org/790590
    Closes: https://bugs.gentoo.org/782811
    Signed-off-by: Sam James <sam@gentoo.org>

 media-video/ffmpeg/ffmpeg-4.4.ebuild | 8 ++++++++
 1 file changed, 8 insertions(+)