The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Static linking
fruttenboel


Joined: 07 Apr 2014
Posts: 1
Location: Tilburg, NL
Hi,

Is there a way to statically link a program that uses SDL or SDL2? I tried with gcc -static but that failed.

I use Slackware Linux. I have both SDL 1.2.14 and SDL 2.2

I need the statically linked executable in order to make a FOREIGN MODULE for the Mocka Modula-2 compiler.
Nathaniel J Fries


Joined: 30 Mar 2010
Posts: 444
when I build SDL2 with msys, there are two libraries built: one is libSDL2.dll.a, the other is libSDL2.a
libSDL2.dll.a is the import library for SDL2.dll
libSDL2.a is the static linking library

maybe it is different on linux. Try ./configure --enable-static=yes --enable-shared=no