libxml2 on Cray not usable

岁酱吖の 提交于 2019-12-13 03:42:04

问题


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; }

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

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

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

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


回答1:


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.

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


来源:https://stackoverflow.com/questions/49347699/libxml2-on-cray-not-usable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!