For a couple of months now I’ve been distributing a front-end to xmame that I
wrote under the GPL. This front-end heavily uses the different SDL libraries.
As some people have complained about having trouble getting all the right
libraries installed I was wondering how I’d go about creating a statically
linked executable to distribute. Which g++ options should I be using, and
under what license would such a program be distributable?
was wondering how I’d go
about creating a statically linked executable to distribute. Which g++
options should I be using, and under what license would such a program
be distributable?
just add the -static option before libs that you want to link
statically, when calling g++.
there is no problem with the license as long as the source stays
available (read GPL). for binary only programms you have to provide the
object files, when linking statically against LGPL code.
Pieter HulshoffOn Saturday 13 December 2003 11:17, Clemens Kirchgatterer wrote:
Pieter Hulshoff wrote:
was wondering how I’d go
about creating a statically linked executable to distribute. Which g++
options should I be using, and under what license would such a program
be distributable?
just add the -static option before libs that you want to link
statically, when calling g++.
Perhaps you could try this:
g++ classes.o fileio.o gui.o io.o mamed.o -o mamed sdl-config --static-libs --cflags --libs -lSDL_mixer -lSDL_image -lSDL_ttf
I tried it with -static (for the SDL_mixer, SDL_image and SDL_ttf libs),
but I also get undefined references. Maybe this is already linked
statically somehow by sdl-config, but I doubt it… Well, at least SDL
itself works that way
Bernhard
Pieter Hulshoff wrote:> On Saturday 13 December 2003 11:17, Clemens Kirchgatterer wrote:
Pieter Hulshoff wrote:
was wondering how I’d go
about creating a statically linked executable to distribute. Which g++
options should I be using, and under what license would such a program
be distributable?
just add the -static option before libs that you want to link
statically, when calling g++.
I get a ton of ‘undefined reference’ messages to many SDL functions (even
SDL_init).
Hmm, it compiles, but how can I tell if it’s actually statically linked? ldd
mamed gives me (among other libraries):
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x40015000)
libSDL_mixer-1.2.so.0 => /usr/lib/libSDL_mixer-1.2.so.0 (0x402d7000)
libSDL_image-1.2.so.0 => /usr/lib/libSDL_image-1.2.so.0 (0x40316000)
libSDL_ttf-2.0.so.0 => /usr/lib/libSDL_ttf-2.0.so.0 (0x4032f000)
which seems to indicate to me that it didn’t link statically. Any thoughts?
Regards,
Pieter HulshoffOn Sunday 14 December 2003 10:23, Bernhard Bliem wrote:
Also add the -static option, and you’ll have to add lots of libraries
to fulfill the linker requirements. Offhand, you’ll need freetype,
zlib, libpng, libjpeg, and probably others depending on the options
the SDL libraries were built with.
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment> On Sunday 14 December 2003 10:23, Bernhard Bliem wrote:
Hmm, it compiles, but how can I tell if it’s actually statically linked? ldd
mamed gives me (among other libraries):
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x40015000)
libSDL_mixer-1.2.so.0 => /usr/lib/libSDL_mixer-1.2.so.0 (0x402d7000)
libSDL_image-1.2.so.0 => /usr/lib/libSDL_image-1.2.so.0 (0x40316000)
libSDL_ttf-2.0.so.0 => /usr/lib/libSDL_ttf-2.0.so.0 (0x4032f000)
which seems to indicate to me that it didn’t link statically. Any thoughts?