in reply to Perplexed by Inline::C/MakeMaker LD path

I have other Inline::C modules which access libs in the exact same /usr/local/lib directory, without specifying -L, that compile fine

That's the puzzle - if you can work out why it's *only* libmpg123 that's posing the problem, then you've solved the puzzle.

As AM said, turning on BUILD_NOISY is the first thing to do - and feel free to post full output here if the cause of the problem is still not apparent to you.
Look for a warning that no library was found for -lmpg123. That would tell you that the mpg123 library was not found, and would mean that MakeMaker has removed the reference to it. Hence there would be no reference to it in the generated Makefile.

I cannot find an explanation for how the (non-)existence of a library is determined

The code that deals with this is in ExtUtils/Liblist/Kid.pm.
If that code fails to locate the library, then EU::MM deems it non-existent and removes the link

Cheers,
Rob
  • Comment on Re: Perplexed by Inline::C/MakeMaker LD path

Replies are listed 'Best First'.
Re^2: Perplexed by Inline::C/MakeMaker LD path
by halfcountplus (Hermit) on Mar 03, 2014 at 14:02 UTC
    As it turns out I don't have modules which access /usr/local/lib without -L. I was presuming "whereis" would give both locations if there were multiple installs but it does not, it just reports the /usr/local one. However, there are distro versions of those libraries in /usr/lib64 (just not libmpg123). This is good, since that was kind of the most baffling part. WRT BUILD_NOISY, all it says about this is:
    Starting Build Compile Stage Starting "perl Makefile.PL" Stage Warning (mostly harmless): No library found for -lmpg123

    So I ran it through `strace -f` (the dirt is in a child, so just `strace` won't get it). Without `-L`, it stats in order /usr/local/lib64, /lib64, and then /usr/lib64. It's of course my laziness that /usr/local does not follow the convention of dividing 64 and 32 bit libs (since there aren't any of the later).

    However, I still don't see why it doesn't use the actual compile time linker path. In the end, the use of `-L /usr/local/lib` is meaningless; it would have been found anyway if `-lmpg123` was used. But it seems if the afforementioned search failed, Inline leaves the "LIBS" command out entirely of its own accord. I'm on the mailing list so I'll ask about this...

      Inline leaves the "LIBS" command out entirely of its own accord

      It's looking to me that it's just standard EU::MM behaviour - and not the responsibility of Inline. EU::MM can't find '-lmpg123' because it's not in any of the places it's looking.
      Therefore the '-lmpg123' gets wiped out.

      If your perl was configured to include /usr/local/lib in $Config{libpth}, then LIBS => '-lmpg123' should work fine (because EU::MM would then find it).

      Another option (if you're using gcc compiler) would be to set the LIBRARY_PATH environment variable to /usr/local/lib. I'm not sure if that works with older versions of EU::MM, but I *think* it works with recent ones.

      Cheers,
      Rob