Subject of the issue
When using SFML 2.6.x branch and compiling SFML for Android, Android Studio throws out an error saying to recompile x86 architecture with -fPIC. Adding this into the CMAKE_CXX_FLAGS and CMAKE_C_FLAGS in CMakeCache is a temporary fix.
Your environment
Android Studio 2022.1.1 on Windows 10
SFML 2.6.x branch
Used CMake, Ninja, Android NDK 25
Steps to reproduce
I followed this tutorial that was mentioned on the Github Wiki:
https://github.com/SFML/SFML/wiki/Tutorial:-Building-SFML-for-Android-on-Windows-with-Android-Studio
Expected behavior
It should compile for x86 (it works for arm, arm64 and x86_64)
Actual behavior
An error is thrown:
ld: error: relocation R_386_PC32 cannot be used against symbol 'sf::NonCopyable::NonCopyable()'; recompile with -fPIC
>>> defined in C:/Users/cutel/AppData/Local/Android/Sdk/ndk/25.1.8937393/sources/third_party/sfml/lib/x86/libsfml-main-d.a(MainAndroid.cpp.o)
>>> referenced by Thread.inl:77 (C:/Users/cutel/SFML-2.6.x-Android/SFML-2.6.x/include/SFML/System/Thread.inl:77)
>>> MainAndroid.cpp.o:(sf::Thread::Thread<void* (*)(sf::priv::ActivityStates*), sf::priv::ActivityStates*>(void* (*)(sf::priv::ActivityStates*), sf::priv::ActivityStates*)) in archive C:/Users/cutel/AppData/Local/Android/Sdk/ndk/25.1.8937393/sources/third_party/sfml/lib/x86/libsfml-main-d.a
Subject of the issue
When using SFML 2.6.x branch and compiling SFML for Android, Android Studio throws out an error saying to recompile x86 architecture with -fPIC. Adding this into the CMAKE_CXX_FLAGS and CMAKE_C_FLAGS in CMakeCache is a temporary fix.
Your environment
Android Studio 2022.1.1 on Windows 10
SFML 2.6.x branch
Used CMake, Ninja, Android NDK 25
Steps to reproduce
I followed this tutorial that was mentioned on the Github Wiki:
https://github.com/SFML/SFML/wiki/Tutorial:-Building-SFML-for-Android-on-Windows-with-Android-Studio
Expected behavior
It should compile for x86 (it works for arm, arm64 and x86_64)
Actual behavior
An error is thrown: