SFML community forums

Help => General => Topic started by: santiaboy on November 21, 2013, 09:20:34 pm

Title: [Solved][Linux] linking statically some, dinamically others
Post by: santiaboy on November 21, 2013, 09:20:34 pm
Hey guys!

I made a game using SFML and I wanted to link statically some libraries so the user doesn't have to download anything but the game. This is for the Desura branch, so I can link some libraries dinamically and the Desura App will handle the rest.

I can link these dinamically: sfml, libfreetype6, libjpeg8, libglew1.5, libopenal. And opengl and xlib should be installed by default. So, that leaves me with pthread, xrandr and sndfile to link statically.

I was wondering it's better to link statically some, dinamically others? Everything statically? I think that linking everything statically has the advantage that I know there won't be any library issues. I am unsure on how to proceed, and I was wondering how do you commonly approach this, or better yet, if you uploaded anything to Desura how did you do it?
Title: Re: [Linux] linking statically some, dinamically others
Post by: FRex on November 21, 2013, 09:37:26 pm
A thing I seen R.U.B.E.(Qt based Box2D editor) and Don't Starve and Shadow Warrior Classis(games on Steam) do is ship all libs as .so, and then provide .sh script that sets LD_LIBRARY_PATH to right relative path(./bin/ or similar) and then runs the actual game so that it finds it's libs correctly(./game_exec or ./bin/game or similar). It's probably the easiest, nicest, and least troubling one.
Title: Re: [Linux] linking statically some, dinamically others
Post by: santiaboy on November 21, 2013, 09:45:26 pm
Ah yes, with the "export LD_LIBRARY_PATH=./lib && ./myGame". Are you saying that's better to provide the .so instead of telling the Desura app what dependencies to install?

Also, do you know if there's some trouble with including .so as regards to licensing?
Title: AW: [Linux] linking statically some, dinamically others
Post by: eXpl0it3r on November 22, 2013, 12:41:59 am
Kind of hard to really answer since probably no one really knows what the requirements are for Desura, plus what Desura can offer/guarantee.
Can you provide more info?

From a Linux perspective both static linking and shipping shared libraries is a bad idea, since it works against the philosophy of packet managers etc.

Mixing static and shared libs is mostly a bad idea though.
Title: Re: [Linux] linking statically some, dinamically others
Post by: santiaboy on November 22, 2013, 01:18:46 am
Thing is, in Desura you have a few dependencies to choose from, that will install alongside the game (think it like installing the c++ redistributable you need for playing a game). This is, so the player can install a game, and play it right away, without doing any 'sudo apt-get install X'.

However, upong further investigation, when you install Ubuntu 12.04 LTS, you install a lot of dependencies that SFML uses. You just need SFML (duh), openal and glew. You can choose those on Desura, so I don't need to link anything statically.

Marked as Solved