c++ - Caffe 编译错误 : gflags. cc' 正在静态和动态链接到此可执行文件中

标签 c++ makefile deep-learning caffe gflags

我正在尝试按照此 tutorial 安装 caffe

当我输入最后一个 make 命令时,基本上我有以下错误:

me@dl-01:/home/me/caffe-master$ make runtest

.build_release/tools/caffe

caffe: command line brew

usage: caffe command args

commands:

train           train or finetune a model

test            score a model

device_query    show GPU diagnostic information

time            benchmark model execution time

Flags from tools/caffe.cpp:
 -gpu (Run in GPU mode on given device ID.) type: int32 default: -1
 -iterations (The number of iterations to run.) type: int32 default: 50
 -model (The model definition protocol buffer text file..) type: string
      default: ""
 -snapshot (Optional; the snapshot solver state to resume training.)
 type: string default: ""
 -solver (The solver definition protocol buffer text file.) type: string
 default: ""
 -weights (Optional; the pretrained weights to initialize finetuning. Cannot
      be set simultaneously with snapshot.) type: string default: ""
.build_release/test/test_all.testbin 0 --gtest_shuffle 
ERROR: something wrong with flag 'flagfile' in file '/root/glog-0.3.3/gflags-master/src/gflags.cc'.  One possibility: file '/root/glog-0.3.3/gflags-master/src/gflags.cc' is being linked both statically and dynamically into this executable.
make: *** [runtest] Error 1

我不明白如何解决这个错误。之前有人发现这个错误吗?我该如何解决?

最佳答案

无论您是否已经在其他地方解决了这个问题,我都会在这里发布答案以防其他人遇到同样的问题。

这个问题的出现似乎主要是因为我们并不总是正确地阅读事物并且盲目地遵循所有认为它们都适用于我们的情况的说明。 提示:他们没有。

在 Caffe 的安装说明(假设是 Ubuntu 说明)中,有一节说明:

Everything is packaged in 14.04.

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler

盲目无视下一个标题,上面写的很清楚:

Remaining dependencies, 12.04

我们继续安装这些依赖项,根据需要构建和安装,导致不幸的副作用是有 2 个版本的 libgflags,一个是动态的(在 /usr/lib[/x86_x64]/usr/local/lib

中的一个静态

分辨率

  1. 失败地向自己保证,下次我们会正确阅读说明。

  2. 卸载 libgflags

    sudo apt-get remove -y libgflags
    
  3. 删除make install版本

    sudo rm -f /usr/local/lib/libgflags.a /usr/local/lib/libgflags_nothreads.a
    sudo rm -rf  /usr/local/include/gflags
    
  4. 清理 Caffe 构建

    cd <path>/<to>/caffe
    make clean
    
  5. 重新安装 libgflags 包

    sudo apt-get install -y libgflags-dev
    
  6. 重建 Caffe

    make all
    make test
    make runtest
    

瞧瞧。所有测试现在都应该运行,您已准备好开启深度学习之旅。

关于c++ - Caffe 编译错误 : gflags. cc' 正在静态和动态链接到此可执行文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30475415/

相关文章:

c++ - 定义浮点等价关系的符合标准的方法

makefile - 是否可以将 "unset"设为 Makefile 中的环境变量?

c++ - CMake 与 Qt : moc creates . cpp_parameters 结束

c++ - 回复 Ping 广播

c - include_HEADERS 且没有 'all-am' 所需的目标规则

r - 如何从 R 执行生成文件

machine-learning - tensorflow 中的 RMSProp 优化器是否使用 Nesterov 动量?

python - Keras自定义损失函数错误: 'AttributeError: ' function' object has no attribute 'get_shape'

python - 如何在 LSTM Keras 中为多步多变量准备时间序列数据

c++ - 类包装器的模板特化