On 16/12/15 19:48, Dave Johansen wrote:
> On Wed, Dec 16, 2015 at 12:32 PM, Richard Shaw <hobbes1069(a)gmail.com
> <mailto:hobbes1069@gmail.com>> wrote:
>
> On Wed, Dec 16, 2015 at 1:15 PM, Dave Johansen
> <davejohansen(a)gmail.com <mailto:davejohansen@gmail.com>> wrote:
>
> I'm running into a linker issue when moving code that builds on
> RHEL 6 to Fedora or RHEL 7. Here's a simple reproducer:
>
> Download simple.c from
>
>
https://github.com/markkilgard/glut/blob/master/progs/examples/simple.c
> and then run:
> g++ simple.c -lglut -o simple
>
>
> My SWG would be that for some reason on EL 6 you're getting the
> symbols for free perhaps due to the transitive nature of linking
> dynamic libraries?
>
> Since all you need to add is "-lGL" and it won't hurt anything on
EL
> 6, seems like a pretty straight forward fix.
>
>
> Yes, in this simple example the fix is easy, but in our actual code it
> would mean changing the build command for hundreds of programs and
> several of them depend on multiple libraries which depend on multiple
> libraries, so it would be pretty time consuming. Plus, that's not even
> to mention the complexity and confusion that will be added when everyone
> wonders why a program is linking against a library it doesn't use.
>
It is using it, or you wouldn't get that error. The reference is in the .o
file that the compiler has generated in /tmp for your input, not in a
library you are linking to.
The cause of the change in behaviour will be this:
https://fedoraproject.org/wiki/UnderstandingDSOLinkChange
Yes, with all of the available information, that change makes sense. It
appears that this change wasn't documented with RHEL 7 but hopefully that
will be fixed: