Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin fails to compile on macOS arm64 platform #39

Open
cschol opened this issue Sep 9, 2023 · 2 comments · May be fixed by #40
Open

Plugin fails to compile on macOS arm64 platform #39

cschol opened this issue Sep 9, 2023 · 2 comments · May be fixed by #40

Comments

@cschol
Copy link

cschol commented Sep 9, 2023

Lots of issues related to simde instructions:

_ARM64 -march=armv8-a+fp+simd -DARCH_MAC -mmacosx-version-min=10.9  -c -o build/src/QuadLogic.cpp.o src/QuadLogic.cpp                                      
In file included from src/PolyMix.cpp:3:                                                                                                                                                                                                                                                                               
In file included from src/dependancies/dsp/cpPan.h:2:                                                                                                      
In file included from src/dependancies/dsp/../utility/fasttrigo.h:46:                                                                                      
/home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/xmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"                                                                                                                                                    
#error "This header is only meant to be used on x86 and x64 architecture"
 ^                                                                                                                                                         
In file included from src/PolyMix.cpp:3:                                                                                                                   
In file included from src/dependancies/dsp/cpPan.h:2:          
In file included from src/dependancies/dsp/../utility/fasttrigo.h:46:                                                                                      
In file included from /home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/xmmintrin.h:17:                                              
/home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/mmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"                                                                                                                                                     
#error "This header is only meant to be used on x86 and x64 architecture"                                                                                  
 ^                                                                                                                                                         
/home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/mmintrin.h:17:19: error: typedef redefinition with different types ('__attribute__((__vector_size__(1 * sizeof(long long)))) long long' (vector of 1 'long long' value) vs 'simde__m64' (aka 'int32x2_t'))                                     
typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8)));                                                                               
                  ^                                                                                                                                        
/home/build/rack-plugin-toolchain/Rack-SDK-mac-arm64/dep/include/simde/x86/mmx.h:121:22: note: previous definition is here                                 
  typedef simde__m64 __m64;                        
                     ^                                                                                                                                     
In file included from src/PolyMix.cpp:3:                                                                                                                   
In file included from src/dependancies/dsp/cpPan.h:2:
In file included from src/dependancies/dsp/../utility/fasttrigo.h:46:                                                                                      
In file included from /home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/xmmintrin.h:17:                                              
/home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/mmintrin.h:35:11: error: too many arguments provided to function-like macro invocation                                                                                                                                                         
_mm_empty(void)                                                                                                                                            
          ^                                                                                                                                                                                                                                                                                                            
/home/build/rack-plugin-toolchain/Rack-SDK-mac-arm64/dep/include/simde/x86/mmx.h:768:11: note: macro '_mm_empty' defined here                              
#  define _mm_empty() simde_mm_empty()                                                                                                                                                                                                                                                                                 
          ^                                                                                                                                                
In file included from src/PolyMix.cpp:3:                                                                                                                                                                                                                                                                               
In file included from src/dependancies/dsp/cpPan.h:2:                                                                                                      
In file included from src/dependancies/dsp/../utility/fasttrigo.h:46:                                                                                                                                                                                                                                                  
In file included from /home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/xmmintrin.h:17:                                              
/home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/mmintrin.h:34:72: error: '__target__' attribute only applies to functions                                                                                                                                                                      
static __inline__ void  __attribute__((__always_inline__, __nodebug__, __target__("mmx")))                                                                 
                                                                       ^                                                                                                                                                                                                                                               
/home/build/rack-plugin-toolchain/local/bin/../lib/clang/15.0.7/include/mmintrin.h:35:1: error: variable has incomplete type 'void'                        
_mm_empty(void)                                                                                                                                                                                                                                                                                                        
^  

[...]                                                                                                                                           
@baconpaul
Copy link

@cschol - @pgatt had asked me about this in the fall. The following diff will fix this package and make it build on ARM.

@Coirt lemme know if you would prefer this as a PR.

diff --git a/src/dependancies/utility/fasttrigo.h b/src/dependancies/utility/fasttrigo.h
index 136be52..64cf4fd 100644
--- a/src/dependancies/utility/fasttrigo.h
+++ b/src/dependancies/utility/fasttrigo.h
@@ -43,8 +43,18 @@
 #include <QtGui>
 #endif
 //#include <intrin.h>
+#if defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) ||                                   \^M
+    (defined(_M_IX86_FP) && _M_IX86_FP >= 2)^M
 #include <xmmintrin.h>
 #include <pmmintrin.h>
+#else^M
+#if defined(__arm__) || defined(__aarch64__) || defined(__riscv)^M
+#define SIMDE_ENABLE_NATIVE_ALIASES^M
+#include "simde/x86/sse2.h"^M
+#else^M
+#error Bark requires either X86/SSE2 or ARM architectures.^M
+#endif^M
+#endif^M
 
 //Default accuracy
 namespace FT {

baconpaul added a commit to baconpaul/Bark that referenced this issue Dec 31, 2023
Include simde on aarch64 rather than ximmintrin etc... directly
Alternately you could just include the rack.hpp but this seems
a bit lower level than that.

Closes Coirt#39
@baconpaul baconpaul linked a pull request Dec 31, 2023 that will close this issue
@baconpaul
Copy link

Added as a PR in #40 if that's easier for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants