我们重新编译libgflags.a with -fPIC错误



当我尝试在Linux Ubuntu 64上安装Caffe时出现错误。错误如下:

/usr/bin/ld:/usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_32S against '。不能在创建共享对象时使用Rodata;使用-fPIC重新编译
/usr/local/lib/libgflags.a:添加符号错误:

我尝试用-fPIC重新编译gflags库,但错误变为如下:

src/caffe/common.cpp: In function ' void caffe::GlobalInit(int*, char***) ':
Src/caffe/common.cpp:35:5: error: '::gflags '未被声明
::gflags::ParseCommandLineFlags(pargc, pargv, true);

我也试图改变CMakeCache.txt的caffe设置-fPIC,但不工作

出现此错误是因为gflags 2.1将命名空间的名称从google更改为gflags。caffe社区的成员正在尝试修复这个错误,尽管他们还没有最终确定。您应该像下面这样将名称空间从google重新分配给gflags。

在文件

  • 咖啡/include/咖啡/common.hpp
  • 咖啡/例子/mnist/convert_mnist_data.cpp

注释掉ifndef

// #ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
// #endif  // GFLAGS_GFLAGS_H_

这应该暂时有效。你应该fork并偶尔同步你的caffe repo与github上的BVLC/caffe repo,这样你就能得到最新的代码更新。

最新更新