Open KhazAkar opened 5 years ago
Thank you for your report, I will look into it
Since 6fe704ee it compile but on archlinux I had a link issue
/usr/bin/ld: CMakeFiles/game.dir/Game/Renderer_SDL.cpp.o: undefined reference to symbol 'SDL_CreateTexture'
/usr/bin/ld: /usr/lib/libSDL2-2.0.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/game.dir/build.make:489: game] Error 1
make[1]: *** [CMakeFiles/Makefile2:110: CMakeFiles/game.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Looks like it's because SDL2_LIBRARIES
is empty (see archlinux issue #57972 and there)
If I replace SDL2_LIBRARIES
with SDL2::SDL2
it link and works, I have sound and can go to the select hero class (I guest for now it's the only thing you can do without a TCP/IP on 1.10). (using c220ddfe)
Does making this change break other Linux distros?
I'm not sure, I will try some distros with lxc and let you know. It's probably due to the version of sdl, cmake or just related to archlinux.
Simply replacing it break Ubuntu.
Using a TARGET
check like they did here "cannot find sdl2" works for ubuntu, archlinux and opensuse.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 640e718..6ecacd6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,7 +65,11 @@ if(BUILD_GAME)
set_target_properties(game PROPERTIES LINKER_LANGUAGE CXX)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
- target_link_libraries(game ${SDL2_LIBRARIES} SDL2_net SDL2_mixer m dl)
+ if (TARGET SDL2::SDL2)
+ target_link_libraries(game SDL2:SDL2 SDL2_net SDL2_mixer m dl)
+ else()
+ target_link_libraries(game ${SDL2_LIBRARIES} SDL2_net SDL2_mixer m dl)
+ endif()
endif()
target_compile_definitions(game PUBLIC D2EXE)
There is probably a cleaner way to do it
Ubuntu use
libsdl2-2.0-0:amd64 2.0.4+dfsg1-2ubuntu2
libsdl2-dev 2.0.4+dfsg1-2ubuntu2
libsdl2-mixer-2.0-0:amd64 2.0.1+dfsg1-1
libsdl2-mixer-dev:amd64 2.0.1+dfsg1-1
libsdl2-net-2.0-0:amd64 2.0.1+dfsg1-2
libsdl2-net-dev:amd64 2.0.1+dfsg1-2
cmake 3.5.1-1ubuntu3
While archlinux
sdl2 2.0.9-1
sdl2_mixer 2.0.4-1
sdl2_net 1:2.0.1-2
cmake 3.13.1-1
And opensuse
S | Name | Type | Version | Arch | Repository
---+---------------------------+---------+-------------------+--------+-----------
i+ | libSDL2-2_0-0 | package | 2.0.8-lp150.1.1 | x86_64 | repo-oss name: libSDL2-2_0-0
i+ | libSDL2-devel | package | 2.0.8-lp150.1.1 | x86_64 | repo-oss name: libSDL2-devel
i+ | libSDL2_mixer-2_0-0 | package | 2.0.2-lp150.1.3 | x86_64 | repo-oss name: libSDL2_mixer-2_0-0
i+ | libSDL2_mixer-devel | package | 2.0.2-lp150.1.3 | x86_64 | repo-oss name: libSDL2_mixer-devel
i+ | libSDL2_net-2_0-0 | package | 2.0.0-lp150.1.3 | x86_64 | repo-oss name: libSDL2_net-2_0-0
i+ | libSDL2_net-devel | package | 2.0.0-lp150.1.3 | x86_64 | repo-oss name: libSDL2_net-devel
i+ | cmake | package | 3.10.2-lp150.1.5 | x86_64 | repo-oss name: cmake
Hi have installed the same and not work :
/usr/bin/ld : ne peut trouver -lSDL2:SDL2 collect2: erreur: ld a retourné le statut de sortie 1 make[2]: [CMakeFiles/game.dir/build.make:489: game] Error 1 make[1]: [CMakeFiles/Makefile2:79: CMakeFiles/game.dir/all] Error 2 make: *** [Makefile:84: all] Error 2 CMakeLists.txt
Have compile on fedora for fix But is not possible to create player
I cannot compile newest version from master. system is Linux, OpenSUSE Leap 15. everything related to SDL is installed to compile it.