Created attachment 427982 [details, diff] patch for existing ebuild The media-video/ffmpeg-2.8.5 ebuild sets the --cpu configure flags based on the -mtune CFLAG. This bug appears to have been introduced in response to bug 172723 The -mtune CFLAG means optimize for the given CPU, but don't generate code the will only run on that CPU. The --cpu configure flag means generate code that is optimized for that CPU ignoring backward compatibility. This means that in some situations, ffmpeg will be compiled with code that does not run on all the CPUs that generic code compiled with the user's provided CFLAGS or CXXFLAGS would run on. Specifically, if the user had set -mtune in the CFLAGS or CXXFLAGS without specifying -march or -mcpu then this bug is triggered. A patch to the ebuild which corrects the problem is attached. This bug is likely present in other ffmpeg ebuilds as well. To reproduce, set -mtune without setting -mcpu or -march. See the truncated sample build output attached. Note that --cpu=core-avx-i is added to the end of the configure options in the example.
Created attachment 427984 [details] Truncated emerge output showing error This is the beginning of an emerge run with the current ebuild which shows the error.
Created attachment 427986 [details] Failure running ffmpeg built with the current ebuild Attempt to run ffmpeg on a CPU that does not have all the instructions provided by the CPU specified in the -mtune CPU flag. (in this case, qemu64 virtual CPU vs. core-avx-i)
Created attachment 427988 [details] Successfully running ffmpeg build with the patched ebuild This shows a successful run of ffmpeg build with the patched ebuild. The output shows the configure options used at compile time.
Created attachment 427990 [details] proposed ffmpeg-2.8.5-r1.ebuild proposed ffmpeg-2.8.5-r1.ebuild
commit 0ad2a95a4188fd99800f9a6a1b73a37c55b70ade Author: Alexis Ballier <aballier@gentoo.org> Date: Fri Mar 11 21:09:00 2016 +0100 media-video/ffmpeg: Do not infer --cpu option from mtune CFLAG. mtune is meant for optimizing code but not generating specific instructions. ffmpeg --cpu option is for generating specific instuctions. Bug #577078 by gentoobugs@mysteryvortex.com. thx