Caffe编译失败:架构x86_64的未定义符号?

时间:2016-03-06 16:15:08

标签: caffe

如果我尝试构建最新版本的Caffe,则会导致此错误:

$ make all
CXX/LD -o .build_release/tools/caffe.bin
clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
    "caffe::Net<float>::Forward(float*)", referenced from:
      test() in caffe.o
      time() in caffe.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [.build_release/tools/caffe.bin] Error 1

我正在构建osx,OpenBLAS和CPU_ONLY。我在这里发现了一个kind of similar issue,但它似乎是一个已经解决的问题,而且我没有得到完全相同的错误,尽管它可能是相关的?我也可以在一个月前构建并运行旧版本的Caffe,所以我觉得最近发生了一些变化。

有关如何克服此错误的任何想法?

2 个答案:

答案 0 :(得分:0)

它在编译时显示链接问题。在osx上,这个问题通常会发生。我猜这个问题发生在Makefile.config。你可以改为

# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
CUSTOM_CXX := g++

并确认一些路径是正确的。

答案 1 :(得分:0)

I had exactly the same problem. Its now resolved. Do check if you already have a libcaffe.so in your system library paths (maybe /usr/local/lib). If so, delete the existing libcaffe.so and build again.