Bug 500201 - fltk doesn't support static linking
fltk doesn't support static linking
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: fltk (Show other bugs)
10
All Linux
low Severity medium
: ---
: ---
Assigned To: Rex Dieter
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-11 12:33 EDT by Hugues Talbot
Modified: 2009-06-02 10:38 EDT (History)
2 users (show)

See Also:
Fixed In Version: 1.1.9-4.fc10
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-06-02 10:34:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hugues Talbot 2009-05-11 12:33:16 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
-lfltk

Looking at it in details, it appears the relevant lines in the fltk-config script have been manually commented out

# flags for C++ compiler:
ARCHFLAGS=""
#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"
#LDFLAGS=" "
#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):

fltk-devel-1.1.9

How reproducible: every time



Steps to Reproduce:
1. run fltk-config --ldflags

  
Actual results:

-lfltk

Expected results:

-lXft -lXinerama -lpthread -ldl -lm  -lXext -lX11 

Additional info:

bug is present in Fedora 9-11.
bug is absent in Fedora 7
Comment 1 Rex Dieter 2009-05-11 12:36:01 EDT
Why, are you trying to link statically?
Comment 2 Rex Dieter 2009-05-11 12:37:56 EDT
Here's some background on removing the extraneous stuff, bug #199656
Comment 3 Rex Dieter 2009-05-11 12:39:30 EDT
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.
Comment 4 Hugues Talbot 2009-05-12 20:53:51 EDT
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
Comment 5 Rex Dieter 2009-05-12 20:59:33 EDT
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.
Comment 6 Rex Dieter 2009-05-12 21:04:54 EDT
In the meantime, adjusting summary accordingly.
Comment 7 Patrice Dumas 2009-05-13 03:10:05 EDT
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.
Comment 8 Hugues Talbot 2009-05-13 03:55:58 EDT
Indeed,

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.
Comment 9 Patrice Dumas 2009-05-13 04:18:41 EDT
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.
Comment 10 Hugues Talbot 2009-05-13 08:36:40 EDT
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 :-)
Comment 11 Rex Dieter 2009-05-13 09:10:09 EDT
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.
Comment 12 Rex Dieter 2009-05-13 10:26:25 EDT
OK, let's back up a step.  Can you give me a sample test program that fails to compile using the output of:
fltk-config --ldstaticflags

but *works* with
fltk-config --ldflags

?
Comment 13 Rex Dieter 2009-05-13 11:40:34 EDT
I think I've found a solution (for fltk anyway), to make 
fltk-config --ldstaticflags
return something more sane.

Please test this build:
http://koji.fedoraproject.org/koji/taskinfo?taskID=1352820
Comment 14 Rex Dieter 2009-05-13 11:52:23 EDT
OK, this one should have a better chance of actually building:
http://koji.fedoraproject.org/koji/taskinfo?taskID=1352833
Comment 15 Hugues Talbot 2009-05-13 20:22:59 EDT
Hello Rex,

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 ?
Comment 16 Hugues Talbot 2009-05-13 20:26:55 EDT
Do you still need an example for comment #12 ?

The test programs shipping with fltk ought to do the trick I guess.
Comment 17 Hugues Talbot 2009-05-13 20:38:31 EDT
Building the new source RPM works at my end, with the desired results.

Thanks again.
Comment 18 Rex Dieter 2009-05-13 20:39:23 EDT
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).
Comment 19 Fedora Update System 2009-05-14 09:08:07 EDT
fltk-1.1.9-4.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/fltk-1.1.9-4.fc9
Comment 20 Fedora Update System 2009-05-14 09:09:45 EDT
fltk-1.1.9-4.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/fltk-1.1.9-4.fc10
Comment 21 Fedora Update System 2009-05-14 09:10:23 EDT
fltk-1.1.9-4.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/fltk-1.1.9-4.fc11
Comment 22 Fedora Update System 2009-05-15 19:28:12 EDT
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
Comment 23 Fedora Update System 2009-06-02 10:24:31 EDT
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.
Comment 24 Fedora Update System 2009-06-02 10:34:10 EDT
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.
Comment 25 Fedora Update System 2009-06-02 10:38:19 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.