SFML community forums

Help => General => Topic started by: Dipper on June 26, 2019, 03:39:04 pm

Title: Link executable to work with all 2.x SFML libs
Post by: Dipper 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)
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.
Title: Re: Link executable to work with all 2.x SFML libs
Post by: FRex 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. :/