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

Author Topic: Ubuntu: Link specific SFML 2 version  (Read 2304 times)

0 Members and 1 Guest are viewing this topic.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Ubuntu: Link specific SFML 2 version
« on: October 04, 2011, 10:29:17 pm »
Hi,

I'm trying to compile a project on Ubuntu, for this I use the newest SFML 2 revision. Since I want to make sure there are no version conflicts, I intend to ship the SFML .so libraries with my application. As far as I've experienced it, executables don't look first in their directory for dynamic libraries. And static linking seems not to be recommended on Linux, I would also have to link every library SFML uses.

How can I tell the executable to search in the current directory for dynamic libraries? I use Code::Blocks as IDE.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Ubuntu: Link specific SFML 2 version
« Reply #1 on: October 04, 2011, 10:39:37 pm »
You can run the game with a script that first sets the LD_LIBRARY_PATH environment variable to ".".

Or you can use rpath to include the relative path to the libraries directly into the executable. But I don't know exactly how it works, never used it before.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Ubuntu: Link specific SFML 2 version
« Reply #2 on: October 05, 2011, 06:50:28 pm »
Thanks! I first wrote a .sh script which set LD_LIBRARY_PATH, but I don't like this way because the script isn't directly executable from the Nautilus explorer, and it seems to require root rights.

Instead I used rpath, and added
Code: [Select]
-Wl,--rpath
-Wl,<path>
to the advanced linker options in Code::Blocks. A relative path works for me.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Silvah

  • Guest
Ubuntu: Link specific SFML 2 version
« Reply #3 on: October 08, 2011, 07:10:49 pm »
Quote from: "Nexus"
I first wrote a .sh script which set LD_LIBRARY_PATH, but I don't like this way because the script isn't directly executable from the Nautilus explorer, and it seems to require root rights.
Are you sure you made the script executable by changing the file rights? ;)

 

anything