ndk-build: undefined reference to .. errors when statically linking to libxml.a

前端 未结 5 794
终归单人心
终归单人心 2021-02-08 04:34

I get a lot of undefined reference to ... errors when I compile my single c++ source-file using the ndk-build tool. For the record I use NDK r6 on a linux host system.

F

5条回答
  •  孤独总比滥情好
    2021-02-08 05:41

    The problem is that some functionalities are enabled by default while they may need some extra linking to other libraries , this functionalities are : - support loading MOD music via modplug . - support loading MOD music via mikmod - support loading MP3 music via SMPEG you should disable these options to build sdl2_mixer so go to "Android.mk" ( of SDL2_mixer) file and you will find :

    SUPPORT_MOD_MODPLUG ?= true
    ...
    SUPPORT_MOD_MIKMOD ?= true
    ...
    SUPPORT_MP3_SMPEG ?= true
    

    change those to "false" and it will work for you as did with me !

    NOTES :

     LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
    

    1- will cause a runtime error , because the symbol will still not be resolved at runtime

    2- You won't be able to load mp3 files but you can covert them to "ogg" with almost the same size and quality , but you can find the perfect solution of your exact problem here Runtime linking error with SDL_Mixer and SMPEG2 on Android

提交回复
热议问题