facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.95k forks source link

CMake Error at cmake/ProtoBuf.cmake:21 on windows 10 #392

Open gino0717 opened 7 years ago

gino0717 commented 7 years ago

hi, I try to build the caffe2 for visual studio 2015 on windows 10 by cmake, and always display these message:

FIND: Parameter format not correct

fatal: Not a git repository (or any of the parent directories): .git

CMake Error at cmake/ProtoBuf.cmake:21 (message): To build protobufs locally (required for Android/iOS/Windows), you will need to manually specify a PROTOBUF_PROTOC_EXECUTABLE. See scripts/build_host_protoc.{sh,bat} for more details.

Call Stack (most recent call first): cmake/ProtoBuf.cmake:32 (custom_protobuf_find) cmake/Dependencies.cmake:6 (include) CMakeLists.txt:85 (include)

I tried anaconda protobuf, binary protobuf , build from the source code and run the bash to compile the protobuf in the caffe2, and get the same results. What should I do to solve this problem?

ezineo commented 7 years ago

It is suggested to run CAFFE2_ROOT/scripts/build_windows.bat when building caffe2 on windows, which CAFFE2_ROOT means the root dir where your caffe2 cloned into.

gino0717 commented 7 years ago

hi ezineo, thanks for your reply. I run the build_windows.bat and I expect there would generate something like a folder and some files inside, but I can see only an empty build folder. does it means I should use visual studio 2017 to do this?

ezineo commented 7 years ago

Change this line: https://github.com/caffe2/caffe2/blob/master/scripts/build_windows.bat#L37 to

set CMAKE_GENERATOR="Visual Studio 14 2015 Win64"
gino0717 commented 7 years ago

thank you! now I see many files and Caffe2.sln in my build folder! you are so good!

sleeplessai commented 7 years ago

It seems that Caffe2 is hard to compile successfully as far. I wonder what dependencies you have installed for a VS-build version Caffe2? Make a list for me, please. :)

gino0717 commented 7 years ago

hi daydreamcoder, I install CUDA, visual stuio2015, cmake, and python2.7.13(numpy,protobuf...) and I don't install the optional dependencies because I think they are optional.However, I expect without them there would be some problem.

cda-gti-upm commented 7 years ago

Hi, I have the same problem as gino0717, but the provided solution doesn't help me because I have installed Visual Studio Community Edition 2017. How can I solve the problem? Thanks in advance.

In more detail, I have followed the instructions in [https://caffe2.ai/docs/getting-started.html?platform=windows&configuration=compile#null__install-glog-gflags-and-other-related-dependencies] for windows 10, with Visual Studio Community Edition 2017, and I have installed all the required and optional dependencies. And after cloning the project, I have executed the build_windows.bat in Administrator mode. This the full error message:

C:\Users\cda\Documents\myData\Trabajo\Code\caffe2\build>if NOT DEFINED CMAKE_GENERATOR (if DEFINED APPVEYOR_BUILD_WORKER_IMAGE (if "" == "Visual Studio 2017" (set CMAKE_GENERATOR="Visual Studio 15 2017 Win64" ) else if "" == "Visual Studio 2015" (set CMAKE_GENERATOR="Visual Studio 14 2015 Win64" ) else ( echo "You made a programming error: unknown APPVEYOR_BUILD_WORKER_IMAGE:" echo exit /b ) ) else (set CMAKE_GENERATOR="Visual Studio 14 2015 Win64" ) )

C:\Users\cda\Documents\myData\Trabajo\Code\caffe2\build>cmake .. -G"Visual Studio 15 2017 Win64" -DCMAKE_VERBOSE_MAKEFILE=1 -DBUILD_TEST=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DUSE_CUDA=OFF -DPROTOBUF_PROTOC_EXECUTABLE=C:\Users\cda\Documents\myData\Trabajo\Code\caffe2\scripts..\build_host_protoc\bin\protoc.exe || exit /b FIND: Parameter format not correct CMake Error at cmake/ProtoBuf.cmake:21 (message): To build protobufs locally (required for Android/iOS/Windows), you will need to manually specify a PROTOBUF_PROTOC_EXECUTABLE. See scripts/build_host_protoc.{sh,bat} for more details. Call Stack (most recent call first): cmake/ProtoBuf.cmake:32 (custom_protobuf_find) cmake/Dependencies.cmake:6 (include) CMakeLists.txt:85 (include)

-- Configuring incomplete, errors occurred! See also "C:/Users/cda/Documents/myData/Trabajo/Code/caffe2/build/CMakeFiles/CMakeOutput.log". See also "C:/Users/cda/Documents/myData/Trabajo/Code/caffe2/build/CMakeFiles/CMakeError.log".

sleeplessai commented 7 years ago

Hi @gino0717 Now I switched my OS to Ubuntu 17.04 and successfully compiled Caffe 2. Whatever, for sci-computing, I recommend Anaconda 2 that supports Windows and Linux both well. Quickly get to work with it. 👍

gino0717 commented 7 years ago

hi all, now even I have some .sln to install the caffe2, I lose all of the .lib name of additional dependencies in properties in visual studio so I cannot compile any file. I have nowhere to find the name of the *.lib in the caffe2.sln. what should I do? I think I should download a virtual machine and build a Ubuntu environment as @daydreamcoder