Oguz Akyuz wrote:
> Hello,
>
> I would like to distribute my application and therefore I would like
> to create a statically linked executable (to the extent possible)
> to minimize dependency problems.
>
> I'm able to link everything statically except -X11 and -lpthread.
> Trying to statically link these is causing me serious headache.
Like you, I don't usually statically link those. These are libs that
end users are likely to have on their systems, so they should be there.
For linux, the only libs I link statically are the fltk libs,
eg. libfltk.a, libfltk_png.a, libfltk_jpeg.a, etc.
Sometimes I'll include libstdc++.so.# with the binary, so that
if the end user doesn't have the right one, it can be installed
to make the app work.
> Based on the expertise of the people who distributed their applications
> before does this sound good enough?
It sounds OK to me.
I've been releasing distros for linux for the last decade and
that's been working for me. My end users have a variety of linux
platforms that go all over the map, from redhat7.3 on to the latest.
> Perhaps a more general question -- am I following the right way by trying
> to statically link everything or is there a better way?
Seems OK to me.
Under linux, when there's libs I want to statically link,
I just specify the absolute path to the .a files, and those
get statically linked. I don't use any special flags.
So an actual production link command on fedora3:
g++ myapp.o \
/path/to/fltk/libfltk_images.a \
/path/to/fltk/libfltk.a \
/path/to/fltk/libfltk_png.a \
/path/to/fltk/libfltk_jpeg.a \
/path/to/fltk/libfltk_z.a \
-L/usr/X11R6/lib -lXext -lXft -lfontconfig -lpthread -ldl -lm -lX11 -o
myapp
In some cases I include .so's as part of the distro.. I think
the only one I've ever needed was libstdc++.so.#
When you statically link libs, the concern is with is the ABI..
is the code you've statically linked compatible with the end user's
operating system calls, whose arguments might change during big
kernel releases, or X windows releases. Often there are complaints
about the GCC versions being different.
In such cases I release separate binaries, compiling on a platform
that is compatible with the most end user target platforms possible,
which I find by research, and by empirical tests. To test, I have a
slew of removable drives, each with different OS install, and I test
on each to watch for errors.
Sometimes end users will run my apps on newer OS's I didn't have
at the time of testing for that release, and often it still works
fine. When it doesn't I make a separate build for that platform.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk