Git Product home page Git Product logo

Comments (7)

eezstreet avatar eezstreet commented on June 13, 2024

Thank you for your report, I will look into it

from opend2.

Bigorneau avatar Bigorneau commented on June 13, 2024

Since 6fe704e 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 c220ddf)

from opend2.

eezstreet avatar eezstreet commented on June 13, 2024

Does making this change break other Linux distros?

from opend2.

Bigorneau avatar Bigorneau commented on June 13, 2024

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.

from opend2.

Bigorneau avatar Bigorneau commented on June 13, 2024

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

from opend2.

liberodark avatar liberodark commented on June 13, 2024

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

from opend2.

liberodark avatar liberodark commented on June 13, 2024

Have compile on fedora for fix
But is not possible to create player

from opend2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.