Statically Link the SDL library

I’m have an object file that I’m creating which is going to be used as a
plugin for another application. The object file that I’m creating uses some
SDL functions and I would like to link it statically. Before I was linking
dynamically by the use of dlopen() and dlsym(). I have added the following
to lines to my homegrown makefile

SDL_CFLAGS := $(shell sdl-config --cflags)
SDL_LDFLAGS := $(shell sdl-config --libs)

here is the output of those two commands:

sdl-config --cflags : -I/usr/include/SDL -D_REENTRANT
sdl-config --libs : -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread

I’m running RH, kernel 2.4.7-10. I installed SDL from the .rpm.

It seems that my library file is not much bigger after I added these two
lines. I thought it would be significantly bigger since I’m now including
the SDL functions in my library. Is there something that I’m missing?

Regrads,
Tim

sdl-config --cflags : -I/usr/include/SDL -D_REENTRANT
sdl-config --libs : -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread

You’re linking against the shared library…effectively, you’ve got the
same thing as before, except it’s doing the dlopen() and dlsym() work
for you.

Make sure you aren’t violating the LGPL license, then link against
/usr/lib/libSDL.a.

–ryan.

sdl-config --cflags : -I/usr/include/SDL -D_REENTRANT
sdl-config --libs : -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread

You’re linking against the shared library…effectively, you’ve got the
same thing as before, except it’s doing the dlopen() and dlsym() work
for you.

Make sure you aren’t violating the LGPL license, then link against
/usr/lib/libSDL.a.

–ryan.

I’ll check the license, and how do I link against /usr/lib/libSDL.a ???_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Use:

sdl-config --cflags (same)
sdl-config --static-libs (instead of --libs)

-MarkOn Tue, 23 Dec 2003, Tim Preager wrote:

sdl-config --cflags : -I/usr/include/SDL -D_REENTRANT
sdl-config --libs : -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread

You’re linking against the shared library…effectively, you’ve got the
same thing as before, except it’s doing the dlopen() and dlsym() work
for you.

Make sure you aren’t violating the LGPL license, then link against
/usr/lib/libSDL.a.

–ryan.

I’ll check the license, and how do I link against /usr/lib/libSDL.a ???


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Mark K. Kim
AIM: markus kimius
Homepage: http://www.cbreak.org/
Xanga: http://www.xanga.com/vindaci
Friendster: http://www.friendster.com/user.jsp?id=13046
PGP key fingerprint: 7324 BACA 53AD E504 A76E 5167 6822 94F0 F298 5DCE
PGP key available on the homepage