ReSampler
ReSampler copied to clipboard
Compiling with many errors on M1-Macs
I wanted to try ReSampler to compile on my new MacBook Pro with M1-Pro CPU. There are many errors while compiling it with
clang++ -pthread -std=c++11 main.cpp ReSampler.cpp conversioninfo.cpp -lfftw3 -lsndfile -o ReSampler-clang -O3 -L/usr/local/lib -I/usr/local/include
I got this errors:
In file included from main.cpp:62:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/x86gprintrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
__asm__ ("hreset $0" :: "a"(__eax));
^
In file included from main.cpp:62:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:649:12: note: '__builtin_isless' declared here
return isless(__lcpp_x, __lcpp_y);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
#define isless(x, y) __builtin_isless((x),(y))
^
In file included from main.cpp:62:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^ ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^ ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
In file included from ReSampler.cpp:12:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/x86gprintrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
__asm__ ("hreset $0" :: "a"(__eax));
^
In file included from ReSampler.cpp:12:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:649:12: note: '__builtin_isless' declared here
return isless(__lcpp_x, __lcpp_y);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
#define isless(x, y) __builtin_isless((x),(y))
^
In file included from ReSampler.cpp:12:
In file included from ./ReSampler.h:30:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^ ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^ ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
In file included from conversioninfo.cpp:1:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/x86gprintrin.h:15:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
__asm__ ("hreset $0" :: "a"(__eax));
^
In file included from conversioninfo.cpp:1:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:649:12: note: '__builtin_isless' declared here
return isless(__lcpp_x, __lcpp_y);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
#define isless(x, y) __builtin_isless((x),(y))
^
In file included from conversioninfo.cpp:1:
In file included from ./conversioninfo.h:20:
In file included from ./iqdemodulator.h:28:
In file included from ./mpxdecode.h:19:
In file included from ./FIRFilter.h:27:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/immintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^ ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^ ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Is it possible to patch to compile it on M1 too?
Same issue here.
I am very interested in this, but unfortunately, I only have access to an Intel Mac at the moment. I would be keen to try compiling it on an M1 / M2.
At first glance, though, it looks to me like those are intel SIMD instructions which most definitely are not going to run on an M1's instruction set.
Let me see what i can organize ...
I believe you can fix this by updating FIRFilter.h
to include arm_neon.h
instead of immintrin.h
so that it tries to use ARM intrinsics and not intel ones. You could presumably gate that behind a #ifdef __ARM_NEON
, though not sure what the actual correct way to pick the right header is.
Compiles and seems to work on my M1 macbook with that change, though I haven't done any in-depth testing.