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

Author Topic: SFML on Linux - Shared Library versions  (Read 3089 times)

0 Members and 1 Guest are viewing this topic.

Cyragia

  • Newbie
  • *
  • Posts: 17
    • View Profile
SFML on Linux - Shared Library versions
« on: April 19, 2014, 08:22:14 pm »
Hello,
I'm trying to get the example program (http://www.sfml-dev.org/tutorials/2.1/start-linux.php) to compile and run on my linux box. I'm using ubuntu 13.10 btw.
I downloaded the precompiled shared libraries from here: http://www.sfml-dev.org/download/sfml/2.1/
I followed the tutorial, when I try to link my object file I get this error:
/usr/bin/ld: warning: libGLEW.so.1.5, needed by ./lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
./lib/libsfml-graphics.so: undefined reference to `__glewUniform1fARB'
./lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_shader_objects'
./lib/libsfml-graphics.so: undefined reference to `__glewGetObjectParameterivARB
and a whole bunch more undefined glew references
I know I have the most recent version of glew, so it's just a version mismatch. After looking around on this forum I saw Laurent told someone to just compile SFML on their own pc to get rid of all version mismatches.
He also suggested to not distribute the shared libs along with the program, but seeing as SFML2.1 hasn't yet been incorporated in the ubuntu packages I have no other choice.

Imagine this situation:
I want to create a program with SFML and distribute it, to be used on multiple ubuntu versions or even linux distros.

As stated above I'll have to distribute the shared SFML libs along with the program, but what about the shared glew, jpeg, xlib, ... libs ? If I were to recompile SFML on my system, won't that 'lock' the binary with the versions of those libs I had on my pc at that time ? for example, if I have version 1.8 of some library, and someone tries to run my program but only has version 1.5, will it still work ? And if I compile for version 1.5, will it work for version 1.8 ?

I hope my questions are clear.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SFML on Linux - Shared Library versions
« Reply #1 on: April 19, 2014, 08:38:15 pm »
Simplest solution (IMHO): ship all dependencies yourself on distros where the distro supplied version is not good enough.

Edit: this may be of interest: https://www.technovelty.org/linux/exploring-origin.html
« Last Edit: April 19, 2014, 09:22:55 pm by Jesper Juhl »

Cyragia

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: SFML on Linux - Shared Library versions
« Reply #2 on: April 20, 2014, 02:01:41 pm »
That seems to be how Steam games do it as well...
Would this mean I'd have to compile all of the SFML dependencies as well, or could I just grab them from somewhere ?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: SFML on Linux - Shared Library versions
« Reply #3 on: April 20, 2014, 03:02:11 pm »
I would compile SFML against the libraries your Linux box happens to have, then simply distribute those libraries with your game.  My experience was that using SFML's binaries on Linux is completely impractical because of these version mismatch problems, but compiling it from source was almost shockingly easy.  I never had to recompile any of the dependencies (once they were all installed), so you shouldn't have to either.

gop_t3r

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: SFML on Linux - Shared Library versions
« Reply #4 on: April 22, 2014, 05:40:36 am »
Ubuntu 14.04 has SFML 2.1 in its repositories. I suggest upgrading to spare the hassle; just make sure you link your libraries right. I use Code::Blocks btw.

 

anything