[colug-432] linker is being PICky

Rick Troth rmt at casita.net
Mon Jun 29 13:46:40 EDT 2015


On 06/29/2015 12:54 PM, Jeff Frontz wrote:
> I'm no sure where the -fPIC came in (presumably in a library that was used
> by the dependent?), but if it was part of a larger "statically link
> everything I need to run" vs "make this use shared objects", I can see the
> former resulting in a larger dependent.

The package-of-interest has a couple of pre-req libraries that were
missing. As is my habit, I built them myself. I configured them with
"--enable-static" so that the resulting executable (in the package)
would not need third-party shared libs when I push it out.

Whether static or shared, the needed libraries shipped by the
distributor do not exhibit any problem when the package gets linked.
It's only the supporting libraries that I built manually that caused
linker errors.


> I guess I'm not remembering autoconf/automake (or, rather, a dependent
> package's autoconf output) automatically pulling in or figuring out
> dependencies on other packages and then actually building those packages
> (other than having them say "Hey, you don't have package X; go get/make
> it!").  If it's going that deep, then, yeah, there should have been an
> explicit addition to ensure that the dependencies are built using the
> proper flags.  But doing that seems kind of dangerous -- I mean, what if
> some other (previously installed) dependent requires a particular
> compilation/environment and then the build of the latest dependent goes in
> and automatically changes things on its own to suit the latest dependent's
> (incompatible) needs?

Sometimes automake/autoconf (by way of the usual 'configure' script)
will error out if a pre-req is missing. Other times, you get past
configuration and find out during compile (because a header is missing)
or during link (because the library is missing). Either way, it's no big
deal: you can install what is needed (from the distro) or you can build
it from source. Works.

Most of the discovery during './configure' is things like "compile with
such-and-such flag" for dozens and dozens of such-and-such. The focus is
more of creating a viable Makefile.


> Or are you saying that for a given package, the build blows up because said
> package's configure didn't bother to set up the right compilation flags for
> said package?

Exactly.
Configure didn't figure out that "-fPIC" would be needed. As you hinted
earlier, might not be needed for "--enable-shared". (So maybe that's why
'configure' doesn't check if "-fPIC" is needed?) But I built the
supporting libraries with "--enable-static" in order that the shipped
executable would actually run w/o having to drag in co-reqs when
delivering.

If anyone wants to devolve into a static versus shared discussion,
please change the subject line.

Fun discussion so far. Thanks Jeff!

-- R; <><



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20150629/66176f93/attachment.html 


More information about the colug-432 mailing list