DeepTerrainRL icon indicating copy to clipboard operation
DeepTerrainRL copied to clipboard

How can I build this project on Ubuntu?

Open xiaoiker opened this issue 8 years ago • 36 comments

xiaoiker avatar Sep 27 '16 01:09 xiaoiker

Please see the README --> https://github.com/xbpeng/DeepTerrainRL#linux

Neo-X avatar Sep 27 '16 02:09 Neo-X

Do you build it successfully? I mean there isn't a CMakelist.txt . And in the #8, it said download external(https://github.com/xbpeng/DeepTerrainRL/releases/download/v1.0/TerrainRL-external-Linux.tar.gz) and extract it into DeepTerrainRL, do I also need do this? Thanks a lot!

xiaoiker avatar Sep 27 '16 11:09 xiaoiker

I build it successfully. You will need to download the external files. Then you will need to use premake4 to generste the make files.

Neo-X avatar Sep 27 '16 14:09 Neo-X

Thanks Neo-X, but I met a new problem while I builded it with make command, it's like this: external/caffe/build/src/caffe/proto/caffe.pb.h:17:2: error: #error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is ^ external/caffe/build/src/caffe/proto/caffe.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please ^ external/caffe/build/src/caffe/proto/caffe.pb.h:19:2: error: #error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of proton.

it seems the problem of the protobuf version, but I have already install the newest one(2.6) by: sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler

xiaoiker avatar Sep 28 '16 02:09 xiaoiker

