Build error on Mac: no archive symbol table (run ranlib)
See original GitHub issueI’m trying to package a Kivy hello world app on Mac., and it’s failing during the NDK build indicating that several SDL2 libraries are invalid: no archive symbol table (run ranlib)
.
I installed python-for-android 0.4 via pip. I’m on Mac OS 10.11.6, using NDK r11c with GCC 4.9. Here’s the command I’m running:
p4a apk --private . --package=org.example.HelloKivy --name "Hello Kivy" --version 0.1 --bootstrap=sdl2 --requirements=python2,kivy --sdk_dir $ANDROID_HOME --ndk_dir $ANDROID_NDK_HOME --android_api 16 --ndk_ver "r11c" --debug
And the full errors:
/Users/atwyman/Library/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: SDL2_ttf: no archive symbol table (run ranlib)
/Users/atwyman/Library/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: SDL2_image: no archive symbol table (run ranlib)
/Users/atwyman/Library/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: SDL2_mixer: no archive symbol table (run ranlib)
/Users/atwyman/Library/Android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: SDL2: no archive symbol table (run ranlib)
collect2: error: ld returned 1 exit status
Googling similar issues suggested this might be a case of the local version of ar
being used rather than the NDK version. I tried overriding via environment variables in various combinations, working up to the full set listed here: http://stackoverflow.com/questions/13751560/android-ndk-no-archive-symbol-table
Setting those variables for the a full clean package breaks the local parts of the Python build. Setting them on a retry (which skips the already-done steps) or in the ndk-build
script results in the same error.
Any clue what’s going on? Am I wrong to assume that python-for-android is expected to work on Mac vs. Linux?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
the problem is in pythonforandroid/build.py:695
the code fragment beggining there makes a unique_args list removing redundant “-L directories” form the “biglinking” command of libpymodules.so
but it starts at the end of the original args list and removes the “-L …/.python-for-android/build/bootstrap_builds/sdl2-python2/obj/local/armeabi-v7a” directory – where the libSDL2xxx.so shared object libraries were placed – from the beginning of the list of searched libraries
so replace the
while args: a = args.pop() if a in (‘-L’, ): continue if a not in unique_args: unique_args.insert(0, a)
code fragment with the simple
for a in args: if a not in unique_args: unique_args.append(a)
code and the linking phase then the whole building procedure will be OK
Closing as this code seems to have been replaced.