Red Hat Bugzilla – Bug 500201
fltk doesn't support static linking
Last modified: 2009-06-02 10:38:19 EDT
Description of problem:
With fltk-devel, the configure-generated /usr/bin/fltk-config script seems incorrect.
fltk-config is in particular used when configuring other packages depending on FLTK to find out which library FLTK depends on.
Under RHEL 5.2, fltk-config returns the following
$ fltk-config --ldflags
-L/usr/local/lib -L/usr/lib64 -lfltk -lXft -lpthread -ldl -lm -lXext -lX11
This is what fltk-config returns under Fedora 10
$ fltk-config --ldflags
Looking at it in details, it appears the relevant lines in the fltk-config script have been manually commented out
# flags for C++ compiler:
#CFLAGS=" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT"
#CXXFLAGS="-I/usr/include/freetype2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT"
#LDLIBS="-lXft -lXinerama -lpthread -ldl -lm -lXext -lX11 "
These line should not be commented out I believe.
I am not aware of any other portable way (that I could put into a configure.in script for my own software) I could discover the flags and libraries FLTK was built against, and that I need to know if I compile something against FLTK.
Version-Release number of selected component (if applicable):
How reproducible: every time
Steps to Reproduce:
1. run fltk-config --ldflags
-lXft -lXinerama -lpthread -ldl -lm -lXext -lX11
bug is present in Fedora 9-11.
bug is absent in Fedora 7
Why, are you trying to link statically?
Here's some background on removing the extraneous stuff, bug #199656
Anyway, before you ask or comment, yes, the static linking case is fubar :),
The static libs would likely be omitted altogether here, except that the -config script has some hard-coded uses of it still, so breaks if they are absent.
Yes I usually link FLTK statically. The library is small and lightweight meant to be used that way. The idea is to produce portable GUI applications across distributions.
From the opening page of www.fltk.org
> FLTK is designed to be small and modular enough to be statically linked
Thanks for looking into this
Problem being is that every fltk-dependent library must also support static linking, which may or may not be the case in fedora. I'll check.
In the meantime, adjusting summary accordingly.
Static X libraries are not provided in Fedora. However they are very ABI stable. In fact glibc, even linked statically needs a somewhat recent kernel and should be more problematic than shared X libs -- as long as the compiler doesn't introduce binary incompatibilities.
When I asked for static X libs some time ago I was turned down, I could search for the bug number if you are interested.
I don't now about other libs.
I have this smallish image display application using FLTK which I ship to people. What I usually do is link statically as much as I can, eg libstdc++, tiff, png, jpg, imagemagick etc, but I leave X11 and glibc as dynamic. The resulting build is usually quite portable across distributions.
The upshot is that statically linking to FLTK is indeed useful, even if the whole build is mostly dynamic.
If all the libraries other than X and libc can be linked statically, then it seems to me that a static fltk (in a separate subpackage) should be provided.
But a static FLTK library is already provided. It's just the /usr/bin/fltk-config script that's broken.
Very easy to fix too: maintainers simply don't edit that file post installation. If there is a rational explanation for the editing out of the lines I gave in the original report I'd like to hear it :-)
Because the extra libs aren't needed, even in the static linking case (if libtool archives are included).
The only reason the static lib remains is because the fltk-config file is busted (even in the dynamic linking case) without it.
OK, let's back up a step. Can you give me a sample test program that fails to compile using the output of:
but *works* with
I think I've found a solution (for fltk anyway), to make
return something more sane.
Please test this build:
OK, this one should have a better chance of actually building:
Thanks for the new build, with the correct fltk-config --ldstaticflags output
I've only tried the prebuild fltk from the linked page (ie fltk-1.1.9-4.fc10, with associated devel and fluid packages)
This works fine for me, thanks !
Should I try building the fltk src package ?
Also, Fedora 11 suffers from the same problem, are you going to propagate this fix to that version too ?
Do you still need an example for comment #12 ?
The test programs shipping with fltk ought to do the trick I guess.
Building the new source RPM works at my end, with the desired results.
I included a bunch of other overdue fixes as well, so I plan on pushing an update pretty much everywhere (F9, F10, F11, EL4, EL5).
fltk-1.1.9-4.fc9 has been submitted as an update for Fedora 9.
fltk-1.1.9-4.fc10 has been submitted as an update for Fedora 10.
fltk-1.1.9-4.fc11 has been submitted as an update for Fedora 11.
fltk-1.1.9-4.fc10 has been pushed to the Fedora 10 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
su -c 'yum --enablerepo=updates-testing update fltk'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-4994
fltk-1.1.9-4.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.
fltk-1.1.9-4.fc10 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report.
fltk-1.1.9-4.fc11 has been pushed to the Fedora 11 stable repository. If problems still persist, please make note of it in this bug report.