@Neo-X can you please tell me the details about the build process,is it :

  1. ubuntu 16, cd(change dir to home) ~$ git clone https://github.com/xbpeng/DeepTerrainRL.git
  2. downloaded external(https://github.com/xbpeng/DeepTerrainRL/releases/download/v1.0/TerrainRL-external-Linux.tar.gz) and extract it into DeepTerrainRL ( should I change the caffe in it by this one: https://github.com/niuzhiheng/caffe.git @ 7b3e6f2341fe7374243ee0126f5cad1fa1e44e14)
    1. replace ~/DeepTerrainRL/external/caffe/src/caffe/proto/caffe.proto with ~/DeepTerrainRL/caffe_mods/caffe.proto
    2. replace ~/DeepTerrainRL/external/caffe/src/caffe/layers/memory_data_layer.cpp with ~/DeepTerrainRL/caffe_mods/memory_data_layer.cpp
    3. replace ~/DeepTerrainRL/external/caffe/include/caffe/layers/memory_data_layer.hpp with ~/DeepTerrainRL/caffe_mods/memory_data_layer.hpp
    4. ~/DeepTerrainRL$ premake4 gmake
    5. make

It that all right please?

xiaoiker avatar Sep 28 '16 13:09 xiaoiker

Yes that looks correct. make config=debug64 should work better

You might have to use an older version of protobuf which might have been included in the caffe/src/proto/ folder to use.

Neo-X avatar Sep 28 '16 17:09 Neo-X

You should not change the version of caffe.

Neo-X avatar Sep 28 '16 18:09 Neo-X

Thanks Neo-X, for the protobuf issue ,I found I should replace the caffe.pb.h and caffe.pb.cc in the external/caffe/build/src/caffe/proto. And the two files can be produce by cmd while you get into the external/caffe/:

protoc src/caffe/proto/caffe.proto --cpp_out=.

xiaoiker avatar Sep 29 '16 03:09 xiaoiker

@Neo-X and then I met this one: ==== Building TerrainRL (debug32) ==== NeuralNet.cpp In file included from learning/NeuralNet.cpp:2:0: external/caffe/include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory #include "hdf5.h" ^ compilation terminated. TerrainRL.make:314: recipe for target 'obj/x32/Debug/NeuralNet.o' failed make[1]: *** [obj/x32/Debug/NeuralNet.o] Error 1 Makefile:16: recipe for target 'TerrainRL' failed make: *** [TerrainRL] Error 2

I change the Makefile.confing file in external/caffe/ by add the inclue directory of/usr/include/hdf5/serial/ , but it still doesn't work.

xiaoiker avatar Sep 29 '16 05:09 xiaoiker

@xbpeng I found some thing wrong, you include the head files of Eigen ,but you didn't include the path of Eigen in premake4.lua, I don't understand!

xiaoiker avatar Sep 29 '16 06:09 xiaoiker

@Neo-X @xbpeng how about the 4rdparty file in the external? should I change it back to 3 ?

xiaoiker avatar Sep 29 '16 06:09 xiaoiker

@xiaoiker I could build this project and run on clean installation of Ubuntu 14.04

The following is the summary of my bash history. I did not need to touch Eigen or Caffe. (I might have built jsoncpp and bullet manually, but I don't remember clearly) https://gist.github.com/mthrok/db4a02afc36f571768df645d3fb0812c

@Neo-X It seems that learning/DMACETrainer - Copy.h and learning/DMACETrainer - Copy.cpp are not meant to be there. Naming is strange and learning/DMACELearner.h is missing. I had to delete them to build. Can you fix it?

mthrok avatar Sep 29 '16 16:09 mthrok

thanks for catching that, they have been removed.

xbpeng avatar Sep 29 '16 16:09 xbpeng

the issue with hdf5.h is a problem with using Ubuntu 16.04. See the solution here from the caffe issue https://github.com/BVLC/caffe/issues/2347. I could update the premake file but then it would only work on Ubuntu 16.04+.

Neo-X avatar Sep 29 '16 16:09 Neo-X

@xiaoiker The thridparty folder is not used on Linux. Only on Windows.

Neo-X avatar Sep 29 '16 16:09 Neo-X

@Neo-X I have successfully installed caffe on my Ubuntu16.04., it seems that the project can not find the hdf5.h. can you please give me the premake file for Ubuntu16.04

@mthrok Thanks.

xiaoiker avatar Oct 08 '16 07:10 xiaoiker

terrainnRL_premake4.zip

Put the premake4.lua file in the optimization folder. These should work...

Neo-X avatar Oct 08 '16 14:10 Neo-X

Thanks a lot! I have already successfully built this project on another Ubuntu14.04 machine.

Unfortunately, it still doesn't work on Ubuntu16.04 even with the new premake4 file., it says:

can not find the lcaffe from /usr/bin/ld

It is strange, because I found the libcaffe comes from external/caffe/build/ after build the project on the ubuntu14.04.

xiaoiker avatar Oct 10 '16 01:10 xiaoiker

Caffe should be copied into DeepTerrainRL/lib from external/caffe/build/lib

Neo-X avatar Oct 10 '16 13:10 Neo-X

Thanks @Neo-X , I built this project with the new premake4 file, It could not find the lcaffe from/usr/bin/ld

and then I build the caffe in the external,and the I get libcaffe.so. I make the project again,I get this kind of false no matter if can copy the lib into the DeepTerrainRL/lib directory or not.( Actually I didn't get a folder named lib in DeepTerrainRL, so I made one)

animation@Animation-HS:~/DeepTerrainRL$ make config=debug64 -j8 ==== Building TerrainRL (debug64) ==== ==== Building TerrainRL_Optimizer (debug64) ==== Linking TerrainRL_Optimizer Linking TerrainRL obj/x64/Debug/NNSolver.o: In function std::string* google::MakeCheckOpString<int, float>(int const&, float const&, char const*)': /usr/include/glog/logging.h:672: undefined reference togoogle::base::CheckOpMessageBuilder::NewString()' obj/x64/Debug/NNSolver.o: In function std::string* google::MakeCheckOpString<float, int>(float const&, int const&, char const*)': /usr/include/glog/logging.h:672: undefined reference togoogle::base::CheckOpMessageBuilder::NewString()' ../external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char_)' ../external/caffe/build/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)' ../external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream_, std::string_)' ../external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::Message::GetTypeName() const' ../external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::StringTypeHandlerBase::Delete(std::string_)' ../external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))' ../external/caffe/build/lib/libcaffe.so: undefined reference tocv::imencode(cv::String const&, cv::InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)' ../external/caffe/build/lib/libcaffe.so: undefined reference to leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)' ../external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::Message::DebugString() const' ../external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::StringTypeHandlerBase::New()' ../external/caffe/build/lib/libcaffe.so: undefined reference to cv::imdecode(cv::_InputArray const&, int)' ../external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::MessageLite::ParseFromString(std::string const&)' ../external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::internal::empty_string_' ../external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)' ../external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream_)' ../external/caffe/build/lib/libcaffe.so: undefined reference to leveldb::Status::ToString() const' ../external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::DescriptorPool::FindFileByName(std::string const&) const' ../external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream, std::string_)' ../external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::Message::InitializationErrorString() const' collect2: error: ld returned 1 exit status Makefile:208: recipe for target '../TerrainRL_Optimizer' failed make[1]: *_\* [../TerrainRL_Optimizer] Error 1 Makefile:20: recipe for target 'TerrainRL_Optimizer' failed make: **\* [TerrainRL_Optimizer] Error 2 make: **\* Waiting for unfinished jobs.... obj/x64/Debug/NNSolver.o: In function std::string* google::MakeCheckOpString<int, float>(int const&, float const&, char const*)': /usr/include/glog/logging.h:672: undefined reference togoogle::base::CheckOpMessageBuilder::NewString()' obj/x64/Debug/NNSolver.o: In function std::string* google::MakeCheckOpString<float, int>(float const&, int const&, char const*)': /usr/include/glog/logging.h:672: undefined reference togoogle::base::CheckOpMessageBuilder::NewString()' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::Message::InitializationErrorString() const' external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream_)' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char_)' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)' external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::Message::GetTypeName() const' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::Message::DebugString() const' external/caffe/build/lib/libcaffe.so: undefined reference tocv::imdecode(cv::InputArray const&, int)' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::internal::empty_string_' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::MessageLite::ParseFromString(std::string const&)' external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const_, int)' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::DescriptorPool::FindFileByName(std::string const&) const' external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream_, std::string_)' external/caffe/build/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)' external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::StringTypeHandlerBase::Delete(std::string_)' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))' external/caffe/build/lib/libcaffe.so: undefined reference toleveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB*_)' external/caffe/build/lib/libcaffe.so: undefined reference to cv::imencode(cv::String const&, cv::InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&)' external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::StringTypeHandlerBase::New()' external/caffe/build/lib/libcaffe.so: undefined reference to google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream)' external/caffe/build/lib/libcaffe.so: undefined reference to leveldb::Status::ToString() const' external/caffe/build/lib/libcaffe.so: undefined reference togoogle::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream)' collect2: error: ld returned 1 exit status TerrainRL.make:231: recipe for target 'TerrainRL' failed make[1]: *_* [TerrainRL] Error 1 Makefile:16: recipe for target 'TerrainRL' failed make: *** [TerrainRL] Error 2

