Hi all,
I hope this is the right forum.
I'm trying to build a customised ffmpeg-headless package on an rPi2, optimised for the Cortex package of the rPi2.
I have the following $CFLAGS in makepkg.conf:
$this->bbcode_second_pass_code('', 'CFLAGS="-mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -O4 -pipe -fstack-protector-strong -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection"')
As I understand it, this is the correct combination of flags for optimised builds for the rPi2.
At first, I was getting lots of compiler warning about conflicting optimisation flags:
$this->bbcode_second_pass_code('', 'cc1: warning: switch ‘-mcpu=cortex-a7’ conflicts with ‘-march=armv7-a’ switch')
It seems that the ffmpeg configure script sets its own -march flag, regardless of what's in the environment $CFLAGS. So I added the following line to the PKGBUILD, as part of the configure line in build():
$this->bbcode_second_pass_code('', '$([[ $CFLAGS =~ -mcpu=([^ ]+) ]] && echo "--cpu=${BASH_REMATCH[1]}") \')
This explicitly tells the ffmpeg configure script which -mcpu to use, so it no longer adds -march to the compiler call. So no more errors about conflicting switches - great!
Except now I'm getting this error during the build:
$this->bbcode_second_pass_code('', '/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/10.2.0/include/arm_neon.h:6635:10: fatal error: You must enable NEON instructions (e.g. ‘-mfloat-abi=softfp’ ‘-mfpu=neon’) to use these intrinsics.')
And I'm stumped! My $CFLAGS includes both -mfloat-abi=hard (which should be compatible with NEON) and -mfpu=neon-vfpv4. The only thing I can think is that these flags are somehow not being passed to the compiler (specifically, lto1 which is what is running when this error occurs), but I can't work out how to check that. Googling the error (in relation to ffmpeg) has been a dead-end.
Does anyone familiar with ffmpeg's configure/build system have some ideas? Or any suggestions on how else to diagnose the problem?
NB: I'm compiling locally/natively. Other than for troubleshooting this problem, the length of time compiling doesn't bother me and I've not taken the time to get my head around distcc cross-compiling yet (though I'm sure I will at some point!).
TIA