We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2491

Summary: [PATCH] Force LOCAL_ARM_MODE for android builds
Product: SDL_mixer Reporter: Ben Boeckel <mathstuf>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: gabomdq, sylvain.becker
Version: unspecified   
Hardware: ARM   
OS: Android (All)   
Attachments: Force the ARM mode
patch build on android
patch indent
patch indent

Description Ben Boeckel 2014-04-11 19:35:34 UTC
Created attachment 1615 [details]
Force the ARM mode

SDL_mixer only builds with the LOCAL_ARM_MODE := arm since the third-party libs do not support the THUMB extensions.
Comment 1 Sam Lantinga 2014-04-18 05:44:04 UTC
Thanks!
https://hg.libsdl.org/SDL_mixer/rev/95e548111cc3

Out of curiosity, which third party libraries don't support THUMB extensions?

Also, is this patch relevant for SDL_image?
Comment 2 Ben Boeckel 2014-04-18 17:39:17 UTC
I only had OGG enabled. I think the modplug library also had issues.
Comment 3 Sylvain 2017-09-13 10:13:28 UTC
Not sure we have to enable arm for *all* files

I have only compiled, but this should work ?

--- a/Android.mk	Sat Sep 09 18:57:35 2017 -0700
+++ b/Android.mk	Wed Sep 13 12:12:07 2017 +0200
@@ -107,25 +107,23 @@
 	LOCAL_CFLAGS += -D_ARM_ASSEM_
     endif
     LOCAL_SRC_FILES += \
-        $(VORBIS_LIBRARY_PATH)/mdct.c \
+        $(VORBIS_LIBRARY_PATH)/mdct.c.arm \
         $(VORBIS_LIBRARY_PATH)/block.c \
-        $(VORBIS_LIBRARY_PATH)/window.c \
+        $(VORBIS_LIBRARY_PATH)/window.c.arm \
         $(VORBIS_LIBRARY_PATH)/synthesis.c \
         $(VORBIS_LIBRARY_PATH)/info.c \
-        $(VORBIS_LIBRARY_PATH)/floor1.c \
-        $(VORBIS_LIBRARY_PATH)/floor0.c \
-        $(VORBIS_LIBRARY_PATH)/vorbisfile.c \
+        $(VORBIS_LIBRARY_PATH)/floor1.c.arm \
+        $(VORBIS_LIBRARY_PATH)/floor0.c.arm \
+        $(VORBIS_LIBRARY_PATH)/vorbisfile.c.arm \
         $(VORBIS_LIBRARY_PATH)/res012.c \
         $(VORBIS_LIBRARY_PATH)/mapping0.c \
         $(VORBIS_LIBRARY_PATH)/registry.c \
         $(VORBIS_LIBRARY_PATH)/codebook.c \
-        $(VORBIS_LIBRARY_PATH)/sharedbook.c \
+        $(VORBIS_LIBRARY_PATH)/sharedbook.c.arm \
         $(OGG_LIBRARY_PATH)/src/framing.c \
         $(OGG_LIBRARY_PATH)/src/bitwise.c
 endif
 
 LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES)
 
-LOCAL_ARM_MODE := arm
-
 include $(BUILD_SHARED_LIBRARY)
Comment 4 Sylvain 2017-09-14 17:08:15 UTC
Created attachment 2944 [details]
patch build on android

Here's a patch for building SDL_mixer and its dependencies.
There is an Android.mk file for each library.

I only tried the compilation and running on my device. I haven't tried that each lib is working. Though the makefile have not really changed.

mikmod and smpeg2 are still shared libraries but they could also be marked as static. And only SDL_mixer would be a shared lib. That would be more convenient.

It easier to customize the compilation of each library if necessary. Cleaner to extend and to maintain I think.
Comment 5 Sam Lantinga 2017-10-22 19:10:13 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL_mixer/rev/c292b484a95e
Comment 6 Sylvain 2017-10-22 20:32:06 UTC
Hey!

1/ I don't use libvorbisidec, but I not sure with this commit, this fails to compile on my side. all those files need to be compile with arm.
https://hg.libsdl.org/SDL_mixer/rev/d87b8620f8ed
(maybe this happens because of armeabi ? or this is because I use ndk-r13b ?)

2/ otherwise: minor warnings because of comma at the end of enum :

diff -r d87b8620f8ed SDL_mixer.h
--- a/SDL_mixer.h	Sun Oct 22 12:09:28 2017 -0700
+++ b/SDL_mixer.h	Sun Oct 22 22:26:16 2017 +0200
@@ -82,7 +82,7 @@
     MIX_INIT_MOD    = 0x00000002,
     MIX_INIT_MP3    = 0x00000008,
     MIX_INIT_OGG    = 0x00000010,
-    MIX_INIT_MID    = 0x00000020,
+    MIX_INIT_MID    = 0x00000020
 } MIX_InitFlags;
 
 /* Loads dynamic libraries and prepares them for use.  Flags should be



3/ there might be an issue also with mpg123:
x86] SharedLibrary  : libmpg123.so
android-ndk-r13b/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: warning: shared library text segment is not shareable
android-ndk-r13b/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld
Comment 7 Sam Lantinga 2017-10-23 00:36:03 UTC
Thanks, the enum is fixed and the other files in libvorbisidec needed to be compiled in arm mode for armeabi.

I'm not sure what's happening with mpg123, but there are no warnings here. I'm using NDK 10e.
Comment 8 Sylvain 2017-10-23 11:10:51 UTC
Created attachment 3028 [details]
patch indent

Strange ... I have tried also with r10e, and with r16-beta1. with gcc and clang, and I have both issue.

1/ for vorbisidec, I see errors like: 

[armeabi] Compile thumb  : vorbisidec <= mdct.c
/tmp/cc04rrnZ.s: Assembler messages:
/tmp/cc04rrnZ.s:39: Error: selected processor does not support Thumb mode `smull r6,r5,r0,r2'
/tmp/cc04rrnZ.s:40: Error: selected processor does not support Thumb mode `smlal r6,r5,r1,r3'
/tmp/cc04rrnZ.s:41: Error: cannot honor width suffix -- `rsb r0,r0,#0'



also, here's a patch to remove tabs from Android.mk of SDL_mixer
Comment 9 Sylvain 2017-10-23 11:26:35 UTC
Created attachment 3030 [details]
patch indent

error in previous patch
Comment 10 Sam Lantinga 2017-10-23 15:08:30 UTC
Sorry, I forgot to push the ARM fix, and I added your indent patch:
https://hg.libsdl.org/SDL_mixer/rev/f6a6026e7172
https://hg.libsdl.org/SDL_mixer/rev/c593f8bf25c3

Thanks!