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 1404 - Android port doesn't compile (ndk-build error)
Summary: Android port doesn't compile (ndk-build error)
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: ARM Android (All)
: P2 blocker
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-28 14:44 UTC by Ellie
Modified: 2012-07-29 02:29 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ellie 2012-01-28 14:44:53 UTC
I just tried to port my Lua game engine based on SDL 1.3 to Android.
Unfortunately, I ran into this error instead when running ndk-build V=1:

rm -f ./libs/x86/lib*.so ./libs/armeabi/lib*.so ./libs/armeabi-v7a/lib*.so
rm -f ./libs/x86/gdbserver ./libs/armeabi/gdbserver ./libs/armeabi-v7a/gdbserver
rm -f ./libs/x86/gdb.setup ./libs/armeabi/gdb.setup ./libs/armeabi-v7a/gdb.setup
Compile thumb  : SDL <= SDL_error.c
/home/jonas/d/androidsdk/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi/objs/SDL/src/SDL_error.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Ijni/SDL/include -I/home/jonas/d/androidsdk/android-ndk-r7/sources/cxx-stl/system/include -Ijni/SDL -DANDROID  -Wa,--noexecstack -O2 -DNDEBUG -g -I/home/jonas/d/androidsdk/android-ndk-r7/platforms/android-5/arch-arm/usr/include -c  jni/SDL/src/SDL_error.c -o ./obj/local/armeabi/objs/SDL/src/SDL_error.o 
In file included from jni/SDL/include/SDL_log.h:40,
                 from jni/SDL/src/SDL_error.c:25:
jni/SDL/include/SDL_stdinc.h:78:20: error: iconv.h: No such file or directory
In file included from jni/SDL/include/SDL_log.h:40,
                 from jni/SDL/src/SDL_error.c:25:
jni/SDL/include/SDL_stdinc.h:739: error: expected ')' before 'cd'
make: *** [obj/local/armeabi/objs/SDL/src/SDL_error.o] Error 1
Comment 1 Ellie 2012-01-29 06:57:06 UTC
I tried the temporary fix:

cat blitwizard-android/jni/SDL/include/SDL_stdinc.h | sed -e "s/\#if defined[(]HAVE_ICONV[)]/\#if defined(ANDROID) || defined(__ANDROID__)\n\#undef HAVE_ICONV\n\#undef HAVE_ICONV_H\n\#endif\n\#if defined(HAVE_ICONV)/g" > blitwizard-android/jni/SDL/include/SDL_stdinc2.h
cp blitwizard-android/jni/SDL/include/SDL_stdinc2.h blitwizard-android/jni/SDL/include/SDL_stdinc.h

However, now I get:

Compile thumb  : SDL <= SDL_error.c
Compile thumb  : SDL <= SDL_log.c
Compile thumb  : SDL <= SDL_assert.c
Compile thumb  : SDL <= SDL_hints.c
Compile thumb  : SDL <= SDL_compat.c
In file included from jni/SDL/src/SDL_compat.c:26:
jni/SDL/include/SDL_syswm.h:68:22: error: X11/Xlib.h: No such file or directory
jni/SDL/include/SDL_syswm.h:69:23: error: X11/Xatom.h: No such file or directory
In file included from jni/SDL/src/SDL_compat.c:26:
jni/SDL/include/SDL_syswm.h:130: error: expected specifier-qualifier-list before 'XEvent'
jni/SDL/include/SDL_syswm.h:176: error: expected specifier-qualifier-list before 'Display'
make: *** [obj/local/armeabi/objs/SDL/src/SDL_compat.o] Error 1
NDK build failed.
Failed to complete Android build.
bash-4.2$

X-Server on Android? Really? Somehow SDL seems to think it compiles for a Linux system. Would be nice if someone could give me a hand on what I'm doing wrong or on how to fix this, since I would love to do an Android port of my engine :-)

Seems like something with the config headers is grossly wrong to me. Now is it my mistake, or is this simply so untested/old that some bigger mistake slipped in? (I followed README.android)
Comment 2 Ellie 2012-01-29 09:25:14 UTC
Well it seems my SDL_config.h claims there is iconv and all that. But since ./configure isn't run, how exactly is my SDL_config.h supposed to be written in an Android-suitable way? Should I edit it myself? README.android doesn't mention anything in regards of that.
Comment 3 Ellie 2012-01-29 16:57:37 UTC
Ok I am supposed to copy SDL_config_android.h obviously. I filed #1405 to reflect the total lack of any hint on this step in the README.android, and will close this bug: It was just a result of me missing that step in the build process, therefore not an actual issue in SDL itself, but rather with the documentation/readme.
Comment 4 Philipp Wiesemann 2012-07-29 02:29:47 UTC
For me compiling works with just including SDL_config.h because this file includes SDL_config_android.h itself. This is since a change in the repository from 2012-01-03.

Maybe your files were outdated (your post being from 2012-01-29) so you got the old behaviour.