Problems? Is your data what you think it is? | |
PerlMonks |
Perplexed by Inline::C/MakeMaker LD pathby halfcountplus (Hermit) |
on Mar 02, 2014 at 18:35 UTC ( [id://1076725]=perlquestion: print w/replies, xml ) | Need Help?? |
halfcountplus has asked for the wisdom of the Perl Monks concerning the following question: The following short C program can be compiled gcc test.c -lmpg123 and run without error:
And yet, on the exact same system, the following perl program fails with undefined symbol: mpg123_init, indicating libmpg123 has not been linked:
If I add -L/usr/local/lib to LIBS, then everything works out. However, ld --verbose output includes SEARCH_DIR("/usr/local/lib") -- notice, I did not need an to use -L when compiling the C version -- and for what it's worth, ldconfig also includes /usr/local/lib in the runtime path. This means Inline::C or MakeMaker is doing its own thing when looking for the libraries; if I look at the Makefile in the _Inline/build directory, the "MakeMaker const_loadlibs section", which should contain the stuff from LIBS, is empty (unless I use -L). A comment there refers to the ExtUtils::Liblist pod, where EXTRALIBS (from this same section of the Makefile) is described: List of libraries that need to be linked with when linking a perl binary which includes this extension. Only those libraries that actually exist are included. But no explanation for how the (non-)existence of a library is determined. Obviously, I cannot deploy this (without requiring the source be edited on each system) if I cannot be certain that Inline::C will find libraries which are otherwise accessible by the normal rules. Any form of insight is appreciated.
Back to
Seekers of Perl Wisdom
|
|