Cray上的libxml2无法使用 [英] libxml2 on Cray not usable

查看:124
本文介绍了Cray上的libxml2无法使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在要在Cray机器上编译的项目中使用libxml2.原则上已经安装了它,有一个xml2-config程序为我提供了链接器标志:

I need to use libxml2 in a project that I want to compile on a Cray machine. In principle it is installed, there is a xml2-config program that gives me linker flags:

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

我有一个非常简单的测试程序:

I have a very simple test program:

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

尽管原则上不需要,但是我可以用gcc test.c -lxml2 -L/lib64 -lz -llzma -lm -ldl编译它.但是,对于Cray编译器,它不起作用:

Though in principle not needed, I can compile this with gcc test.c -lxml2 -L/lib64 -lz -llzma -lm -ldl just fine. However, with the Cray compiler it does not work:

$ 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

与Cray包装的Intel编译器的故事相同:

Same story with the Cray wrapped Intel compiler:

$ module swap PrgEnv-cray PrgEnv-intel

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

我需要使用Cray包装的编译器,以便在程序中获取正确的MPI和大页面.

I need to use the Cray wrapped compiler in order to get proper MPI and hugepages into my program.

有什么我能做的(除了尝试自己编译libxml2之外,请参见

Is there anything I can do (besides trying to compile libxml2 myself, see my other question) to get this to link?

推荐答案

如果确实安装了libxml2,那么看来xml2-config在骗你.我最好的猜测是libxml2安装在与其生成的位置不同的位置,或者安装后将其移动了.无论如何,xml2-config --libs的输出假定在您的系统上,libxml2安装在默认库搜索路径中,而liblzma和其他所需的库安装在默认库搜索路径或/lib64中(如果是尚未在搜索路径中).实际上,它们不是.

If libxml2 is indeed installed then it appears that xml2-config is lying to you. 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. 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). In fact, they're not.

最好不要选择从头开始构建库,而是找到它们的实际安装位​​置,并在构建程序时将相应的-L选项传递给链接器:

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:

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

这篇关于Cray上的libxml2无法使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