tags:

views:

48

answers:

2

How can I tell CPAN to give Makefile.PL one specific argument in one specific installation?

Specifically. I want to install XML::LibXML, and apt-get installed the library to /usr/lib/libxml2.so.2.6.32. Makefile.PL has problems with that and tells me:

using fallback values for LIBS and INC
options:
  LIBS='-L/usr/local/lib -L/usr/lib -lxml2 -lm'
  INC='-I/usr/local/include -I/usr/include'
If this is wrong, Re-run as:
  $ /usr/bin/perl Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/include'

looking for -lxml2... no
looking for -llibxml2... no
libxml2 not found
Try setting LIBS and INC values on the command line
Or get libxml2 from 
  http://xmlsoft.org/

I know where the libxml2 is, but I don't know how to tell it to the Makefile.PL.

edit: When I do dpkg -L libxml2 (it's a debian), I see

/.
/usr
/usr/lib
/usr/lib/libxml2.so.2.6.32
/usr/share
/usr/share/doc
/usr/share/doc/libxml2
/usr/share/doc/libxml2/AUTHORS
/usr/share/doc/libxml2/changelog.Debian.gz
/usr/share/doc/libxml2/copyright
/usr/share/doc/libxml2/README
/usr/share/doc/libxml2/README.Debian
/usr/share/doc/libxml2/NEWS.gz
/usr/share/doc/libxml2/changelog.gz
/usr/share/doc/libxml2/TODO.gz
/usr/lib/libxml2.so.2

I am not a root on that machine and I can't make symlink in /usr/lib or repair it.

+3  A: 

The Makefile.PL is looking for libxml2.so. That's usually a symlink to your actual libxml2 shared object, like libxml2.so.2.6.32. If for some reason this symlink isn't around because you deleted it, your vendor didn't ship it with its libxml2 header package (e.g. libxml2-dev on Debian/Ubuntu/etc), you will need to create it yourself.

You don't need to pass any specific argument to Makefile.PL here. It's already looking in the right places. The things it's looking for simply aren't there.

rafl
I am not a root on that machine (I have CPAN configured to install stuff into my home directory). When I do `dpkg -L libxml2`, I see two things in `/usr/lib`, and that is `/usr/lib/libxml2.so.2.6.32` and `/usr/lib/libxml2.so.2`. It is probably installed wrong; however, I have no way of fixing it.
Karel Bílek
Is `libxml2-dev` installed? If not, you won't be able to build `XML::LibXML` against that libxml2 you have installed as you're missing both the required header files and the .so symlinks. If you can't get your system administrator to install that package for you, I recommend installing libxml2, including its headers, manually in some directory you have write permissions on and pointing Makefile.PL at that, using the `LIBS` and `INC` options it already showed you in its output.
rafl
Oh. It's not. Is that the problem? (I can make the admin to install it, it just takes few days :))
Karel Bílek
Yes, that's the problem. The `libxml2-dev` package will contain both the header files for libxml2, as well as the /usr/lib/libxml2.so symlink to your real libxml.so.1.2.345 that Makefile.PL is looking for.
rafl
Hmmm. `apt-cache search get libxml2-dev` shows me nothing :(
Karel Bílek
I think you meant `apt-cache search libxml2-dev` or `apt-cache show libxml2-dev`, i.e. without the bogous `get` in there.
rafl
Ah, yeah, I wrote it wrong on SO, but in shell I use it without the `get`... he probably uses old database or something. I will try to write him :) thanks for help so far
Karel Bílek
A: 

In the CPAN shell, you can set the values that you need:

$ cpan
cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]> o conf makepl_arg
    makepl_arg         []
Type 'o conf' to view all configuration items


cpan[2]> o conf makepl_arg "LIBS=-L/foo/bar INC=-I/foo/bar/include"
    makepl_arg         [LIBS=-L/foo/bar INC=-I/foo/bar/include]
Please use 'o conf commit' to make the config permanent!

cpan[3]> install Some::Module

With the cpan command, you can use the -j switch to load a custom configuration file. You can start with the -J switch to dump the configuration, then change the values you want and reload it:

 $ cpan -J > my_config.pm
 .... edit file ....
 $ cpan -j my_config.pm -i Some::Module

However, I suspect that rafl's suspicions are right.

brian d foy