Bug 500201

Summary: fltk doesn't support static linking
Product: [Fedora] Fedora Reporter: Hugues Talbot <hugues.talbot>
Component: fltkAssignee: Rex Dieter <rdieter>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: pertusus, rdieter
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.1.9-4.fc10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-06-02 14:34:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hugues Talbot 2009-05-11 16:33:16 UTC
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 16:36:01 UTC
Why, are you trying to link statically?

Comment 2 Rex Dieter 2009-05-11 16:37:56 UTC
Here's some background on removing the extraneous stuff, bug #199656

Comment 3 Rex Dieter 2009-05-11 16:39:30 UTC
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-13 00:53:51 UTC
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-13 00:59:33 UTC
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-13 01:04:54 UTC
In the meantime, adjusting summary accordingly.

Comment 7 Patrice Dumas 2009-05-13 07:10:05 UTC
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 07:55:58 UTC
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 08:18:41 UTC
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 12:36:40 UTC
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 13:10:09 UTC
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 14:26:25 UTC
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 15:40:34 UTC
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 15:52:23 UTC
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-14 00:22:59 UTC
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-14 00:26:55 UTC
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-14 00:38:31 UTC
Building the new source RPM works at my end, with the desired results.

Thanks again.

Comment 18 Rex Dieter 2009-05-14 00:39:23 UTC
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 13:08:07 UTC
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 13:09:45 UTC
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 13:10:23 UTC
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 23:28:12 UTC
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 14:24:31 UTC
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 14:34:10 UTC
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 14:38:19 UTC
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.