caffe icon indicating copy to clipboard operation
caffe copied to clipboard

run build_win.cmd build failed, could not find "pthread.h" on windows branch

Open afterimagex opened this issue 9 years ago • 16 comments

Please use the caffe-users list for usage, installation, or modeling questions, or other requests for help. Do not post such requests to Issues. Doing so interferes with the development of Caffe.

Please read the guidelines for contributing before submitting this issue.

Issue summary

Determining if the include file pthread.h exists failed with the following output: Change Dir: E:/caffe-windows/build/CMakeFiles/CMakeTmp

Run Build Command:"E:/Anaconda2/Library/bin/ninja.exe" "cmTC_41e79" [1/2] Building C object CMakeFiles\cmTC_41e79.dir\CheckIncludeFile.c.obj

FAILED: CMakeFiles/cmTC_41e79.dir/CheckIncludeFile.c.obj

C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe /nologo /DWIN32 /D_WINDOWS /W3 /MDd /Zi /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\cmTC_41e79.dir\CheckIncludeFile.c.obj /FdCMakeFiles\cmTC_41e79.dir\ /FS -c CheckIncludeFile.c

CheckIncludeFile.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory

ninja: build stopped: subcommand failed.

Steps to reproduce

If you are having difficulty building Caffe or training a model, please ask the caffe-users mailing list. If you are reporting a build error that seems to be due to a bug in Caffe, please attach your build configuration (either Makefile.config or CMakeCache.txt) and the output of the make (or cmake) command.

[168/218] Building CXX object python\CMakeFiles\pycaffe.dir\caffe_caffe.cpp.obj FAILED: python/CMakeFiles/pycaffe.dir/caffe/_caffe.cpp.obj C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe /nologo /TP -DBOOST_ALL_NO_LIB -DCAFFE_VERSION=1.0.0 -DCMAKE_WINDOWS_BUILD -DGLOG_NO_ABBREVIATED_SEVERITIES -DGOOGLE_GLOG_DLL_DECL=__declspec(dllimport) -DGOOGLE_GLOG_DLL_DECL_FOR_UNITTESTS=__declspec(dllimport) -DH5_BUILT_AS_DYNAMIC_LIB=1 -DUSE_CUDNN -DUSE_LEVELDB -DUSE_LMDB -DUSE_OPENCV -Dpycaffe_EXPORTS -Iinclude -I. -IE:\Anaconda2\include -IE:\Anaconda2\lib\site-packages\numpy\core\include -IC:\Users\seeta-xpc.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\include\boost-1_61 -IC:\Users\seeta-xpc.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -IC:\Users\seeta-xpc.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\include\opencv -I..\include -IC:\Users\seeta-xpc.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\Include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /FS /MD /O2 /Ob2 /DNDEBUG /FS /showIncludes /Fopython\CMakeFiles\pycaffe.dir\caffe_caffe.cpp.obj /Fdpython\CMakeFiles\pycaffe.dir\ /FS -c ..\python\caffe_caffe.cpp C:\Users\seeta-xpc.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\include\boost-1_61\boost/python/detail/caller.hpp(55): warning C4244: 'return': conversion from 'Py_ssize_t' to 'unsigned int', possible loss of data .\caffe/export.hpp(7): fatal error C1083: Cannot open include file: 'caffe/include_symbols.hpp': No such file or directory ninja: build stopped: subcommand failed. ERROR: Build failed

Your system configuration

Operating system: Windows10 Compiler: Ninja Cmake VS2015 CUDA version (if applicable): 8.0 CUDNN version (if applicable): 5.1 BLAS: script get Python or MATLAB version (for pycaffe and matcaffe respectively): Anaconda2.7-x64 matlab2016b

afterimagex avatar Aug 11 '17 09:08 afterimagex

I have the same error.

.caffe\dependencies\libraries_v140_x64_py27_1.1.0\libraries\include\boost-1_61\boost/python/detail/caller.hpp(55): warning C4244: 'return': conversion from 'Py_ssize_t' to 'unsigned int', possible loss of data .\caffe/export.hpp(7): fatal error C1083: Cannot open include file: 'caffe/include_symbols.hpp': No such file or directory ninja: build stopped: subcommand failed. ERROR: Build failed

yunau avatar Aug 17 '17 05:08 yunau

Not sure why CMake is looking for pthread.h.

