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

Author Topic: Linux and static linkage  (Read 1093 times)

0 Members and 1 Guest are viewing this topic.

BadJoker

  • Newbie
  • *
  • Posts: 4
    • View Profile
Linux and static linkage
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Linux and static linkage
« Reply #1 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.
Laurent Gomila - SFML developer

BadJoker

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Linux and static linkage
« Reply #2 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 !