我在 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
有什么想法吗?
最佳答案
这应该有效。您可以发布此命令显示的链接器命令吗?
gcc -v -L$MKL_LIB -fuse-ld=gold t.o -lmkl_rt -ldl
(抱歉,由于缺乏声誉,无法将此作为评论发布。)
关于c - 如何将英特尔 MKL 和 libdl 与黄金链接器链接起来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44979768/