SDL and friends static linking

Hello all,

One of the goals of my project(http://www.egengine.com) is to reduce the
number of libraries the user needs to install or have in order for him/her
to play a game developed with my engine. Pretty much what I’m trying to do
is to allow someone to link against my engine and not need any other
library. My engine is open source so I think I can static link against SDL,
SDL_Image etc. My question is, if I build SDL and specify to build a static
library will I still need to link against the libraries SDL depends on?–
Rogelio Nodal

sorry, this is not an answer to your question about static linking.

if the library is lisenced lgpl, where is the source code?

i suppose if this were run on windows, or mac maybe this might be useful.
but why remove the option from the user? they would be using your
library anyway, let them choose to compile statically.

most linux or unix distros will handle dependencies without a problem.

mattOn Tue, 16 Sep 2008, Rogelio Nodal wrote:

Hello all,

One of the goals of my project(http://www.egengine.com) is to reduce the
number of libraries the user needs to install or have in order for him/her
to play a game developed with my engine. Pretty much what I’m trying to do
is to allow someone to link against my engine and not need any other
library. My engine is open source so I think I can static link against SDL,
SDL_Image etc. My question is, if I build SDL and specify to build a static
library will I still need to link against the libraries SDL depends on?


Rogelio Nodal

http://sourceforge.net/projects/easyge/ I’m sorry about that. I have been
working on the website since I’m moving it to a new server and in the
process I erase the link to the source code. A better link will also be
http://easyge.svn.sourceforge.net/viewvc/easyge/ . As for your last
question, I’m trying to accomplished what is possible in windows, which is
to have the game in a folder and the user can play the game. What if the
user does not have a root account but still wants to play the game?On Wed, Sep 17, 2008 at 1:49 AM, wrote:

sorry, this is not an answer to your question about static linking.

if the library is lisenced lgpl, where is the source code?

i suppose if this were run on windows, or mac maybe this might be useful.
but why remove the option from the user? they would be using your library
anyway, let them choose to compile statically.

most linux or unix distros will handle dependencies without a problem.

matt

On Tue, 16 Sep 2008, Rogelio Nodal wrote:

Hello all,

One of the goals of my project(http://www.egengine.com) is to reduce the
number of libraries the user needs to install or have in order for him/her
to play a game developed with my engine. Pretty much what I’m trying to do
is to allow someone to link against my engine and not need any other
library. My engine is open source so I think I can static link against
SDL,
SDL_Image etc. My question is, if I build SDL and specify to build a
static
library will I still need to link against the libraries SDL depends on?


Rogelio Nodal


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Rogelio Nodal

Then the user can install the game to $HOME. Games do not have to be installed
in /usr/share/games. The only downside when installing to $HOME is that other
users (typically) cannot play the game.

AlvinOn Wednesday 17 September 2008 08:47:42 Rogelio Nodal wrote:

What if the
user does not have a root account but still wants to play the game?

That is not what I meant. What I meant is that If I don’t link statically
then the user needs to install whatever library my engine depends on and If
he/she has not root access then they will not be able to install those
libraries or will have to build the library themselves and install it in
their home directory. I’m sorry but in terms of playing a game that just
seems way to much.On Wed, Sep 17, 2008 at 8:22 AM, Alvin wrote:

On Wednesday 17 September 2008 08:47:42 Rogelio Nodal wrote:

What if the
user does not have a root account but still wants to play the game?

Then the user can install the game to $HOME. Games do not have to be
installed
in /usr/share/games. The only downside when installing to $HOME is that
other
users (typically) cannot play the game.

Alvin


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Rogelio Nodal

That is not what I meant. What I meant is that If I don’t link statically
then the user needs to install whatever library my engine depends on and If
he/she has not root access then they will not be able to install those
libraries or will have to build the library themselves and install it in
their home directory. I’m sorry but in terms of playing a game that just
seems way to much.

Static link is a bad idea anyway, you’ll end to have all the dependencies of
the library you static link to, except if you static link everything, but
this is not possible for instance if you want to use accelerated OpenGL.

I suggest you to ship your shared libraries in the game installation path
and limit the dependency to libc, libdl, X11, alsa, libGL and nothing else.
You can load shared libraries from a custom location setting rpath in the
link stage to point to the directory where you place your libraries.

You cannot be sure that the distro has the libraries you need since the
distro may be too hold to have the correct version or too new (and have only
a newer incompatible version).

For a detailed description of deployment problem and solutions look at the
developer section of http://autopackage.org

You don’t need to package your game with autopackage, but you can use some
very useful autopackage components: binreloc, apgcc

On OSX and Win32 it’s simpler cause you can ship your frameworks inside the
application bundle (osx) and your support DLL in the binary path (win).On Wed, Sep 17, 2008 at 2:31 PM, Rogelio Nodal wrote:


Ing. Gabriele Greco, DARTS Engineering
Tel: +39-0105761240 Fax: +39-0105760224
s-mail: Via G.T. Invrea 14 - 16129 GENOVA (ITALY)

Interesting. I read about “-rpath” in “man ld”, but just to be absolutely
clear, is it saying that if I add “-rpath /path/to/install/dir” at compile
time, then when the app is run, it will check /path/to/install/dir for
the .so first (assuming not using dlopen and family)? If so, that is very
cool. I did not know that. Thanks.

AlvinOn Wednesday 17 September 2008 10:15:34 Gabriele Greco wrote:

You can load shared libraries from a custom location setting rpath in the
link stage to point to the directory where you place your libraries.

That is not what I meant. What I meant is that If I don’t link statically
then the user needs to install whatever library my engine depends on and If
he/she has not root access then they will not be able to install those
libraries or will have to build the library themselves and install it in
their home directory. I’m sorry but in terms of playing a game that just
seems way to much.

Static link is a bad idea anyway, you’ll end to have all the dependencies
of the library you static link to, except if you static link everything, but
this is not possible for instance if you want to use accelerated OpenGL.

I suggest you to ship your shared libraries in the game installation path
and limit the dependency to libc, libdl, X11, alsa, libGL and nothing else.
You can load shared libraries from a custom location setting rpath in the
link stage to point to the directory where you place your libraries.

You cannot be sure that the distro has the libraries you need since the
distro may be too hold to have the correct version or too new (and have only
a newer incompatible version).

For a detailed description of deployment problem and solutions look at the
developer section of http://autopackage.org

You don’t need to package your game with autopackage, but you can use some
very useful autopackage components: binreloc, apgcc

On OSX and Win32 it’s simpler cause you can ship your frameworks inside the
application bundle (osx) and your support DLL in the binary path (win).


Ing. Gabriele Greco, DARTS Engineering
Tel: +39-0105761240 Fax: +39-0105760224
s-mail: Via G.T. Invrea 14 - 16129 GENOVA (ITALY)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

That is what I want to do. I want to reduce the dependency to only those
things. That’s why I asked if I build, let’s say, SDL_Image statically, will
libpng, libjpge etc get linked into SDL_Image or I still need to link my
engine against libpng etc. Since my engine depends on GL, SDL, SDL_Image,
SDL_Mixer and want the developer that uses my engine to only having to link
against my engine library and not against another 3 or more libraries.On Wed, Sep 17, 2008 at 9:15 AM, Gabriele Greco <gabriele.greco at darts.it>wrote:

On Wed, Sep 17, 2008 at 2:31 PM, Rogelio Nodal <@Rogelio_Nodal> wrote:


Rogelio Nodal

As far as I know, as you build SDL_image statically, you’ll need to link those other libs to it. Thus, the static lib will include all the necessary code from those libraries. When you link that static lib into your project, you won’t need anything else.Jonny DDate: Wed, 17 Sep 2008 11:30:10 -0400From: rnodal at gmail.comTo: sdl at lists.libsdl.orgSubject: Re: [SDL] SDL and friends static linking. OTOn Wed, Sep 17, 2008 at 9:15 AM, Gabriele Greco <gabriele.greco at darts.it> wrote:On Wed, Sep 17, 2008 at 2:31 PM, Rogelio Nodal wrote:

That is not what I meant. What I meant is that If I don’t link statically then the user needs to install whatever library my engine depends on and If he/she has not root access then they will not be able to install those libraries or will have to build the library themselves and install it in their home directory. I’m sorry but in terms of playing a game that just seems way to much.

Static link is a bad idea anyway, you’ll end to have all the dependencies of the library you static link to, except if you static link everything, but this is not possible for instance if you want to use accelerated OpenGL.

I suggest you to ship your shared libraries in the game installation path and limit the dependency to libc, libdl, X11, alsa, libGL and nothing else. You can load shared libraries from a custom location setting rpath in the link stage to point to the directory where you place your libraries.

You cannot be sure that the distro has the libraries you need since the distro may be too hold to have the correct version or too new (and have only a newer incompatible version).For a detailed description of deployment problem and solutions look at the developer section of http://autopackage.org

You don’t need to package your game with autopackage, but you can use some very useful autopackage components: binreloc, apgcc On OSX and Win32 it’s simpler cause you can ship your frameworks inside the application bundle (osx) and your support DLL in the binary path (win).

– Ing. Gabriele Greco, DARTS EngineeringTel: +39-0105761240 Fax: +39-0105760224s-mail: Via G.T. Invrea 14 - 16129 GENOVA (ITALY)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
That is what I want to do. I want to reduce the dependency to only those things. That’s why I asked if I build, let’s say, SDL_Image statically, will libpng, libjpge etc get linked into SDL_Image or I still need to link my engine against libpng etc. Since my engine depends on GL, SDL, SDL_Image, SDL_Mixer and want the developer that uses my engine to only having to link against my engine library and not against another 3 or more libraries.
– Rogelio Nodal


See how Windows connects the people, information, and fun that are part of your life.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/

As far as I know, as you build SDL_image statically, you’ll need to link
those other libs to it. Thus, the static lib will include all the necessary
code from those libraries. When you link that static lib into your project,
you won’t need anything else.

Jonny D

Standard disclaimer about excessive static linking and licensing issues. If
one of the nested libraries is GPL, you have to be GPL.

-WillOn Wed, Sep 17, 2008 at 10:53 AM, Jonathan Dearborn wrote:

Alvin wrote:

Interesting. I read about “-rpath” in “man ld”, but just to be
absolutely clear, is it saying that if I add
"-rpath /path/to/install/dir" at compile time, then when the app is
run, it will check /path/to/install/dir for the .so first (assuming
not using dlopen and family)?

exactly that.

Sorry, but

This:On Wed, Sep 17, 2008 at 14:56 -0500, Will Langford wrote:

Standard disclaimer about excessive static linking and licensing issues. If
one of the nested libraries is GPL, you have to be GPL.

is Wrong.

If you have an alternate download with a dynamically linked version this
would be enough to satisfy the licence.

But for windows this point is moot anyway, there have been many threads
about it here, but I have not seen anyone successfully producing a
statically linked game yet.

CU,
Sec

Well, it also presumes that “!” returns literally 0 and 1. I’ve
never seen a promise of that in any docs.
I think Perl6 should return “42” for true, just to keep people
from making that presumption. – Randal L. Schwartz

How about the fact the I’m releasing the source code? Would that also
satisfy the license?On Sun, Sep 21, 2008 at 5:36 PM, Stefan Sec Zehl < stefan.zehl at sdl.sec.42.org> wrote:

Sorry, but

This:

On Wed, Sep 17, 2008 at 14:56 -0500, Will Langford wrote:

Standard disclaimer about excessive static linking and licensing issues.
If
one of the nested libraries is GPL, you have to be GPL.

is Wrong.

If you have an alternate download with a dynamically linked version this
would be enough to satisfy the licence.

But for windows this point is moot anyway, there have been many threads
about it here, but I have not seen anyone successfully producing a
statically linked game yet.

CU,
Sec

Well, it also presumes that “!” returns literally 0 and 1. I’ve
never seen a promise of that in any docs.
I think Perl6 should return “42” for true, just to keep people
from making that presumption. – Randal L. Schwartz


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Rogelio Nodal

Sorry, but

This:

Standard disclaimer about excessive static linking and licensing
issues. If
one of the nested libraries is GPL, you have to be GPL.
is Wrong.

If you have an alternate download with a dynamically linked version this
would be enough to satisfy the licence.

But for windows this point is moot anyway, there have been many threads
about it here, but I have not seen anyone successfully producing a
statically linked game yet.

CU,
Sec

Hmm? You have never seen a game that ships with everything statically
linked on windows?On 9/21/08, Stefan Sec Zehl <stefan.zehl at sdl.sec.42.org> wrote:

On Wed, Sep 17, 2008 at 14:56 -0500, Will Langford wrote:

“Rogelio Nodal” wrote:

How about the fact the I’m releasing the source code? Would that also
satisfy the license?

of course!

clemens

“Rogelio Nodal” wrote:

How about the fact the I’m releasing the source code? Would that also
satisfy the license?

of course!

clemens

Mostly. Depends on the license in which you release the source :).

-WillOn Mon, Sep 22, 2008 at 1:24 PM, Clemens Kirchgatterer <clemens at 1541.org>wrote:

Sorry, but

This:

Standard disclaimer about excessive static linking and licensing issues.
If
one of the nested libraries is GPL, you have to be GPL.

is Wrong.

If you have an alternate download with a dynamically linked version this
would be enough to satisfy the licence.

I disagree. When you link to a program, you’re making use of it or
integrating it. As such, you’re loosely classified as derivative or
similar. If you’re going to link against a GPL project, you have to have a
GPL compatible license. There’s a modified GPL license used by apparently
several projects that negates this requirement. If one of the nested
libraries employed is GPL, then anything else that can trace usage back to
it needs to be GPL.

-WillOn Sun, Sep 21, 2008 at 4:36 PM, Stefan Sec Zehl < stefan.zehl at sdl.sec.42.org> wrote:

On Wed, Sep 17, 2008 at 14:56 -0500, Will Langford wrote:

No, is Right. You’re thinking of the LGPL. The GNU C library has a special
exception to the GPL allowing linking with it. The standard GPL requires that
all linked code also be under the GPL or equivalent license, regardless of how
it’s linked. It’s a very restrictive license that’s really only useful for
completely open source projects that only use open source code and only allow
themselves to be used in open source code. It’s viral that way. :slight_smile:

See ya!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment> On Wed, Sep 17, 2008 at 14:56 -0500, Will Langford wrote:

Standard disclaimer about excessive static linking and licensing issues. If
one of the nested libraries is GPL, you have to be GPL.

is Wrong.

If you have an alternate download with a dynamically linked version this
would be enough to satisfy the licence.

“Will Langford” wrote:

of course!

Mostly. Depends on the license in which you release the source :).

man, usually it’s me who is nitpicking! :-))

but you’re right, though. thx for setting me straight.

clemens

I would like to release the source code under the same license as SDL which
I believe is LGPL.On Tue, Sep 23, 2008 at 1:43 PM, Clemens Kirchgatterer <clemens at 1541.org>wrote:

“Will Langford” wrote:

of course!

Mostly. Depends on the license in which you release the source :).

man, usually it’s me who is nitpicking! :-))

but you’re right, though. thx for setting me straight.

clemens


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Rogelio Nodal