xiaoiker avatar Oct 11 '16 02:10 xiaoiker

I seems like you don't have the good protobuf library installed. And maybe the leveldb library as well. maybe you should try a

premake4 clean

and then try and rebuild everything.

Neo-X avatar Oct 11 '16 16:10 Neo-X

Could you please specify which caffe version should be used for Ubuntu 16.04? Because it seems the version referred in the readme.md doesn't work.

ytian81 avatar Oct 18 '16 23:10 ytian81

The updated one in the external library compressed file with the most recent build is the correct version.

Neo-X avatar Oct 19 '16 06:10 Neo-X

I have tried the external library, and compile them with make conig=debug64. It complains about caffe proto file. I indeed regenerate the file, but it still doesn't work. The stdout and stderr files are as following.

log.txt log2.txt

Later on I tried the caffe version you mentioned in the readme file. (https://github.com/niuzhiheng/caffe). After I regenerate proto file for this caffe, proto problems disappeared, but it will complain about other problem like

learning/NeuralNet.h:5:46: fatal error: caffe/layers/memory_data_layer.hpp: No such file or directory
compilation terminated.

After I remedy these problems, it will complain other syntax problems, most of which should be about caffe problem.

BTW, I am using Ubuntu 16.04. I would appreciate it if you guys could give me more help on compiling.

ytian81 avatar Oct 19 '16 13:10 ytian81

The version from the compressed file is definutely the right one but you will need to recompile caffe after you download it. That version was compiled for Ubuntu 14.04. make sure you make clean everything thoroughly before you build.

Neo-X avatar Oct 19 '16 16:10 Neo-X

I updated the build instructions for Linux https://github.com/xbpeng/DeepTerrainRL/blob/master/README.md#linux-build-instructions

Neo-X avatar Oct 19 '16 16:10 Neo-X

@Neo-X Thanks very much. Those new added Linux instructions really help me a lot.

ytian81 avatar Oct 19 '16 18:10 ytian81

@tianyang9310 Great! let me know how it goes!

Neo-X avatar Oct 22 '16 19:10 Neo-X

I reinstall my system and the CUDA, rebulild the project with the external folder after replacing the premake4 files on my Ubuntu16.04, but I met this problem:

obj/x64/Debug/Character.o: In function cCharacter::ReadState(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/animation/mProject/DeepTerrainRL/optimizer/../anim/Character.cpp:247: undefined reference toJson::Value::operator[](std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' /home/animation/mProject/DeepTerrainRL/optimizer/../anim/Character.cpp:250: undefined reference to Json::Value::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /home/animation/mProject/DeepTerrainRL/optimizer/../anim/Character.cpp:254: undefined reference toJson::Value::operator[](std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' obj/x64/Debug/Character.o:/home/animation/mProject/DeepTerrainRL/optimizer/../anim/Character.cpp:257: more undefined references to `Json::Value::operator[](std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' follow collect2: error: ld returned 1 exit status Makefile:208: recipe for target '../TerrainRL_Optimizer' failed make[1]: *** [../TerrainRL_Optimizer] Error 1 Makefile:20: recipe for target 'TerrainRL_Optimizer' failed make: *** [TerrainRL_Optimizer] Error 2

should I build the Jason in the external files?

xiaoiker avatar Nov 03 '16 01:11 xiaoiker

Looks like you should rebuild the JSON library. From your earlier post you had it seemed like you should clean and rebuild from scratch using the command premake4 clean

Neo-X avatar Nov 03 '16 04:11 Neo-X