I don't understand how to create this file from google proto buffers? I've tried three time to reinstall caffe? From reading other threads it seems that it should be built when I compile caffe?
I'm trying to compile a project with a CMakeLists.txt, and I keep getting this error. I just don't get it?
Here's the exact output I get,
ajay@ajay-h8-1170uk:~$ cd /home/ajay/CppProjects/dqn_caffe/build
ajay@ajay-h8-1170uk:~/CppProjects/dqn_caffe/build$ cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ajay/CppProjects/dqn_caffe/build
ajay@ajay-h8-1170uk:~/CppProjects/dqn_caffe/build$ make
[ 50%] Building CXX object CMakeFiles/dqn.dir/dqn_main.cpp.o
In file included from /home/ajay/bin/caffe/include/caffe/caffe.hpp:7:0,
from /home/ajay/CppProjects/dqn_caffe/dqn.hpp:10,
from /home/ajay/CppProjects/dqn_caffe/dqn_main.cpp:7:
/home/ajay/bin/caffe/include/caffe/blob.hpp:5:34: fatal error: caffe/proto/caffe.pb.h: No such file or directory
#include "caffe/proto/caffe.pb.h"
^
compilation terminated.
make[2]: ** [CMakeFiles/dqn.dir/dqn_main.cpp.o] Error 1
make[1]: ** [CMakeFiles/dqn.dir/all] Error 2
make: *** [all] Error 2
and the CMakeLists.txt I using for cmake
cmake_minimum_required (VERSION 2.6)
project(dqn)
option(CPU_ONLY "Use CPU only for Caffe" ON)
option(USE_CUDNN "Use cuDNN for Caffe" OFF)
option(USE_SDL "Use SDL for ALE" ON)
include_directories(/home/ajay/bin/caffe/include)
include_directories(/usr/local/ale_cpp/ale_0.4.4/ale_0_4/src)
link_directories(/home/ajay/bin/caffe/build/lib)
link_directories(/usr/local/ale_cpp/ale_0.4.4/ale_0_4)
if(USE_CUDNN)
link_directories(~/cudnn-6.5-linux-R1)
endif()
add_executable(dqn dqn_main.cpp dqn.cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -march=native")
target_link_libraries(dqn caffe)
target_link_libraries(dqn glog)
target_link_libraries(dqn gflags)
target_link_libraries(dqn ale)
It definitely seems like its a problem with how I'm installing caffe, but it passes all the tests, and works for MNIST?
SOLVED BY MUUPAN!!
You need to generate caffe.pb.h manually using protoc as follows.
In the directory you installed Caffe to
protoc src/caffe/proto/caffe.proto --cpp_out=.
mkdir include/caffe/proto
mv src/caffe/proto/caffe.pb.h include/caffe/proto
I still get this issue and need to refer back to the above fix. I'm on ubuntu 15.10 if that matters. Seems like this should be fixed since it's an old problem and easy to run into. Kinda makes the system seem flakey in my view.
For anyone who still encounters this issue: Building with cmake, only use the files in the build/install directory for installation. In that folder, include/caffe/proto/caffe.pb.h is already properly generated and you can install with $ sudo cp -r install/* /usr, possibly replacing /usr with the directory you want to install into.
Thank you @AjayTalati :+1:
@AjayTalati When I tried to generate this file, I got an error "Expected field name". How can I save this problem? Should I upgrade protobuf?
Wow, good job! Save my time.
Most helpful comment
SOLVED BY MUUPAN!!
You need to generate caffe.pb.h manually using protoc as follows.
In the directory you installed Caffe to
protoc src/caffe/proto/caffe.proto --cpp_out=.
mkdir include/caffe/proto
mv src/caffe/proto/caffe.pb.h include/caffe/proto