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

Mac M1 build arm64 failed #648

Open
cgeffect opened this issue Dec 5, 2024 · 2 comments
Open

Mac M1 build arm64 failed #648

cgeffect opened this issue Dec 5, 2024 · 2 comments

Comments

@cgeffect
Copy link

cgeffect commented Dec 5, 2024

this is my build script
cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DCMAKE_INSTALL_PREFIX="${workdir}/deploy" \ -DSDL2IMAGE_VENDORED=ON \ -DSDL2IMAGE_DEPS_SHARED=OFF \ -DSDL2IMAGE_SAMPLES=ON \ -DBUILD_SHARED_LIBS=OFF \ -DSDL2IMAGE_WEBP=ON \ -DCMAKE_OSX_ARCHITECTURES="arm64" \ -DCMAKE_SYSTEM_NAME=Darwin \ -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" ..
if modify -DCMAKE_OSX_ARCHITECTURES="arm64" to -DCMAKE_OSX_ARCHITECTURES="x86_64" success, but use arm64 failed

this is error message
[ 95%] Building C object CMakeFiles/SDL2_mixer.dir/src/codecs/timidity/mix.c.o In file included from /Users/jason/Desktop/SDL/SDL_mixer/src/codecs/timidity/common.c:11: In file included from /usr/local/Cellar/sdl2/2.30.9/include/SDL2/SDL.h:38: In file included from /usr/local/Cellar/sdl2/2.30.9/include/SDL2/SDL_cpuinfo.h:111: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/immintrin.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 /Users/jason/Desktop/SDL/SDL_mixer/src/codecs/timidity/common.c:11: In file included from /usr/local/Cellar/sdl2/2.30.9/include/SDL2/SDL.h:38: In file included from /usr/local/Cellar/sdl2/2.30.9/include/SDL2/SDL_cpuinfo.h:111: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/immintrin.h:17: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/x86gprintrin.h:15:

@sezero
Copy link
Contributor

sezero commented Dec 5, 2024

Maybe a workaround like the following ??

diff --git a/include/SDL_cpuinfo.h b/include/SDL_cpuinfo.h
index e4d7464..7ee75b6 100644
--- a/include/SDL_cpuinfo.h
+++ b/include/SDL_cpuinfo.h
@@ -115,7 +115,8 @@ _m_prefetch(void *__P)
 #include <lasxintrin.h>
 #define __LASX__
 #endif
-#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
+#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) && \
+   (defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86))
 #include <immintrin.h>
 #else
 #if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)

@sezero
Copy link
Contributor

sezero commented Dec 5, 2024

( CC @slouken )

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

No branches or pull requests

2 participants