I was trying to make and Android app that uses SFML.
I successfully create all the .so and .a
E:\Android\SFML-master>cmake -DANDROID_ABI=armeabi-v7a -DCMAKE_TOOLCHAIN_FILE=cm
ake/toolchains/android.toolchain.cmake -DANDROID_NDK=E:\Android\android-ndk-r10e
-- Building for: Visual Studio 12 2013
CMake Warning at CMakeLists.txt:97 (message):
CMake might not properly support setting the STL. Make sure to adjust all
generated library projects!
-- Found JPEG: E:/Android/SFML-master/extlibs/libs-android/armeabi-v7a/libjpeg.a
-- Found OpenAL: E:/Android/SFML-master/extlibs/libs-android/armeabi-v7a/libopen
al.so
-- Found VORBIS: E:/Android/SFML-master/extlibs/libs-android/armeabi-v7a/libvorb
is.a
-- Found FLAC: E:/Android/SFML-master/extlibs/libs-android/armeabi-v7a/libFLAC.a
-- Configuring done
-- Generating done
-- Build files have been written to: E:/Android/SFML-master
E:\Android\SFML-master>
As you can see, all fine.
I import the sfml's default android example using ( import and ndk-build Android Project ) using the last version of Nvidia Nsight.
I had to change the original android.mk ( and the application.mk too ) of the example (because don't work at least for me)
my android.mk:
LOCAL_PATH := $(call my-dir)
## sfml-activity ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-activity-main
LOCAL_SRC_FILES := libsfml-activity-d.so
include $(PREBUILT_SHARED_LIBRARY)
## sfml-activity end ##
## sfml-system.so ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-system
LOCAL_SRC_FILES := libsfml-system-d.so
include $(PREBUILT_SHARED_LIBRARY)
## sfml-system.so end ##
## sfml-window.so ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-window
LOCAL_SRC_FILES := libsfml-window-d.so
include $(PREBUILT_SHARED_LIBRARY)
## sfml-window.so end ##
## sfml-graphics.so ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-graphics
LOCAL_SRC_FILES := libsfml-graphics-d.so
include $(PREBUILT_SHARED_LIBRARY)
## sfml-graphics.so end ##
## sfml-audio.so ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-audio
LOCAL_SRC_FILES := libsfml-audio-d.so
include $(PREBUILT_SHARED_LIBRARY)
## sfml-audio.so end ##
## sfml-network.so ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-network
LOCAL_SRC_FILES := libsfml-network-d.so
include $(PREBUILT_SHARED_LIBRARY)
## sfml-network.so end ##
## sfml-main ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-main
LOCAL_SRC_FILES := libsfml-main-d.a
include $(PREBUILT_STATIC_LIBRARY)
## sfml-main end ##
## sfml-example ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-example
LOCAL_SRC_FILES := main.cpp
LOCAL_SRC_FILES += String.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_STATIC_LIBRARIES := sfml-main
include $(BUILD_SHARED_LIBRARY)
## sfml-example end ##
## sfml-activity ##
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-start
LOCAL_SHARED_LIBRARIES := sfml-activity-main
include $(BUILD_SHARED_LIBRARY)
## sfml-activity end ##
I get this undefined:
1>------ Build started: Project: test, Configuration: Debug Tegra-Android ------
1> [armeabi-v7a] Gdbserver : [arm-linux-androideabi-4.8] ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/gdbserver
1> [armeabi-v7a] Gdbsetup : ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/gdb.setup
1> [armeabi-v7a] Install : libsfml-start.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-start.so
1> [armeabi-v7a] Compile++ thumb: sfml-example <= main.cpp
1> [armeabi-v7a] Compile++ thumb: sfml-example <= String.cpp
1> [armeabi-v7a] Install : libsfml-activity-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-activity-d.so
1> [armeabi-v7a] Install : libsfml-system-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-system-d.so
1> [armeabi-v7a] Install : libsfml-window-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-window-d.so
1> [armeabi-v7a] Install : libsfml-graphics-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-graphics-d.so
1> [armeabi-v7a] Install : libsfml-audio-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-audio-d.so
1> [armeabi-v7a] Install : libsfml-network-d.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libsfml-network-d.so
1> [armeabi-v7a] Install : libc++_shared.so => ../../../prueba/test/test/Tegra-Android/Debug//libs/armeabi-v7a/libc++_shared.so
1> [armeabi-v7a] SharedLibrary : libsfml-example.so
1>E:\Android\prueba\test\test\jni\main.cpp(13): error : error: undefined reference to 'sf::Texture::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sf::Rect<int> const&)'
1>E:\Android\prueba\test\test\jni\main.cpp(21): error : error: undefined reference to 'sf::Music::openFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
1> collect2.exe: error: ld returned 1 exit status
1> make.exe: *** [../../../prueba/test/test/Tegra-Android/Debug//local/armeabi-v7a/libsfml-example.so] Error 1
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I add to the jni path String.hpp for resolve the undefined Sf::String() symbol, if i add Music.hpp and Texture.hpp start asking for more and more include...
As you can see i'm using debug libraries, but i tested in release ( i take care of don't mix them, i have both release/debug) even i tried with the stripped_libsfml-xxx.so that automatically generates NSight among the libsfml_xxx.so.
I try using esfml (
https://github.com/Sonkun/esfml ) i built fine but get the same linking symbols error.
I had to change LOCAL_WHOLE_STATIC_LIBRARIES for LOCAL_STATIC_LIBRARIES , using the first one (like in the original example) give me more a lot of undefined.
I used ARMEABI-V7A for compiling all .so and .a and try to make the .apk (because i don't find the option inside NSight to try with ARMEABI ) seems that only support V7 , V8, x86 , x86_64.
The STL type is the default one (GNU libstdc++ Static)
I use the sfml's cmake toolchain, even i tried all using ""another"" toolchain (seems to make the same result ,
https://github.com/taka-no-me/android-cmake/blob/master/android.toolchain.cmake , i don't know is both are the same)
The minAndroidApi lvl i use is 14 ( in making all .so and .a and the .apk)
The target and max are NotSpecified
Can someone help me?
I need to give more details?