Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 无法链接到libxml2_Linux_Perl_Apache_Linker_Libxml2 - Fatal编程技术网

Linux 无法链接到libxml2

Linux 无法链接到libxml2,linux,perl,apache,linker,libxml2,Linux,Perl,Apache,Linker,Libxml2,我需要安装perl模块XMLlibxml。我已经下载了如下内容,并尝试安装。它表示无法链接libxml2。然后我下载并安装了libxml2,然后再试一次,但也没有成功。 那么我应该知道如何链接已安装的libxml2。 是否需要将libxml2安装目录(/install/others/lib)添加到文件“/etc/ld.so.conf”中,并通过运行:ldconfig更新动态加载程序缓存 bash-3.2$ wget http://search.cpan.org/CPAN/authors/id/S

我需要安装perl模块
XMLlibxml
。我已经下载了如下内容,并尝试安装。它表示无法链接
libxml2
。然后我下载并安装了libxml2,然后再试一次,但也没有成功。
那么我应该知道如何链接已安装的libxml2。
是否需要将libxml2安装目录(/install/others/lib)添加到文件“/etc/ld.so.conf”中,并通过运行:ldconfig更新动态加载程序缓存

bash-3.2$ wget http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0019.tar.gz
bash-3.2$ tar zxvf XML-LibXML-2.0019.tar.gz
bash-3.2$ pwd
/install/others/XML-LibXML-2.0019

bash-3.2$ perl Makefile.PL LIBS='-L/install/others/lib' INC='-I/install/others/include'
enable native perl UTF8
Checking for ability to link against xml2...no
Checking for ability to link against libxml2...libxml2, zlib, and/or the Math library (-lm) have not been found.
Try setting LIBS and INC values on the command line
Or get libxml2 from
http://xmlsoft.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.

Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter
to see the exact reason why the detection of libxml2 installation
failed or why Makefile.PL was not able to compile a test program.
bash-3.2$
bash-3.2$
bash-3.2$
bash-3.2$
bash-3.2$ perl Makefile.PL PREFIX=/install/others  LIBS='-L/install/others/lib' INC='-I/install/others/include'
enable native perl UTF8
Checking for ability to link against xml2...no
Checking for ability to link against libxml2...libxml2, zlib, and/or the Math library (-lm) have not been found.
Try setting LIBS and INC values on the command line
Or get libxml2 from
http://xmlsoft.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.

Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter
to see the exact reason why the detection of libxml2 installation
failed or why Makefile.PL was not able to compile a test program.
bash-3.2$
下面是DEBUG=1添加的输出

bash-3.2$ pwd
/install/others/XML-LibXML-1.31
bash-3.2$ perl Makefile.PL LIBS='-L/install/others/lib -lxml2 -lz -lm' INC='-I/install/others/include/libxml2' DEBUG=1
running xml2-config... xml2-config --version
failed
*** backticks call to 'xml2-config --version' failed at Makefile.PL line 212.
using fallback values for LIBS and INC
options:
  LIBS='-L/usr/local/lib -L/usr/lib -lxml2 -lz -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... /usr/bin/perl Makefile.PL 'INC=-I/usr/local/include -I/usr/include' 'LIBS=-L/usr/local/lib -L/usr/lib -lxml2 -lz -lm'
INC = -I/usr/local/include -I/usr/include
LIBS = -L/usr/local/lib -L/usr/lib -lxml2 -lz -lm
Writing Makefile for Conftest
make test 'OTHERLDFLAGS=-lxml2'
cp Conftest.pm blib/lib/Conftest.pm
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp  -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap  Conftest.xs > Conftest.xsc && mv Conftest.xsc Conftest.c
gcc -c  -I/usr/local/include -I/usr/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION=\"1\" -DXS_VERSION=\"1\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE"   Conftest.c
Conftest.xs:11: warning: return type defaults to âintâ
Running Mkbootstrap for Conftest ()
chmod 644 Conftest.bs
rm -f blib/arch/auto/Conftest/Conftest.so
gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic Conftest.o -lxml2 -o blib/arch/auto/Conftest/Conftest.so       \
           -L/usr/local/lib -L/usr/lib -lxml2 -lz -lm   \

