[SDL] Re : statically linking

azer tyuiop gl_disturbedid at yahoo.fr
Thu Dec 2 01:44:20 PST 2010


Well I tried, it made things advance. Now I get many undefined references to 
other libs, like png, jpeg (exemple at the end) etc. 

I used the additional links that I found here : 
http://stackoverflow.com/questions/115813/how-to-statically-compile-an-sdl-game-on-windows


My LDFLAGS is no : 
LDFLAGS      = -Wl,-Bstatic -lSDL_image `sdl-config --cflags --static-libs` 
-Wl,-Bdynamic `directfb-config --libs` -lpng12 -ltiff -ljpeg -lasound -laudio 
-lesd -lpulse-simple -lcaca -laa -ldl
 
Now, I have nearly only a problem with pulse audio. When I don't use the 
-lpulse-simple lib I get errors like this :
/usr/lib/libSDL.a(SDL_pulseaudio.o): In function `PULSE_CloseAudio':
(.text+0x14e): undefined reference to `pa_simple_drain'

And when I add -lpulse, or -lpulse-simple, it do not find it.
/usr/bin/ld: cannot find -lpulse-simple

But I checked and I do have libpulse ad libpulse-simple in /usr/lib. What can I 
do?
Thx for the help.

/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':
(.text+0x12): undefined reference to `jpeg_calc_output_dimensions'
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':
(.text+0x1c): undefined reference to `jpeg_CreateDecompress'
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':
(.text+0x26): undefined reference to `jpeg_destroy_decompress'
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':
(.text+0x30): undefined reference to `jpeg_finish_decompress'
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':
(.text+0x3a): undefined reference to `jpeg_read_header'
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':
(.text+0x44): undefined reference to `jpeg_read_scanlines'
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':
(.text+0x4e): undefined reference to `jpeg_resync_to_restart'
/usr/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':





________________________________
De : Mikael Eriksson <mikael_eriksson at miffe.org>
À : sdl at lists.libsdl.org
Envoyé le : Jeu 2 décembre 2010, 5h 03min 27s
Objet : Re: [SDL] statically linking

On Wed, Dec 01, 2010 at 03:53:32PM +0000, azer tyuiop wrote:
> $(TARGET): $(OBJ)
>     $(CC) $(LDFLAGS) -o $@ $^

IIRC the order is important when staticly linking, try:
$(TARGET): $(OBJ)
    $(CC) -o $@ $^ $(LDFLAGS)
_______________________________________________
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20101202/acaaabb5/attachment-0008.htm>


More information about the SDL mailing list