Both static and dynamic builds are enabled by default when you use
configure. You can force it with the --enable-static option to
configure, shouldn’t be necessary though. (Run ./configure --help to get
a list of all the options you can use. There’s a lot!)
“make install” installs everything you need to use SDL to… some
location. It defaults to /usr/local (on linux, anyway), but you can
change that with the --prefix option to configure. Like this:
./configure --prefix=/path/you/want
It doesn’t really matter what path you choose, just pick somewhere
that’s convenient for you =). Use the installed bin/sdl2-config script
to get options for the compiler/linker when using SDL in your programs
(symlink sdl2-config to a dir in your path for extra convenience, if it
isn’t already). Pass it --cflags to get include path and such, --libs
for dynamic libs, and… in theory, --static-libs for static ones,
although that doesn’t seem to actually do the right thing now that I
look at it, unless you already link everything statically, which you
probably don’t want. You can just add ‘/path-you-chose/lib/libSDL2.a’ to
your link line though.
Btw, if you’re building executables for distribution, you probably want
to disable embedding the local SDL’s rpath in your executable (rpath
adds to the runtime linker’s default library search path). It’s set by
sdl2-config’s --libs and --static-libs by default. Disable that with
–disable-rpath to configure (or just edit the installed sdl2-config).
rpath is useful when testing dynamically linked builds locally, but for
distribution you’ll want to customize that so it finds your
also-distributed libs (either via rpath or LD_LIBRARY_PATH)
Also, it can be useful to run configure from a different directory than
the one it resides in. Make a build directory for it: mkdir build; cd
build; …/configure [options]. It keeps generated files contained, makes
it possible to keep multiple builds around, etc. You’ll have to copy the
test dir to your build dir if you want the tests to work though.
-g
Den 16. des. 2013 00:38, skrev rainwarrior:> I can produce and use static libraries for SDL2 on Windows, but I am
unsure how to produce static libraries on linux or MacOSX. Is there
an argument for configure or make that will build the static
libraries?
The cmake alternative appears to produce a static library on linux,
but it comes with a warning that it is experimental. I am also
unclear about debug vs. release configurations with this option, as
only one libSDL2.a is produced.
Please forgive if there is a standard/easy way to do these things on
linux that I am unaware of. I am not an advanced linux user. I have
tried to find descriptions of these things in the readme files and
wiki but was unable.
Also, I should ask what does “make install” do? I am a bit leery of
something that may make this SDL build part of the system rather than
something I am simply statically linking in.
_______________________________________________ SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org