fltk

Dan Williams dcbw at redhat.com
Wed Dec 19 16:53:07 UTC 2012


On Wed, 2012-12-19 at 11:23 -0500, Gregory Maxwell wrote:
> On Wed, Dec 19, 2012 at 10:40 AM, Bruno Wolff III <bruno at wolff.to> wrote:
> > In some cases you can get DSO linking errors when you don't explicitly link
> > to those other packages. People building from source might not care, but
> > this can cause problems for official builds.
> 
> Can you elaborate on this or point me to where I can learn more?  That
> is absolutely counter to my understanding.
> 
> Consider: What happens if   you have libfoo 1.0.0  which itself uses
> -lbar ...  and later upgrade your system to libfoo 1.0.1 which itself
> is -lbar -lm (and is API/ABI and functionally identical).  If I
> understand you correctly you're saying that now random -lfoo users
> which themselves make no use of -lm will now randomly fail.  I believe
> this is incorrect and would be a terrible problem if it were true.

It's the other way around.  If libfoo 1.0.0 linked with -lbar and -lm,
and then you upgraded to libfoo 1.0.1 which *no longer* links to -lm,
now stuff that links to libfoo might fail if those things did not
specifically request -lm themselves when they were built, and they need
it.

> AFAIK, you should only link your actual direct dependencies. If they
> have their own dependencies the dynamic linker will handle it, and
> anything else leads to madness. Am I full of it?

You should link anything you use and not depend on your linked libraries
to pull in libm if your own code uses eg pow() or sqrt().

I think the original poster is complaining about this specific
situation; IIUC that fltk tool is supposed to provide (pkg-config style)
the link line that includes most ftlk libraries, so that you can simply
run it and get most of what you need.  Unfortunately the Fedora version
was likely linked with -Wl,as-needed and thus doesn't include most of
the common fltk libraries.  So yes, it's really a hack to allow lazy
programmers not to explicitly link to every ftlk library they need.  But
apparently a standard one for fltk users?

Dan



More information about the devel mailing list