stk_module icon indicating copy to clipboard operation
stk_module copied to clipboard

errors when compiling for Android with ant

Open adamski opened this issue 9 years ago • 3 comments

when I include this module and try and compile for android with e.g. ant release I get lots of errors such as the following:

     [exec] /Users/adamelemental/dev/SDKs/android-ndk/platforms/android-9/arch-arm/usr/include/sys/endian.h:56:24: error: expected unqualified-id before '__extension__'
     [exec]  #define __swap16gen(x) __statement({     \
     [exec]                         ^
     [exec] /Users/adamelemental/dev/SDKs/android-ndk/platforms/android-9/arch-arm/usr/include/sys/endian.h:141:18: note: in expansion of macro '__swap16gen'
     [exec]  #define __swap16 __swap16gen
     [exec]                   ^
     [exec] /Users/adamelemental/dev/SDKs/android-ndk/platforms/android-9/arch-arm/usr/include/sys/endian.h:158:16: note: in expansion of macro '__swap16'
     [exec]  #define swap16 __swap16
     [exec]                 ^
     [exec] ../../JuceLibraryCode/modules/stk/../../../../../juce_modules/drowaudio/stk_module/stk/stk.h:181:15: note: in expansion of macro 'swap16'
     [exec]    static void swap16( unsigned char *ptr );
     [exec]                ^

Do you have any suggestions why this might happen with ant but not with Xcode?

adamski avatar Feb 25 '15 20:02 adamski

Hi Adam,

It looks like Android might be defining macro with the same name as a function in STK. Try undeffing all any symbol clashes at the top of the stk module header (and maybe the cpp header as well). E.g.

#undef swap16

Let me know if that gets rid on any errors.

Dave

On 25 Feb 2015, at 20:27, Adam Wilson [email protected] wrote:

when I include this module and try and compile for android with e.g. ant release I get lots of errors such as the following:

 [exec] /Users/adamelemental/dev/SDKs/android-ndk/platforms/android-9/arch-arm/usr/include/sys/endian.h:56:24: error: expected unqualified-id before '__extension__'
 [exec]  #define __swap16gen(x) __statement({     \
 [exec]                         ^
 [exec] /Users/adamelemental/dev/SDKs/android-ndk/platforms/android-9/arch-arm/usr/include/sys/endian.h:141:18: note: in expansion of macro '__swap16gen'
 [exec]  #define __swap16 __swap16gen
 [exec]                   ^
 [exec] /Users/adamelemental/dev/SDKs/android-ndk/platforms/android-9/arch-arm/usr/include/sys/endian.h:158:16: note: in expansion of macro '__swap16'
 [exec]  #define swap16 __swap16
 [exec]                 ^
 [exec] ../../JuceLibraryCode/modules/stk/../../../../../juce_modules/drowaudio/stk_module/stk/stk.h:181:15: note: in expansion of macro 'swap16'
 [exec]    static void swap16( unsigned char *ptr );
 [exec]                ^

Do you have any suggestions why this might happen with ant but not with Xcode?

— Reply to this email directly or view it on GitHub https://github.com/drowaudio/stk_module/issues/2.

drowaudio avatar Feb 25 '15 23:02 drowaudio

I tried some of the suggestions from the JUCE forum, and also your advice on both the stk.h and stk.cpp files. However still getting complaints from ant. You can see the additions I've made on my fork https://github.com/adamski/stk_module/tree/android-undefs

Thanks for your help on this

adamski avatar Mar 05 '15 21:03 adamski

See pull request for the solution that worked for me. Thanks

adamski avatar Mar 16 '15 16:03 adamski