Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 754654 - media-video/ffmpeg: LTO breaks endianness test
Summary: media-video/ffmpeg: LTO breaks endianness test
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC Linux
: Normal normal (vote)
Assignee: media-video herd
URL: https://ffmpeg.org/pipermail/ffmpeg-d...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2020-11-15 02:07 UTC by David Michael
Modified: 2020-11-15 11:38 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 David Michael 2020-11-15 02:07:13 UTC
CFLAGS apparently isn't supported upstream.  The configure script tests for a big-endian system by compiling a global integer and dumping the object file as hex.  When CFLAGS enables LTO, the value gets optimized out, so PowerPC builds fail due to big-endian macros not getting set.

https://github.com/FFmpeg/FFmpeg/blob/master/configure#L5758-L5762

Reproducible: Always

Steps to Reproduce:
1. powerpc-gentoo-linux-gnu-emerge -v media-video/ffmpeg  # with -flto in CFLAGS

Actual Results:  
...
big-endian                no
...
src/libavcodec/ppc/audiodsp.c: In function ‘scalarproduct_int16_altivec’:
src/libavutil/ppc/util_altivec.h:123:5: error: implicit declaration of function ‘vec_vsx_ld’; did you mean ‘vec_vsel’? [-Werror=implicit-function-declaration]
  123 |     vec_vsx_ld(offset, b)
      |     ^~~~~~~~~~
...

Expected Results:  
It should build and install.

Fixing this particular problem can be done by filtering out the -flto* flags like below.  (The --enable-lto option adds back a plain -flto later, without the jobserver setting.)  If that's not doable, then "use ppc && local -x bigendian=yes" also fixes it.

--- media-video/ffmpeg/ffmpeg-4.3.1.ebuild
+++ media-video/ffmpeg/ffmpeg-4.3.1.ebuild
@@ -426,6 +426,7 @@
 
 	# LTO support, bug #566282
 	is-flagq "-flto*" && myconf+=( "--enable-lto" )
+	filter-flags "-flto*"
 
 	# Mandatory configuration
 	myconf=(