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 2151 - androidbuild.sh fails with undefined reference to 'SDL_main'
Summary: androidbuild.sh fails with undefined reference to 'SDL_main'
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: main (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-12 08:50 UTC by Carles Pagès
Modified: 2013-10-14 14:49 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 Carles Pagès 2013-10-12 08:50:22 UTC
When running androidbuild.sh from 4f0f7b64afa5 (current tip) the script fails with:
building obj/local/armeabi/libmain.so
SharedLibrary  : libmain.so
/nix/store/gglycgxsdkmzsyc5vl621kd9chjm66sd-android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/main/__/SDL/src/main/android/SDL_android_main.o: in function Java_org_libsdl_app_SDLActivity_nativeInit:jni/src/../SDL/src/main/android/SDL_android_main.c:30: error: undefined reference to 'SDL_main'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libmain.so] Error 1
Buildfile: /home/page/dev/3rdparty/SDL/build/com.pagecorp.copviewer/build.xml

I guess it has todo with the recent static target? On a side note, I saw that the same script spits a non-fatal error on 'android update' because the target is not set. Could we set a sane default for that or set is as a param to the script?
Comment 1 Gabriel Jacobo 2013-10-12 19:04:36 UTC
Can you post what command you used?

Running:

   androidbuild.sh com.mdqinc.test ../test/testgles.c

From build-scripts worked perfectly for me just now.
Comment 2 Carles Pagès 2013-10-13 17:44:03 UTC
I was running it from an out of tree dir (/tmp/foo). Running it like you works indeed past that linking phase, but now it fails with:
BUILD FAILED
/nix/store/ar59h43w52big93mz360g620n3svaz75-android-sdk-22.2/libexec/android-sdk-linux/tools/ant/build.xm:542: Unable to resolve project target 'android-10'
Though I'm not sure if this may be caused by my setup.

Does running from out of tree work for you? Thanks for the quick reply, btw!
Comment 3 Gabriel Jacobo 2013-10-14 14:49:14 UTC
Out of source works for me with:

 /path/to/sdl/SDL/build-scripts/androidbuild.sh com.mdqinc.xxx /path/to/sdl/test/testgles.c

What you can't do is take out androidbuild.sh and run that out of source because it uses its own location to determine where the source for SDL is.