2
« on: July 19, 2014, 05:23:03 pm »
I successfully built SFML and the example application with no problems, but I've started to make a game with it and I'm getting a bunch of linker errors. Heres the output of ndk-build.
$ ndk-build
[armeabi-v7a] Compile++ thumb: game <= main.cpp
[armeabi-v7a] Compile++ thumb: game <= Game.cpp
[armeabi-v7a] Compile++ thumb: game <= GameState.cpp
[armeabi-v7a] Compile++ thumb: game <= ResourceManager.cpp
[armeabi-v7a] Prebuilt : libsfml-graphics.so <= <NDK>/sources/sfml/lib/armeabi-v7a/
[armeabi-v7a] Prebuilt : libsfml-audio.so <= <NDK>/sources/sfml/lib/armeabi-v7a/
[armeabi-v7a] Prebuilt : libsfml-network.so <= <NDK>/sources/sfml/lib/armeabi-v7a/
[armeabi-v7a] Prebuilt : libsfml-window.so <= <NDK>/sources/sfml/lib/armeabi-v7a/
[armeabi-v7a] Prebuilt : libsfml-system.so <= <NDK>/sources/sfml/lib/armeabi-v7a/
[armeabi-v7a] SharedLibrary : libgame.so
/Programming/Android/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: warning: hidden symbol '__aeabi_atexit' in /Programming/Android/NDK/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO ./obj/local/armeabi-v7a/libsfml-graphics.so
/Programming/Android/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: warning: hidden symbol '__aeabi_atexit' in /Programming/Android/NDK/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO ./obj/local/armeabi-v7a/libsfml-audio.so
/Programming/Android/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: warning: hidden symbol '__aeabi_atexit' in /Programming/Android/NDK/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO ./obj/local/armeabi-v7a/libsfml-network.so
/Programming/Android/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: warning: hidden symbol '__aeabi_atexit' in /Programming/Android/NDK/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO ./obj/local/armeabi-v7a/libsfml-window.so
/Programming/Android/NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: warning: hidden symbol '__aeabi_atexit' in /Programming/Android/NDK/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO ./obj/local/armeabi-v7a/libsfml-system.so
jni/Game.cpp:14: error: undefined reference to 'sf::String::String(char const*, std::locale const&)'
jni/ResourceManager.cpp:69: error: undefined reference to 'sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'
jni/ResourceManager.cpp:83: error: undefined reference to 'sf::Font::loadFromFile(std::string const&)'
jni/ResourceManager.cpp:108: error: undefined reference to 'sf::SoundBuffer::loadFromFile(std::string const&)'
jni/ResourceManager.cpp:137: error: undefined reference to 'sf::SoundBuffer::loadFromFile(std::string const&)'
jni/ResourceManager.cpp:153: error: undefined reference to 'sf::SoundBuffer::loadFromFile(std::string const&)'
jni/ResourceManager.cpp:170: error: undefined reference to 'sf::Music::openFromFile(std::string const&)'
jni/ResourceManager.cpp:198: error: undefined reference to 'sf::Music::openFromFile(std::string const&)'
jni/ResourceManager.cpp:213: error: undefined reference to 'sf::Music::openFromFile(std::string const&)'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libgame.so] Error 1
I've never seen those "is referenced by DSO" errors so I have no clue what they mean, and the undefined references don't make sense seeing as I'm not getting those errors with other files that use functions from graphics and audio sfml modules, so why would just the resource manager not find the symbols?
My Application.mk
NDK_TOOLCHAIN_VERSION := 4.8
APP_PLATFORM := android-9
APP_STL := gnustl_static
APP_CPPFLAGS := -std=c++0x
APP_ABI := armeabi-v7a
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := game
LOCAL_SRC_FILES := main.cpp Game.cpp GameState.cpp ResourceManager.cpp
LOCAL_SHARED_LIBRARIES := sfml-system
LOCAL_SHARED_LIBRARIES += sfml-window
LOCAL_SHARED_LIBRARIES += sfml-graphics
LOCAL_SHARED_LIBRARIES += sfml-audio
LOCAL_SHARED_LIBRARIES += sfml-network
LOCAL_WHOLE_STATIC_LIBRARIES := sfml-main
include $(BUILD_SHARED_LIBRARY)
$(call import-module,sfml)
Could it have something to do with using c++11 in my project? I know sfml doesn't use c++11 at all yet, but I didn't think that would cause issues.