Opened 3 years ago

Closed 2 years ago

#9275 closed defect (fixed)

Missing -latomic for arches without GCC builtins atomic

Reported by: marillat Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

atomic support has been added in libavformat/fifo.c since 4.4 but GCC doesn't support atomic builtin for all architecture and fallback to link with libatomic.
The problem is that ffmpeg assume that all architectures are using GCC builtins and the build fail with 'undefined reference to' errors.

The solution is to link libavformat with libatomic.

Here is the GCC documentation about atomic
https://gcc.gnu.org/wiki/Atomic

Under Debian unstable I see two architectures who uses libatomic armel and powerpc. Here is the output for the powerpc build.

/usr/bin/ld: libavformat/fifo.o: in function `fifo_init':
./libavformat/fifo.c:519: undefined reference to `__atomic_store_8'
/usr/bin/ld: libavformat/fifo.o: in function `fifo_write_trailer':
./libavformat/fifo.c:624: undefined reference to `__atomic_fetch_add_8'
/usr/bin/ld: ./libavformat/fifo.c:631: undefined reference to `__atomic_store_8'
/usr/bin/ld: libavformat/fifo.o: in function `fifo_thread_write_packet':
./libavformat/fifo.c:188: undefined reference to `__atomic_fetch_sub_8'
/usr/bin/ld: libavformat/fifo.o: in function `fifo_consumer_thread':
./libavformat/fifo.c:457: undefined reference to `__atomic_load_8'
/usr/bin/ld: libavformat/fifo.o: in function `fifo_write_packet':
./libavformat/fifo.c:597: undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status

Change History (3)

comment:1 by mkver, 2 years ago

Can you test this patch?

comment:2 by marillat, 2 years ago

Build fine with ffmpeg 4.4.1 and both arches.

comment:3 by mkver, 2 years ago

Resolution: fixed
Status: newclosed

An updated version of this patch has been applied as 2f0a214a6202516b4dda2bb22b6b3ac20e465d6d. So this issue should be fixed. Reopen if it isn't.

Note: See TracTickets for help on using tickets.