我正在尝试按照此 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
分辨率
失败地向自己保证,下次我们会正确阅读说明。
卸载 libgflags
sudo apt-get remove -y libgflags
删除
make install
版本sudo rm -f /usr/local/lib/libgflags.a /usr/local/lib/libgflags_nothreads.a sudo rm -rf /usr/local/include/gflags
清理 Caffe 构建
cd <path>/<to>/caffe make clean
重新安装 libgflags 包
sudo apt-get install -y libgflags-dev
重建 Caffe
make all make test make runtest
瞧瞧。所有测试现在都应该运行,您已准备好开启深度学习之旅。
关于c++ - Caffe 编译错误 : gflags. cc' 正在静态和动态链接到此可执行文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30475415/