简体   繁体   English

Cray上的libxml2无法使用

[英]libxml2 on Cray not usable

I need to use libxml2 in a project that I want to compile on a Cray machine. 我需要在要在Cray机器上编译的项目中使用libxml2。 In principle it is installed, there is a xml2-config program that gives me linker flags: 原则上,它已安装,有一个xml2-config程序为我提供了链接器标志:

$ xml2-config --libs
-lxml2 -L/lib64 -lz -llzma -lm -ldl

I have a very simple test program: 我有一个非常简单的测试程序:

$ cat test.c
int main() { return 0; }

Though in principle not needed, I can compile this with gcc test.c -lxml2 -L/lib64 -lz -llzma -lm -ldl just fine. 虽然原则上不需要,但是我可以使用gcc test.c -lxml2 -L/lib64 -lz -llzma -lm -ldl进行编译。 However, with the Cray compiler it does not work: 但是,使用Cray编译器不起作用:

$ cc test.c -lxml2 -L/lib64 -lz -llzma -lm -ldl
/opt/cray/pe/cce/8.6.5/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld: cannot find -lxml2
/opt/cray/pe/cce/8.6.5/binutils/x86_64/x86_64-pc-linux-gnu/bin/ld: cannot find -llzma

Same story with the Cray wrapped Intel compiler: 与Cray包装的Intel编译器的情况相同:

$ module swap PrgEnv-cray PrgEnv-intel

$ cc test.c -lxml2 -L/lib64 -lz -llzma -lm -ldl
ld: cannot find -lxml2
ld: cannot find -llzma

I need to use the Cray wrapped compiler in order to get proper MPI and hugepages into my program. 我需要使用Cray包装的编译器才能在程序中获取正确的MPI和大量页面。

Is there anything I can do (besides trying to compile libxml2 myself, see my other question ) to get this to link? 有什么我可以做的(除了尝试自己编译libxml2之外,请参见我的其他问题 )以将此链接起来?

If libxml2 is indeed installed then it appears that xml2-config is lying to you. 如果确实安装了libxml2,则似乎xml2-config在骗你。 My best guess would be that libxml2 was installed in a different location than it was built for, or that it was moved after installation. 我最好的猜测是libxml2的安装位置与为其构建的位置不同,或者安装后将其移动了。 In any case, the output of xml2-config --libs assumes that on your system, libxml2 is installed in the default library search path, and liblzma and the other needed libraries are installed either in the default library search path or in /lib64 (if that's not already in the search path). 无论如何, xml2-config --libs的输出假定在您的系统上,libxml2安装在默认库搜索路径中,而liblzma和其他所需的库安装在默认库搜索路径或/lib64 ( (如果尚未在搜索路径中)。 In fact, they're not. 实际上,事实并非如此。

Rather than building the libraries from scratch, your best bet is to find where they are actually installed, and pass an corresponding -L option to the linker when you build your program: 最好的选择是找到它们的实际安装位​​置,并在构建程序时将相应的-L选项传递给链接器,而不是从头开始构建库:

cc test.c -L/path/to/libxml2/directory -lxml2 -lz -llzma -lm -ldl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM