[SDL] libsdl static compiling under linux

Sylvain Beucler beuc at beuc.net
Fri Oct 19 05:35:45 PDT 2007


On Fri, Oct 19, 2007 at 12:32:50PM +0200, mario wrote:
> On 10/19/07, cocobear <cocobear.cn at gmail.com> wrote:
> > > short and simply question: which is the correct way to statically
> > > compile libsd inside my application under Linux?
> 
> > I don't think it's a good idea, SDL library still needs other, will you
> > complie this libraries in your application.
> 
> yes.. I know.
> and I know that SDL needs a lot of other .so
> that is the problem: I don't know how to statically compile all of them.
> I should list on the compile line all the -Xlib --phtheads -lalsa
> -lframebuffer blablabla
> I was looking for a simpler way.
> 
> The goal was to (g)profile my game.
> gprof can't profile shared library: so I need a static application.
> 
> Now I'm looking if is there another better profiler (under linux).
> Tnx

I'm statically compiling with the SDL Debian package using:
  LIBS="-Wl,-Bstatic \
    -lSDL \
    -lvga -ldirectfb -ldirect -lfusion \
    -lcaca -lcucul -laa -lslang -lcurses \
    -laudio -lesd -lartsc -lasound -lgpm \
    -lm \
    -Wl,-Bdynamic -lX11 -ldl -lpthread -lstdc++"

I could not statically compile the last libraries (X11, dl, etc.), I
had to left them as dynamic.  You may need less libraries if you're
using your own SDL (with fewer backends enabled).

I think --static-libs should include that, alas this is not the case.

-- 
Sylvain
Ref: http://git.sv.gnu.org/gitweb/?p=freedink.git;a=blob;f=doc/static-build.txt;h=aa464b4f6768b430268d56cc6f344a57568680eb


More information about the SDL mailing list