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

Unable to build all exe in caffe2 in debug #1673

Open LaurentBerger opened 6 years ago

LaurentBerger commented 6 years ago

I have built caffe2 in release mode. Now I want to build in debug. MSVC gives 36 links errors in all projects giving an exe. Example for project convert_caffe_image_db :

1>------ Build started: Project: convert_caffe_image_db, Configuration: Debug x64 ------
1>caffe2.lib(image_input_op.obj) : error LNK2019: unresolved external symbol "bool __cdecl caffe2::TransformOnGPU<unsigned char,float,class caffe2::CPUContext>(class caffe2::Tensor<class caffe2::CPUContext> &,class caffe2::Tensor<class caffe2::CPUContext> *,class caffe2::Tensor<class caffe2::CPUContext> &,class caffe2::Tensor<class caffe2::CPUContext> &,class caffe2::CPUContext *)" (??$TransformOnGPU@EMVCPUContext@caffe2@@@caffe2@@YA_NAEAV?$Tensor@VCPUContext@caffe2@@@0@PEAV10@00PEAVCPUContext@0@@Z) referenced in function "public: virtual bool __cdecl caffe2::ImageInputOp<class caffe2::CPUContext>::CopyPrefetched(void)" (?CopyPrefetched@?$ImageInputOp@VCPUContext@caffe2@@@caffe2@@UEAA_NXZ)
1>caffe2.lib(image_input_op.obj) : error LNK2019: unresolved external symbol "bool __cdecl caffe2::TransformOnGPU<unsigned char,struct caffe2::__f16,class caffe2::CPUContext>(class caffe2::Tensor<class caffe2::CPUContext> &,class caffe2::Tensor<class caffe2::CPUContext> *,class caffe2::Tensor<class caffe2::CPUContext> &,class caffe2::Tensor<class caffe2::CPUContext> &,class caffe2::CPUContext *)" (??$TransformOnGPU@EU__f16@caffe2@@VCPUContext@2@@caffe2@@YA_NAEAV?$Tensor@VCPUContext@caffe2@@@0@PEAV10@00PEAVCPUContext@0@@Z) referenced in function "public: virtual bool __cdecl caffe2::ImageInputOp<class caffe2::CPUContext>::CopyPrefetched(void)" (?CopyPrefetched@?$ImageInputOp@VCPUContext@caffe2@@@caffe2@@UEAA_NXZ)
1>G:\Lib\caffe2\build\bin\Debug\convert_caffe_image_db.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "convert_caffe_image_db.vcxproj" -- FAILED.

Full output is here Nouveau document texte.txt

LaurentBerger commented 6 years ago

I found a bad way to solve this issue: i cannot find a preprocessor to disable when USE_CUDA is off. I have disable this code