SFML community forums

Help => General => Topic started by: BadJoker on August 04, 2017, 01:53:19 pm

Title: Linux and static linkage
Post by: BadJoker on August 04, 2017, 01:53:19 pm
Hi, I installed sfml with apt-get (2.3.2 ) and downloaded the 2.4.2. I developed the game dynamically but now i need to send the project to the professor and I want to make it static.
I followed the instruction for making the package static but I can compileI get THIS ERROR IN BOTH CASES (2.3 and 2.4) :

badjoker@theuniversity ~/Dropbox/PROJECTS/JappDefence $ g++ Main.o Constants.o AssetManager.o Gui.o GameBuild.o GameLoop.o PathFinder.o -o JappDefence -D SFML_STATIC -L/home/Dropbox/PROJECTS/SFML-2.4.2/lib -lsfml-graphics-s -lsfml-window-s -lsfml-system-s
/usr/bin/ld: cannot find -lsfml-graphics-s
/usr/bin/ld: cannot find -lsfml-window-s
/usr/bin/ld: cannot find -lsfml-system-s
collect2: error: ld returned 1 exit status

Can someone help ?

Regard
Title: Re: Linux and static linkage
Post by: Laurent on August 04, 2017, 02:19:48 pm
The linker cannot find these files because they don't exist. Static libraries are not provided by default on Linux, you have to build them yourself.

There's a good reason for that: static libraries are not the recommended way to distribute software on Linux. Even if SFML is linked statically to your executable, your users will still need its dependencies; you're just moving the "problem". You'd better ask your users to install SFML from the repositories, just like you did.
Title: Re: Linux and static linkage
Post by: BadJoker on August 04, 2017, 02:37:53 pm
The professor told us there are no problem if he has to download libraries ! so I'll be keep it dynamic! thanks you for the reply !