Christian Weisgerber
2017-Jan-09 16:42 UTC
[flac-dev] 1.3.2: FLAC__CPUINFO_IA32_CPUID_SSE3 undeclared
Building 1.3.2 on OpenBSD/i386, I get this error: cpu.c: In function 'ia32_cpu_info': cpu.c:128: error: 'FLAC__CPUINFO_IA32_CPUID_SSE3' undeclared (first use in this function) cpu.c:128: error: (Each undeclared identifier is reported only once cpu.c:128: error: for each function it appears in.) cpu.c:129: error: 'FLAC__CPUINFO_IA32_CPUID_SSSE3' undeclared (first use in this function) cpu.c:130: error: 'FLAC__CPUINFO_IA32_CPUID_SSE41' undeclared (first use in this function) cpu.c:131: error: 'FLAC__CPUINFO_IA32_CPUID_SSE42' undeclared (first use in this function) cpu.c:134: error: 'FLAC__CPUINFO_IA32_CPUID_OSXSAVE' undeclared (first use in this function) cpu.c:135: error: 'FLAC__CPUINFO_IA32_CPUID_AVX' undeclared (first use in this function) cpu.c:136: error: 'FLAC__CPUINFO_IA32_CPUID_FMA' undeclared (first use in this function) cpu.c:138: error: 'FLAC__CPUINFO_IA32_CPUID_AVX2' undeclared (first use in this function) This is a result on inconsistent #if guards in src/libFLAC/cpu.c, combined with an old compiler (GCC 4.2.1) that doesn't have x86intrin.h. Specifically, the definition of FLAC__CPUINFO_IA32_CPUID_SSE3 etc. is guarded by #if FLAC__HAS_X86INTRIN || FLAC__AVX_SUPPORTED However, the later use in ia32_cpu_info is guarded by #if !defined FLAC__NO_ASM && (defined FLAC__HAS_NASM || FLAC__HAS_X86INTRIN) In our case, we have FLAC__HAS_NASM 1 FLAC__HAS_X86INTRIN 0 FLAC__AVX_SUPPORTED 0 -- Christian "naddy" Weisgerber naddy at mips.inka.de
Christian Weisgerber
2017-Jan-12 21:10 UTC
[flac-dev] 1.3.2: FLAC__CPUINFO_IA32_CPUID_SSE3 undeclared
FWIW, here's a minimal fix to deal with this. --- src/libFLAC/cpu.c.orig Wed Dec 21 21:41:21 2016 +++ src/libFLAC/cpu.c Thu Jan 12 21:24:21 2017 @@ -65,7 +65,7 @@ static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0 static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000; #endif -#if FLAC__HAS_X86INTRIN || FLAC__AVX_SUPPORTED +#if FLAC__HAS_X86INTRIN || FLAC__AVX_SUPPORTED || defined FLAC__HAS_NASM /* these are flags in ECX of CPUID AX=00000001 */ static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001; static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200; -- Christian "naddy" Weisgerber naddy at mips.inka.de
Erik de Castro Lopo
2017-Jan-13 10:31 UTC
[flac-dev] 1.3.2: FLAC__CPUINFO_IA32_CPUID_SSE3 undeclared
Christian Weisgerber wrote:> FWIW, here's a minimal fix to deal with this.Applied. Thanks. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/