Estou tentando compilar SFML do Linux para o Windows para um projeto meu. Pacotes SFML pré-construídos não são uma opção.
Então, eu instalei o pacote mingw-w64, e configurei um arquivo toolchain, e continuei tentando compilar o SFML a partir do código-fonte usando o CMake, apenas para descobrir que o compilador GCC fornecido está quebrado.
Mensagem de erro completa:
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/i686-w64-mingw32-gcc" is not able to compile a
simple test program.
It fails with the following output:
Change Dir: /home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_9b6e7/fast"
/usr/bin/make -f CMakeFiles/cmTC_9b6e7.dir/build.make
CMakeFiles/cmTC_9b6e7.dir/build
make[1]: Entering directory
'/home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_9b6e7.dir/testCCompiler.c.o
/usr/bin/i686-w64-mingw32-gcc -o
CMakeFiles/cmTC_9b6e7.dir/testCCompiler.c.o -c
/home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_9b6e7
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9b6e7.dir/link.txt
--verbose=1
/usr/bin/i686-w64-mingw32-gcc CMakeFiles/cmTC_9b6e7.dir/testCCompiler.c.o
-o cmTC_9b6e7 -rdynamic
i686-w64-mingw32-gcc: error: unrecognized command line option
‘-rdynamic’
CMakeFiles/cmTC_9b6e7.dir/build.make:97: recipe for target 'cmTC_9b6e7'
failed
make[1]: *** [cmTC_9b6e7] Error 1
make[1]: Leaving directory
'/home/chemicalchems/SFML-2.3.2/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_9b6e7/fast' failed
make: *** [cmTC_9b6e7/fast] Error 2
Portanto, o problema é que o i686-w64-mingw32-gcc não aceita a opção -rdynamic
. Eu tentei dizer ao CMake que ele não deveria testar o compilador C no meu arquivo de toolchain, mas ele continua checando e assim falhando.
Arquivo do conjunto de ferramentas:
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR i686)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_C_COMPILER_WORKS 1)
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
# cross compilers to use for C and C++
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
# target environment on the build host system
# set 1st to dir with the cross compiler's C/C++ headers/libs
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
# modify default behavior of FIND_XXX() commands to
# search for headers/libs in the target environment and
# search for programs in the build host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Qualquer ajuda seria muito apreciada.