【问题标题】:How do I link Intel MKL and libdl with gold linker?如何使用黄金链接器链接英特尔 MKL 和 libdl?
【发布时间】:2017-12-12 06:47:05
【问题描述】:

我在 CentOS 上使用黄金链接器链接英特尔 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

有什么想法吗?

【问题讨论】:

    标签: c centos glibc intel-mkl gold-linker


    【解决方案1】:

    这应该可行。你能发布这个命令显示的链接器命令吗?

    gcc -v -L$MKL_LIB -fuse-ld=gold t.o -lmkl_rt -ldl
    

    (抱歉,由于缺乏声誉,无法将此作为评论发布。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-17
      • 2014-08-03
      • 1970-01-01
      • 2017-03-25
      • 1970-01-01
      • 1970-01-01
      • 2017-08-31
      相关资源
      最近更新 更多