reported on #gentoo by user whose: cpu native resolves to skylake CPU_FLAGS_X86="aes avx avx2 mmx mmxest pclmul popcnt rdcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" Reproducible: Always Steps to Reproduce: CPU_FLAGS_X86="aes avx avx2 mmx mmxest pclmul popcnt rdcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" CFLAGS="-march=skylake -mabm -mno-adx -mno-f16c -mno-fma -mno-sgx -mno-xsavec -mno-xsaveopt -mno-xsaves --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=8192 -O2 -pipe" CXXFLAGS=${CFLAGS} ebuild opus-1.5.1-r1.ebuild clean compile Actual Results: /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch 47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C) | ^~~~~~~~~~~~~~~ ../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:63:18: note: called from here 63 | accum2 = _mm256_fmadd_pd( x1d, x2d, accum2 ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch 47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C) | ^~~~~~~~~~~~~~~ ../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:58:18: note: called from here 58 | accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch 47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C) | ^~~~~~~~~~~~~~~ ../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:58:18: note: called from here 58 | accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch 47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C) | ^~~~~~~~~~~~~~~ ../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:63:18: note: called from here 63 | accum2 = _mm256_fmadd_pd( x1d, x2d, accum2 ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch 47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C) | ^~~~~~~~~~~~~~~ ../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:72:18: note: called from here 72 | accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch 47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C) | ^~~~~~~~~~~~~~~ ../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:72:18: note: called from here 72 | accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 ); attaching build log seems to be march specific, passes with -march=core2 and other specific march set (and all other options the same)
Created attachment 890126 [details] march=skylake build fail
Looking at the code, more specifically this should only happen when have AVX2 enabled but FMA disabled (-march=skylake enables avx2 and fma, but then the passed -mno-fma disables fma). It's atypical to have a cpu that supports avx2 but not fma, albeit there are apparently some (we had similar issues with qtbase). As a minimal workaround, could do -mno-avx2 just for this package (haven't tried but don't see why it wouldn't work). As for a ebuild fix, code needs to either be improved upstream to handle this configuration -- or ebuild could do a workaround like we did in qt6-build.eclass which auto-passes -mno-avx2 *if* fma is not enabled.
(In reply to Ionen Wolkens from comment #2) > As for a ebuild fix, code needs to either be improved upstream to handle > this configuration -- or ebuild could do a workaround like we did in > qt6-build.eclass which auto-passes -mno-avx2 *if* fma is not enabled. For a simpler version than the eclass, one could do something like (haven't tried it): tc-cpp-is-true 'defined(__FMA__)' ${CFLAGS} || append-flags $(test-flags-CC -mno-avx2) Could optionally guard behind use amd64 || x86, albeit test-flags-CC takes care of that too.
(in case unclear, note that this can happen with -march=native if have such a cpu, so this is not necessarily about having -mno-fma in CFLAGS)
I have this exact same issue and I can confirm that adding in a per package env file for opus with this in it fixes the problem: CFLAGS="${CFLAGS} -mno-avx2"