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

-msse3 is only available on x86 architectures #5

Open
rsekman opened this issue Nov 10, 2024 · 0 comments
Open

-msse3 is only available on x86 architectures #5

rsekman opened this issue Nov 10, 2024 · 0 comments

Comments

@rsekman
Copy link

rsekman commented Nov 10, 2024

The library can't be built as-is on AArch64 or other non-x86 architectures because of the -msse3 flag in Makefile.am. This flag is only available for x86. The build system should check the host architecture to determine if this flag should be used. I don't understand autotools very well but from what I've gathered such a check would need to take place in configure.ac of the main project, something like:

index 66faaa09e..93cf931e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ test "$prefix" = NONE && prefix=/usr/local
 case "$host" in
   i686-apple-*)
     AC_DEFINE(ARCH_X86_32, 1, [architecture is x86 on OSX])
+    SSE_FLAGS="-msse3"
     LIB="static-deps/lib-x86-32-apple"
     YASM_FLAGS="-f macho32 -D ARCH_X86_32 -m x86 -DPREFIX"
     APE_USE_YASM=yes
@@ -37,6 +38,7 @@ case "$host" in
     ;;
   x86_64-apple-*)
     AC_DEFINE(ARCH_X86_64, 1, [architecture is x86_64 on OSX])
+    SSE_FLAGS="-msse3"
     LIB="static-deps/lib-x86-64-apple"
     YASM_FLAGS="-f macho64 -D ARCH_X86_64 -m amd64 -DPIC -DPREFIX"
     APE_USE_YASM=yes
@@ -44,12 +46,14 @@ case "$host" in
     ;;
   i386-*-* | i486-*-* | i586-*-* | i686-*-* | i86pc-*-*)
     AC_DEFINE(ARCH_X86_32, 1, [architecture is x86])
+    SSE_FLAGS="-msse3"
     LIB="static-deps/lib-x86-32"
     YASM_FLAGS="-f elf -D ARCH_X86_32 -m x86"
     APE_USE_YASM=yes
     ;;
   x86_64-*-* | amd64-*-*)
     AC_DEFINE(ARCH_X86_64, 1, [architecture is x86_64])
+    SSE_FLAGS="-msse3"

and a corresponding change in Makefile.am here:

diff --git a/Makefile.am b/Makefile.am
index 8ce4dcc..b2807f5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,5 +4,5 @@ EXTRA_DIST = COPYING $(ppsimdpath)/ppsimd-license.txt
 pkglib_LTLIBRARIES = ddb_dsp_libretro.la
 ddb_dsp_libretro_la_SOURCES = libretro.cpp ppsimd/ppsimd.h sinc_resampler.h
 ddb_dsp_libretro_la_LDFLAGS = -module -avoid-version
-ddb_dsp_libretro_la_CXXFLAGS = $(CFLAGS) -msse3 -std=c++11 -I@top_srcdir@/include
+ddb_dsp_libretro_la_CXXFLAGS = $(CFLAGS) $(SSE_FLAGS) -std=c++11 -I@top_srcdir@/include
 endif
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

1 participant