/usr/bin/ld: cannot find -lxml2
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Conftest/Conftest.so] Error 1
system call to 'make test 'OTHERLDFLAGS=-lxml2'' failed at Makefile.PL line 188.
no
libxml2 not found
Try setting LIBS and INC values on the command line
Or get libxml2 from
  http://www.libxml.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.
bash-3.2$
它不是在寻找我的本地目录,而是在寻找

INC = -I/usr/local/include -I/usr/include
LIBS = -L/usr/local/lib -L/usr/lib -lxml2 -lz -lm
注意:我没有根访问权限,我的操作系统是linux RedHat


提前感谢

如果您没有root访问权限,请尝试使用perlbrew:

然后您可以轻松地安装Alien::XML::LibXML()

它只为本地Perl安装libxml

在此之后,应成功安装XML LibXML

步骤:

1) 使用perlbrew安装本地perl以保持系统perl干净

2) 从perlbrew安装带有cpanm的Alien::XML::LibXML


3) 安装XML LibXML

如果您没有根访问权限,则尝试使用perlbrew:

然后您可以轻松地安装Alien::XML::LibXML()

它只为本地Perl安装libxml

在此之后,应成功安装XML LibXML

步骤:

1) 使用perlbrew安装本地perl以保持系统perl干净

2) 从perlbrew安装带有cpanm的Alien::XML::LibXML


3) 安装XML LibXML

您需要头文件


它们作为libxml源代码分发的一部分提供,例如。将
libxml…/include
目录提取到文件系统的某个位置,并将该目录包含在您的make calls的
-I
标志中。错误消息还表明在您的系统上找不到zlib和libm。它们可能位于非标准的
/usr/lib…
目录中,但会出现。在拨打电话的
-L
选项中包含找到的LIB。

您需要头文件


它们作为libxml源代码分发的一部分提供,例如。将
libxml…/include
目录提取到文件系统的某个位置,并将该目录包含在您的make calls的
-I
标志中。错误消息还表明在您的系统上找不到zlib和libm。它们可能位于非标准的
/usr/lib…
目录中,但会出现。将找到的lib包含在拨打电话的
-L
选项中。

为linux发行版安装Alien::LibXML或下载LibXML二进制文件

“导出XMLPREFIX=$YOURLIBXMLPREFIX”
$$YOURLIBXMLPREFIX/bin/xml2配置正常


然后通过cpan安装XML::LibXML

安装Alien::LibXML或下载linux发行版的LibXML二进制文件

“导出XMLPREFIX=$YOURLIBXMLPREFIX”
$$YOURLIBXMLPREFIX/bin/xml2配置正常


然后通过cpan安装XML::LibXML

如果通过RPM安装,请确保还安装了-devel RPM,因为这是头(.h文件)所在的位置。那么,您安装了头文件了吗?如果没有,请安装它们并重试Perl模块安装。如果是,它们在哪里?(还有,为什么您要手动安装模块,而不是使用诸如cpanm和local::lib之类的工具?)您是否尝试过错误消息中建议的DEBUG=1参数?@amon:他没有根访问权限,因此stock rpm安装无法工作。如果您通过rpm安装,请确保您也安装了-devel rpm,因为这是标头所在的位置(.h文件)是。那么,您安装了头文件了吗?如果没有,请安装它们并重试Perl模块安装。如果是,它们在哪里?(另外,为什么您要手动安装模块,而不使用诸如cpanm和local::lib之类的工具?)您是否尝试过错误消息中建议的DEBUG=1参数?@amon:他没有根访问权限,因此stock rpm安装无法工作。-1表示未提及针对卸载的标头编译的缺点。-1表示未提及针对卸载的标头编译的缺点。否,安装Alien:libxml不要安装xml::libxmled,因为它还可以在默认库路径中查找libxml。不,安装Alien:libxml不要让xml::libxml被安装,因为它还可以在默认库路径中查找libxml。