> If I compile my app (mads.cxx) with fltk-config it works fine and
> generates this as the full-length command which I can save into a
> script...
> g++ -I/usr/local/include -I/usr/local/include/FL/images
> -I/usr/include/freetype2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT -o 'mads' 'mads.cxx'
> /usr/local/lib/libfltk.a -lXcursor -lXfixes -lXext -lXft -lfontconfig
> -lXinerama -lpthread -ldl -lm -lX11
> ...but I am struggling to get this to accept a '-static' option so as to
> make a nice big transportable executable. Its not worth showing you the
> errors I am getting, I just need to know roughly where I should stick in
> the static command. I did work it out for MinGW, but my current problem
> relates to linux.
So... Why do you think you need the "-static" option here? I'm interested in what things you want to link in static.
I'd suggest that linking flkt in static is probably a good idea, as many systems when your could might run, will not have the fltk .so's available.
But the other things in your list (all the X11 stuff, fontconfig, etc.) you *do not* want to link in static at all, in all likelihood, since your *must* use the local system versions on each machine you run on, or there will be "issues".
In particular the X11 drivers are closely tied to the kernel, so using the X11 binaries linked on one system may not "play" well on another system at all.
Further, it's pretty much a given that these "system" .so's *do* exist, so you can rely on them...
Upshot? To link in the fltk libs static, you don't need to use the "-static" option at all; all you (usually) need to do is give the fully resolved path to the .a version of the fltk libs:
i.e., if you say:
g++ <stuff> -lfltk -letc...
Then the linker will look for *something" to fulfil the "-lfltk" and if it finds even a hint of an .so it will prefer to link that.
However, if you explicitly say:
g++ <stuff> /path/to/my/libfltk.a -letc...
Then it will use the static libfltk, and "all will be well"...
You can get the necessary values from fltk-config:
fltk-config --ldstaticflags
Will show you what you need.
Selex ES Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************