Ea has asked for the wisdom of the Perl Monks concerning the following question:

Learned Module Authors, what are your secrets for finding C++ libraries/header installed by the system? I need to update an XS module and I realize that not every system puts their libraries/headers in the same place. How best to go about finding out that location in the Makefile.PL?

My specific use case is the Boost libraries on Fedora 25, which I've found under /usr/lib64/libboost* and /usr/include/boost and can hardcode, but I'd like to be as cross-platform as possible, maybe including Mac/Windows if it's not to difficult.

Sometimes I can think of 6 impossible LDAP attributes before breakfast.

http://act.yapc.eu/lpw2016/ It's that time of year again!

Replies are listed 'Best First'.
Re: Finding system libraries to include in Makefile.PL
by Anonymous Monk on Feb 08, 2017 at 23:44 UTC

    The best and simplest and very traditional answer, is let the compiler do all the finding

    You write the xs/c/cpp code that includes what headers iit needs, link the libs in Makefile.PL, and the compiler does the finding

    If includes arent in default compiler findable directories, let the user add any extra directories, like he is supposed to

    http://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html like C_INCLUDE_PATH/LIBRARY_PATH...