unresolved void __cdecl caffe::caffe_gpu_dot on windows7 64bit
I built the caffe on windows7 with windows branch, and I followed the instruction, but there is an error:
错误 1 error LNK2019: 无法解析的外部符号 "void __cdecl caffe::caffe_gpu_dot<float>(int,float const *,float const *,float *)" (??$caffe_gpu_dot@M@caffe@@YAXHPEBM0PEAM@Z),该符号在函数 "public: float __cdecl caffe::Layer<float>::Forward(class std::vector<class caffe::Blob<float> *,class std::allocator<class caffe::Blob<float> *> > const &,class std::vector<class caffe::Blob<float> *,class std::allocator<class caffe::Blob<float> *> > const &)" (?Forward@?$Layer@M@caffe@@QEAAMAEBV?$vector@PEAV?$Blob@M@caffe@@V?$allocator@PEAV?$Blob@M@caffe@@@std@@@std@@0@Z) 中被引用 D:\development\caffe-windows\build\tools\caffe.obj caffe.bin
I found the function in math_functions.cu, but it cannot be linked. How to solve it ?
I have solved the problem. I found that if I use "visual studio" to generate, the problem still exists. But if I use ninjia, it disappears. So it's the bug of visual studio generator.
I attach my installation code here:
cd caffe-windows
#download the pre-built dependencies,
#and extract to here. Now there should be a directory named "libraries"
set CMAKE_GENERATOR=Ninja
set CMAKE_CONFIGURATION=Release
mkdir build
cd build
cmake -G%CMAKE_GENERATOR% -DBLAS=Open -DCMAKE_BUILD_TYPE=%CMAKE_CONFIGURATION% -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./install/ -C ..\libraries\caffe-builder-config.cmake ..\
cmake --build . --config %CMAKE_CONFIGURATION%
cmake --build . --config %CMAKE_CONFIGURATION% --target install
I met another problem: `
import caffe Traceback (most recent call last): File "
", line 1, in File "caffe__init__.py", line 1, in from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSol ver File "caffe\pycaffe.py", line 13, in from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: DLL load failed: 找不到指定的模块。 ` I solved it by copying all the dll and lib including the pre-built dependencies to the python\caffe.
@thesby Can you post the configuration summary from the CMake configure for the Visual Studio Generator and the Ninja generator?
The build works with both CUDA and CPU_ONLY with VS 2013 and 2015 on appveyor. Must be a setting of your machine. Please specify the exact version of the compiler VS version plus update?
ImportError: DLL load failed: 找不到指定的模块。
The DLL's where missing from your PATH. If you call the dependencies prependpath.bat this problem should disappear.
Yes, my computer environment is win7 64bit, visual studio 2013 ultimate. I followed the instructions of appveyor.
If I use Visual Studio Generator, error will happen that "void __cdecl caffe::caffe_gpu_dot
This is weird it should work with either generator.
Can you post the two CMakeCache.txt for each generator?
Can you pipe the CMake configure and build commands to files and attach them here too?
The following is my operation.
D:\>cd development
D:\development>cd draft
D:\development\draft>cd caffe-windows
D:\development\draft\caffe-windows>call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" amd64
D:\development\draft\caffe-windows>set CMAKE_GENERATOR="Visual Studio 12 2013 Win64"
D:\development\draft\caffe-windows>set CMAKE_CONFIGURATION=Release
D:\development\draft\caffe-windows>mkdir build
D:\development\draft\caffe-windows>cd build
D:\development\draft\caffe-windows\build>cmake -G%CMAKE_GENERATOR% -DBLAS=Open -DCMAKE_BUILD_TYPE=%CMAKE_CONFI
GURATION% -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=<install_path> -C ..\libraries\caffe-builder-config.c
make ..\
系统找不到指定的文件。
D:\development\draft\caffe-windows\build>cmake -G%CMAKE_GENERATOR% -DBLAS=Open -DCMAKE_BUILD_TYPE=%CMAKE_CONFI
GURATION% -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=.\install\ -C ..\libraries\caffe-builder-config.cmake
..\
loading initial cache file ..\libraries\caffe-builder-config.cmake
-- The C compiler identification is MSVC 18.0.21005.1
-- The CXX compiler identification is MSVC 18.0.21005.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -
- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Boost version: 1.61.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found GFlags: D:/development/draft/caffe-windows/libraries/include
-- Found gflags (include: D:/development/draft/caffe-windows/libraries/include, library: gflags_shared)
-- Found Glog: D:/development/draft/caffe-windows/libraries/include
-- Found glog (include: D:/development/draft/caffe-windows/libraries/include, library: glog)
-- Found Protobuf: D:/development/draft/caffe-windows/libraries/bin/protoc.exe (found version "3.1.0")
-- Found PROTOBUF Compiler: D:/development/draft/caffe-windows/libraries/bin/protoc.exe
-- Found LMDB: D:/development/draft/caffe-windows/libraries/include
-- Found lmdb (include: D:/development/draft/caffe-windows/libraries/include, library: lmdb)
-- Found LevelDB: D:/development/draft/caffe-windows/libraries/include
-- Found LevelDB (include: D:/development/draft/caffe-windows/libraries/include, library: leveldb)
-- Found ZLIB: optimized;D:/development/draft/caffe-windows/libraries/lib/caffezlib.lib;debug;D:/development/d
raft/caffe-windows/libraries/lib/caffezlibd.lib (found version "1.2.8")
-- Found Snappy: D:/development/draft/caffe-windows/libraries/include
-- Found Snappy (include: D:/development/draft/caffe-windows/libraries/include, library: snappy_static;optimi
zed;D:/development/draft/caffe-windows/libraries/lib/caffezlib.lib;debug;D:/development/draft/caffe-windows/li
braries/lib/caffezlibd.lib)
-- CUDA detected: 8.0
-- Added CUDA NVCC flags for: sm_30
-- OpenCV found (D:/development/draft/caffe-windows/libraries)
-- Found OpenBLAS libraries: D:/development/draft/caffe-windows/libraries/lib/libopenblas.dll.a
-- Found OpenBLAS include: D:/development/draft/caffe-windows/libraries/include
-- Found PythonInterp: D:/development/anaconda/python.exe (found suitable version "2.7.12", minimum required i
s "2.7")
-- Found PythonLibs: D:/development/anaconda/libs/python27.lib (found suitable version "2.7.12", minimum requi
red is "2.7")
-- Found NumPy: D:/development/anaconda/lib/site-packages/numpy/core/include (found suitable version "1.11.1",
minimum required is "1.7.1")
-- NumPy ver. 1.11.1 found (include: D:/development/anaconda/lib/site-packages/numpy/core/include)
-- Boost version: 1.61.0
-- Found the following Boost libraries:
-- python
-- Found Git: D:/Program Files/Git/cmd/git.exe (found version "2.9.0.windows.1")
--
-- ******************* Caffe Configuration Summary *******************
-- General:
-- Version : 1.0.0-rc3
-- Git : unknown
-- System : Windows
-- C++ compiler : C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
-- Release CXX flags : /MD /O2 /Ob2 /DNDEBUG /DWIN32 /D_WINDOWS /W3 /GR /EHsc
-- Debug CXX flags : /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 /DWIN32 /D_WINDOWS /W3 /GR /EHsc
-- Build type : Release
--
-- BUILD_SHARED_LIBS : OFF
-- BUILD_python : ON
-- BUILD_matlab :
-- BUILD_docs :
-- CPU_ONLY : OFF
-- USE_OPENCV : ON
-- USE_LEVELDB : ON
-- USE_LMDB : ON
-- ALLOW_LMDB_NOLOCK : OFF
--
-- Dependencies:
-- BLAS : Yes (Open)
-- Boost : Yes (ver. 1.61)
-- glog : Yes
-- gflags : Yes
-- protobuf : Yes (ver. 3.1.0)
-- lmdb : Yes (ver. 0.9.70)
-- LevelDB : Yes (ver. 1.18)
-- Snappy : Yes (ver. 1.1.1)
-- OpenCV : Yes (ver. 3.1.0)
-- CUDA : Yes (ver. 8.0)
--
-- NVIDIA CUDA:
-- Target GPU(s) : Auto
-- GPU arch(s) : sm_30
-- cuDNN : Not found
--
-- Python:
-- Interpreter : D:/development/anaconda/python.exe (ver. 2.7.12)
-- Libraries : D:/development/anaconda/libs/python27.lib (ver 2.7.12)
-- NumPy : D:/development/anaconda/lib/site-packages/numpy/core/include (ver 1.11.1)
--
-- Install:
-- Install path : D:/development/draft/caffe-windows/build/install
--
-- Configuring done
-- Generating done
-- Build files have been written to: D:/development/draft/caffe-windows/build
This line is wrong (install path is not specified correctly)
D:\development\draft\caffe-windows\build>cmake -G%CMAKE_GENERATOR% -DBLAS=Open -DCMAKE_BUILD_TYPE=%CMAKE_CONFI GURATION% -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=<install_path> -C ..\libraries\caffe-builder-config.c make ..\
but I see that you have the correct command below:
D:\development\draft\caffe-windows\build>cmake -G%CMAKE_GENERATOR% -DBLAS=Open -DCMAKE_BUILD_TYPE=%CMAKE_CONFI GURATION% -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=.\install\ -C ..\libraries\caffe-builder-config.cmake ..\
Try to remove the first command but I doubt it will fix the problem.
Can you post a build log file? If you build from the command line using cmake --build . --config Release > buildlog.txt
In your build directory you can find caffe/include_symbols.hpp can you compare both versions (Ninja and VS) or post them.
Once again, I doubt that this will change anything but it is worth a try to update to the latest VS. I see that you have MSVC 18.0.21005.1 and appveyor has MSVC 18.0.40629.0.
Hi @willyd , I have the same problem, I use cmake for generating a Visual Studio 14 2015 Win64 solution. However, I have no caffe/include_symbols.hpp file in my build folder, what should it include?
The error occurs only for caffe.bin and test.testbin projects, the are projects are linking fine.
I have Visual Studio Professional 2015 Update 3, I attached the CMakeCache.txt thanks!
CMakeCache.txt
This seems to be an upstream CMake issue with the WINDOWS_EXPORT_ALL_SYMBOLS not picking up the CUDA object files. I will report an issue to CMake's development and check if a work around can be implemented. For those who want to build a DLL use the Ninja generator.
I can reproduce the same issue when trying to build a dll on Win10 / VS 2015 Update 3.
I raised an issue upstream on CMake's issue tracker: https://gitlab.kitware.com/cmake/cmake/issues/16552.
This should now be fixed if using CMake 3.8 as mentioned here: https://gitlab.kitware.com/cmake/cmake/issues/16552#note_238471