Can you post (upload a txt file) the complete output of the following command:

ninja caffe.lib 

willyd avatar Aug 17 '17 19:08 willyd

It seems that CMake 3.9.1 is causing that sort of issues with the Ninja generator on CI builds. Best workaround might be to use the VS generator or downgrade CMake to 3.9.0 or 3.8.x.

willyd avatar Aug 22 '17 13:08 willyd

I tried building with CMake 3.8.2 instead of 3.9.1 The build wasn't stopped by an error in the command prompt, but the Cannot open include file: 'pthread.h' error still showed up in CMakeError.log.

Is CMakeError.log only generated when the build fails? Both builds have generated the dlls I need, but I'm not sure if the 3.8.2 build is succeeding or just failing silently.

skylarjhdownes avatar Aug 23 '17 23:08 skylarjhdownes

In my 3.8.2 build folder, running caffe\build\lib>ninja caffe.lib gives me the output ninja: error: loading 'build.ninja': The system cannot find the file specified.

skylarjhdownes avatar Aug 23 '17 23:08 skylarjhdownes

I have the same error ,did you figure it out or have other methods to install caffe in windows

marcosly avatar Sep 11 '17 11:09 marcosly

For me the successful path was to add

set(CMAKE_C_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe")
set(CMAKE_CXX_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe")

to the top of CMakeLists.txt, then to run .\scripts\build_win.cmd I just needed the .dll files (I also set the CMAKE_BUILD_SHARED_LIBS flag), so getting those compiled was where I stopped.

skylarjhdownes avatar Sep 11 '17 18:09 skylarjhdownes

i give it up... i change the project to https://github.com/Microsoft/caffe and build success

afterimagex avatar Sep 12 '17 04:09 afterimagex

I solved it. In your caffe/build dir,you can find include_symbols.hpp file(Problem: This dir do not pass to cl.exe by '-I' parameter,But this file created by build_win.cmd script。 )。Then,It is easy to go cool。

Do copy include_symbols.hpp file to caffe/include/caffe/ ,then you will solved it。 Hope to help you。

flyinskyin2013 avatar Dec 18 '17 09:12 flyinskyin2013

I have met this problem,too. 错误 C1083 无法打开包括文件: “caffe/include_symbols.hpp”: No such file or directory device_query E:\caffe-build\caffe\export.hpp 7 And I search for the directory,but I couldn't find it anywhere.

Finally,I find the one project named caffe.bin_install_prerequisites in the right area of vs2015's solution view. When I finish building this project ,I find the include_symbols.hpp file in my directory: {caffe-build-dir}/caffe/include_symbols.hpp.

Last, I want to remember you that you should build the ALL_BUILD Target

ghost avatar Jan 06 '18 08:01 ghost

@Xmagicer Dear friend, I have also met this problem. I have rebuilt the project "caffe.bin_install_prerequisties", but there is still no "include_symbols.hpp" in my directory(caffe-build-dir/caffe). There is only "export.hpp" in my directory. Do you had any other operations?

yinyue1011 avatar Jan 09 '18 15:01 yinyue1011

Thanks to @willyd ! I downgrade CMake(ver 3.10) to CMake(3.6.4), and it seems to be working fine till now.

Site1997 avatar Jan 13 '18 12:01 Site1997

I solved it

in my case, I'd git-cloned at D:\...\[STUDY] Caffe\...\ so location was D:\...\[STUDY] Caffe\...\caffe\ building caffe many times, I do changed many many options but C1083 still there and after I eventually moved to D:\...\TEST\...\ building has been successful

as you see, that folder name [STUDY] Caffe was the problem you shouldn't put the blank in folder name I've struggled with this shit for 2 days...uninstalling and installing VS & Python

BaeMinCheon avatar May 15 '18 08:05 BaeMinCheon

This helped me: https://groups.google.com/forum/#!topic/caffe-users/kWuf4L0dwmM

russoen avatar Sep 12 '18 23:09 russoen

This helped me: https://groups.google.com/forum/#!topic/caffe-users/kWuf4L0dwmM

yeah, just use vs2015, rather not Ninja

taojianggit avatar Dec 13 '18 02:12 taojianggit

hi, i have solved this by changing folder permission to full control to caffe build folder.

EMCL avatar Apr 06 '19 04:04 EMCL