2010-09-29 56 views
8

如何让CPAN在一次特定安装中给出Makefile.PL一个特定参数?如何为单个安装设置库并包含Makefile.PL的路径?

具体而言。我想安装XML::LibXMLapt-get将库安装到/usr/lib/libxml2.so.2.6.32Makefile.PL具有的问题,并告诉我:

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/ 

我知道那里的libxml2的是,但我不知道怎么就告诉Makefile.PL

编辑:当我做dpkg -L libxml2(这是一个Debian的),我看到

/. 
/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 

我不是机器上的根,我不能让符号链接/usr/lib或修理。

+1

那么这是如何工作的?你能解决你的问题吗? – rafl 2010-10-04 02:18:58

+0

是的,我做了(抱歉没有回复,我还有其他工作),谢谢! – 2010-10-05 12:38:27

回答

3

Makefile.PL正在寻找libxml2.so。这通常是与您的实际libxml2共享对象的符号链接,如libxml2.so.2.6.32。如果由于某种原因,这个符号链接不在您的手中,因为您已经删除了它,您的供应商没有提供它的libxml2头文件包(例如在Debian/Ubuntu /等上的libxml2-dev),您将需要自己创建它。

您不需要在此处将任何特定参数传递给Makefile.PL。它已经在正确的地方寻找。它寻找的东西根本就不在那里。

+0

我不是那台机器上的根(我有CPAN配置为将东西安装到我的主目录中)。当我做'dpkg -L libxml2'时,我在'/ usr/lib'中看到两件事情,那就是'/ usr/lib/libxml2.so.2.6.32'和'/usr/lib/libxml2.so。 2'。它可能安装错了;但是,我无法修复它。 – 2010-09-29 22:57:42

+0

是否安装了'libxml2-dev'?否则,您将无法针对您已安装的libxml2构建“XML :: LibXML”,因为您缺少所需的头文件和.so符号链接。如果您无法让系统管理员为您安装该软件包,我建议您手动将libxml2(包括其头文件)安装在您有权写入的某个目录中,并使用'LIBS'和'INC指向Makefile.PL '它已经在输出中显示了你的选项。 – rafl 2010-09-29 23:02:11

+0

哦。不是。这是问题吗? (我可以让管理员安装它,它只需要几天:)) – 2010-09-29 23:03:42

12

在CPAN命令,你可以设置你需要的值:

$ 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 

使用CPAN命令,你可以使用-j开关来加载自定义配置文件。你可以用-J开关启动转储配置,然后改成你想要的值,然后重新装入:

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

然而,我怀疑rafl's suspicions are right

相关问题