compile static

Frank Schafer frank.schafer@setuza.cz
Wed Feb 20 01:35:00 GMT 2002


n Tue, 2002-02-19 at 00:31, feketga wrote:
> Hi!
> 
> I want to compile a C program which uses libSDL as not to use
> libSDL calls (want to make it static).
> I tried this :
> gcc  `sdl-config --static-libs --cflags` /usr/lib/libSDL.so \
> /usr/lib/libSDL.a hilbert.c -o hilbert
> 
> it compiles without any error
> but it doesn't work as I suggest.
> `ldd ./hilbert` shows that it still uses libSDL
> 
> `sdl-config --static-libs --cflags` evaluates to :
> 
> -L/usr/lib -lSDL -lpthread -lm -L/usr/X11R6/lib -lX11 -lXext -ldl
> -L/usr/X11R6/lib -lXxf86dga -lXxf86vm -lXv
> -I/usr/include/SDL -D_REENTRANT
> 
> Please help!
> I have to take the binary executable onto a nother machine which may not
> have SDL installed.
> 
> 
Try 
gcc -static `sdl-config --static-libs --cflags` \
	/usr/lib/libSDL.a hilbert.c -o hilbert

Hope this works
Frank



More information about the Gcc-help mailing list