centos7安装openbabel踩坑
由于时效问题,该文某些代码、技术可能已经过期,请注意!!!本文最后更新于:2 年前
openbabel踩坑
源码安装报错,报错信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| CMakeFiles/xtcformat.dir/xtcformat.cpp.o: In function `OpenBabel::XTCFormat::xdropen(XDR*, char const*, char const*) xtcformat.cpp:(.text+0xd2): undefined reference to `xdrstdio_create xtcformat.cpp:(.text+0x11b): undefined reference to `xdrstdio_create CMakeFiles/xtcformat.dir/xtcformat.cpp.o: In function `OpenBabel::XTCFormat::xdr3dfcoord(XDR*, float*, int*, float*) xtcformat.cpp:(.text+0x888): undefined reference to `xdr_int xtcformat.cpp:(.text+0x8e6): undefined reference to `xdr_float xtcformat.cpp:(.text+0x951): undefined reference to `xdr_int xtcformat.cpp:(.text+0x961): undefined reference to `xdr_int xtcformat.cpp:(.text+0x971): undefined reference to `xdr_int xtcformat.cpp:(.text+0x981): undefined reference to `xdr_int xtcformat.cpp:(.text+0x991): undefined reference to `xdr_int CMakeFiles/xtcformat.dir/xtcformat.cpp.o:xtcformat.cpp:(.text+0x9a1): more undefined references to `xdr_int CMakeFiles/xtcformat.dir/xtcformat.cpp.o: In function `OpenBabel::XTCFormat::xdr3dfcoord(XDR*, float*, int*, float*) xtcformat.cpp:(.text+0xab7): undefined reference to `xdr_opaque xtcformat.cpp:(.text+0xd33): undefined reference to `xdr_int xtcformat.cpp:(.text+0xd5e): undefined reference to `xdr_float xtcformat.cpp:(.text+0xd93): undefined reference to `xdr_float xtcformat.cpp:(.text+0xd98): undefined reference to `xdr_vector xtcformat.cpp:(.text+0xdb2): undefined reference to `xdr_float xtcformat.cpp:(.text+0x10ea): undefined reference to `xdr_int xtcformat.cpp:(.text+0x10fa): undefined reference to `xdr_int xtcformat.cpp:(.text+0x110a): undefined reference to `xdr_int xtcformat.cpp:(.text+0x111a): undefined reference to `xdr_int xtcformat.cpp:(.text+0x112a): undefined reference to `xdr_int CMakeFiles/xtcformat.dir/xtcformat.cpp.o:xtcformat.cpp:(.text+0x113a): more undefined references to `xdr_int CMakeFiles/xtcformat.dir/xtcformat.cpp.o: In function `OpenBabel::XTCFormat::xdr3dfcoord(XDR*, float*, int*, float*) xtcformat.cpp:(.text+0x1b0c): undefined reference to `xdr_opaque CMakeFiles/xtcformat.dir/xtcformat.cpp.o: In function `OpenBabel::XTCFormat::ReadMolecule(OpenBabel::OBBase*, OpenBabel::OBConversion*) xtcformat.cpp:(.text+0x1d67): undefined reference to `xdr_int xtcformat.cpp:(.text+0x1d80): undefined reference to `xdr_int xtcformat.cpp:(.text+0x1da4): undefined reference to `xdr_int xtcformat.cpp:(.text+0x1db4): undefined reference to `xdr_float xtcformat.cpp:(.text+0x1dc4): undefined reference to `xdr_float xtcformat.cpp:(.text+0x1dd4): undefined reference to `xdr_float xtcformat.cpp:(.text+0x1de4): undefined reference to `xdr_float xtcformat.cpp:(.text+0x1df4): undefined reference to `xdr_float CMakeFiles/xtcformat.dir/xtcformat.cpp.o:xtcformat.cpp:(.text+0x1e04): more undefined references to `xdr_float CMakeFiles/xtcformat.dir/xtcformat.cpp.o: In function `OpenBabel::XTCFormat::xdr3dfcoord(XDR*, float*, int*, float*) xtcformat.cpp:(.text+0xd74): undefined reference to `xdr_vector collect2: error: ld returned 1 exit status make[2]: *** [src/formats/CMakeFiles/xtcformat.dir/build.make:105: lib/xtcformat.so] Error 1 make[1]: *** [CMakeFiles/Makefile2:4523: src/formats/CMakeFiles/xtcformat.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....
|
没找到解决方法。遂放弃。
conda 安装
1
| conda install -y -c conda-forge openbabel
|
安装还挺快。接下来绑定python
从pypi上下载openbabel的源码包(pip install直接安装会报错),下载地址https://pypi.org/project/openbabel/#files
解压后安装命令如下
1 2 3 4 5
| cd openbabel-3.1.1.1
python setup.py build_ext -I$CURR_DIR/envs/Sdocking/include/openbabel3/ -L$CURR_DIR/envs/Sdocking/lib/openbabel/3.1.0
python setup.py install --prefix=$CURR_DIR/envs/Sdocking/lib/python3.7/site-packages
|
安装完确认是否安装成功
1
| python -c 'import openbabel'
|
参考:https://blog.csdn.net/qq_32115939/article/details/120031684