我在CentOS上使用黄金链接器连接Intel MKL和libdl时遇到了问题:
当我运行这个脚本时:
#!/bin/bash
MKL_INC=$MKL_INSTALL_DIR/include
MKL_LIB=$MKL_INSTALL_DIR/lib
. /opt/rh/devtoolset-6/enable
cat > t.c << end_mkltest
#include <dlfcn.h>
#include "mkl_service.h"
int main() {
dlerror(); /* use libdl */
mkl_set_num_threads(1); /* use mkl */
}
end_mkltest
gcc -I$MKL_INC -c t.c -o t.o
gcc -L$MKL_LIB -fuse-ld=gold t.o -lmkl_rt -ldl我得到了:
libmkl_rt.so: error: undefined reference to 'calloc'
libmkl_rt.so: error: undefined reference to 'realloc'
libmkl_rt.so: error: undefined reference to 'malloc'
libmkl_rt.so: error: undefined reference to 'free'我们使用的是:
CentOS 7.3
devtoolset-6
mkl-2017.2.174.tar.bz2有什么想法吗?
发布于 2017-07-17 04:01:11
这应该是可行的。你能发布这个命令所显示的链接器命令吗?
gcc -v -L$MKL_LIB -fuse-ld=gold t.o -lmkl_rt -ldl(很抱歉,由于缺乏声誉,无法将此作为评论发布。)
https://stackoverflow.com/questions/44979768
复制相似问题