Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Link executable to work with all 2.x SFML libs  (Read 323 times)

0 Members and 1 Guest are viewing this topic.

Dipper

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • My projects
Link executable to work with all 2.x SFML libs
« on: June 26, 2019, 03:39:04 pm »
I wanted to run my game on other Linux machine where I had installed the newest SFML using package manager. The executable refused to work with the following error:
./space-logic-adventure: error while loading shared libraries: libsfml-system.so.2.4: cannot open shared object file: No such file or directory
 

It makes sense because I compiled it over a year ago using an older version of SFML. After recompiling the game from the source, it runs as intended. But is it possible to compile it once to work will all future 2.x SFML versions? I wanted to publish an executable for download and it seems I'd have to update it once in a while.

I define linking to SFML in CMakeLists.txt as follows:
find_package(SFML 2 REQUIRED audio graphics window system)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} sfml-audio sfml-graphics sfml-window sfml-system)
 

If what I'm asking for is not possible or sounds dumb to you, please explain; I'm not proficient in libraries/linking etc. I wouldn't want to link it statically. Bundling *.so files seems suboptimal to me, but maybe it is a proper way? That's what I do on Windows with dlls.
« Last Edit: June 26, 2019, 03:50:25 pm by Dipper »

FRex

  • Hero Member
  • *****
  • Posts: 1843
    • View Profile
    • My GitHub Page
    • Email
Re: Link executable to work with all 2.x SFML libs
« Reply #1 on: July 21, 2019, 06:49:43 am »
I've seen app before bundle all needed files and use 'LD_LIBRARY_PATH' (see .wrapper script in these trial Linux versions): https://www.iforce2d.net/rube/#

There's also things like FlatPack and AppImage but I only ever heard of them as solution to this Linux distribution problem.

And SFML in repos is often out of date. :/
ZipSavings, script to count rar/7z/zip savings: https://goo.gl/vvBj5M
LuaConsole: https://goo.gl/X4kRUk
FoxRaycaster: https://goo.gl/27nVS8
Small Games - Heart, Routing and Snek: https://goo.gl/15ZGWE https://goo.gl/k5gwWD https://goo.gl/4nKPnT
Botes - a notes app in Pascal: https://goo.gl/bzTqsi