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

Bug 650460

Summary: media-libs/avidemux-core-2.7.0 fails to build with -flto: relocation R_X86_64_PC32 against undefined symbol `bF8' can not be used when making a shared object; recompile with -fPIC
Product: Gentoo Linux Reporter: Alexander Miller <alex.miller>
Component: Current packagesAssignee: Gentoo Media-video project <media-video>
Status: RESOLVED FIXED    
Severity: normal CC: eschwartz93, sam
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 618550    
Attachments: avidemux-core-2.7.0-bundled-ffmpeg-lto-fix.patch

Description Alexander Miller 2018-03-14 02:46:31 UTC
Created attachment 523838 [details, diff]
avidemux-core-2.7.0-bundled-ffmpeg-lto-fix.patch

With LTO the build of media-libs/avidemux-core-2.7.0 fails when linking the libraries of the bundled ffmpeg. Here are the errors from the build log:

LD      libpostproc/libADM6postproc.so.54
LD      libavcodec/libADM6avcodec.so.57
LD      libswscale/libADM6swscale.so.4
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/media-libs/avidemux-core-2.7.0/temp/ccgANYtl.ltrans1.ltrans.o: warning: relocation against `pb_03' in readonly section `.text'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/media-libs/avidemux-core-2.7.0/temp/ccgANYtl.ltrans6.ltrans.o: relocation R_X86_64_PC32 against undefined symbol `bF8' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
gmake[3]: *** [/tmp/portage/media-libs/avidemux-core-2.7.0/work/avidemux-core-2.7.0_build/ffmpeg/source/library.mak:94: libswscale/libADM6swscale.so.4] Error 1
gmake[3]: *** Waiting for unfinished jobs....
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/media-libs/avidemux-core-2.7.0/temp/cca1w2es.ltrans29.ltrans.o: warning: relocation against `pd_1' in readonly section `.text'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/media-libs/avidemux-core-2.7.0/temp/cca1w2es.ltrans7.ltrans.o: relocation R_X86_64_PC32 against undefined symbol `ff_h264_cabac_tables' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
gmake[3]: *** [/tmp/portage/media-libs/avidemux-core-2.7.0/work/avidemux-core-2.7.0_build/ffmpeg/source/library.mak:94: libavcodec/libADM6avcodec.so.57] Error 1
gmake[3]: Leaving directory '/tmp/portage/media-libs/avidemux-core-2.7.0/work/avidemux-core-2.7.0_build/ffmpeg/build'
make[2]: *** [CMakeFiles/libavutil_dummy.dir/build.make:61: CMakeFiles/libavutil_dummy] Error 2
make[2]: Leaving directory '/tmp/portage/media-libs/avidemux-core-2.7.0/work/avidemux-core-2.7.0_build'
make[1]: *** [CMakeFiles/Makefile2:71: CMakeFiles/libavutil_dummy.dir/all] Error 2
make[1]: Leaving directory '/tmp/portage/media-libs/avidemux-core-2.7.0/work/avidemux-core-2.7.0_build'
make: *** [Makefile:133: all] Error 2
 * ERROR: media-libs/avidemux-core-2.7.0::gentoo failed (compile phase):
 *   emake failed

These errors are due to using direct symbol references in inline asm (which are not visible to the compiler). Disabling those direct symbol refs in the bundled ffmpeg's configure fixes the build. The attached patch accomplishes this by creating a patch which is applied by avidemux-core's build system to the bundled ffmpeg sources.
Comment 1 Kostadin Shishmanov 2023-07-05 12:00:10 UTC
Can't reproduce this with media-libs/avidemux-core-2.8.1-r1 and gcc (Gentoo 13.1.1_p20230527 p3) 13.1.1 20230527
Comment 2 Eli Schwartz 2024-02-28 22:05:06 UTC
Can't reproduce with currently in-tree versions of avidemux-core either. I'm guessing the version change corresponds to upstream making this work.

https://github.com/mean00/avidemux2/commit/76f72e226684d68953de60c6d097f22c1c2f8ef1 may also be related.
Comment 3 Eli Schwartz 2024-02-28 22:06:57 UTC
Also possibly uplifted via a bundled ffmpeg update, e.g. https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=a64df19c5bd22f543a254a7b93c82ade50038ff5