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

Created on 11 Aug 2017  ·  16Comments  ·  Source: BVLC/caffe

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:\Anaconda2lib\site-packagesnumpy\core\include -IC:\Users\seeta-xpc.caffe\dependencieslibraries_v140_x64_py27_1.1.0libraries\include\boost-1_61 -IC:\Users\seeta-xpc.caffe\dependencieslibraries_v140_x64_py27_1.1.0libraries\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -IC:\Users\seeta-xpc.caffe\dependencieslibraries_v140_x64_py27_1.1.0libraries\include\opencv -I..\include -IC:\Users\seeta-xpc.caffe\dependencieslibraries_v140_x64_py27_1.1.0libraries\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\dependencieslibraries_v140_x64_py27_1.1.0libraries\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

Most helpful comment

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。

All 16 comments

I have the same error.

.caffe\dependencieslibraries_v140_x64_py27_1.1.0libraries\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

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 

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.

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.

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.

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

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.

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

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。

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

@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?

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

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

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

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

yeah, just use vs2015, rather not Ninja

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shiorioxy picture shiorioxy  ·  3Comments

OpenHero picture OpenHero  ·  3Comments

prathmeshrmadhu picture prathmeshrmadhu  ·  3Comments

LarsHH picture LarsHH  ·  3Comments

dfotland picture dfotland  ·  3Comments