过去一周,我一直在尝试在带有 cuda 的 Windows 10 系统上编译 caffe2。该库显然还没有为 Windows 版本做好准备,因为在安装过程中出现了很多问题。
在对 CMake 进行各种调整并在 git bash 窗口中运行之后,我终于能够取得一些进展并开始构建库,直到遇到这个问题。
"D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj"(▒⺻ ▒▒▒)(16)->
(CustomBuild ▒▒▒) ->
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(227): error : member "caffe2::TensorProto_Segment::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(349): error : member "caffe2::TensorProto::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(660): error : member "caffe2::QTensorProto::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(847): error : member "caffe2::TensorProtos::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(959): error : member "caffe2::TensorShape::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(1122): error : member "caffe2::TensorShapes::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(1234): error : member "caffe2::Argument::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(1463): error : member "caffe2::DeviceOption::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(1620): error : member "caffe2::OperatorDef::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(1895): error : member "caffe2::NetDef::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(2124): error : member "caffe2::ExecutionStep::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(2401): error : member "caffe2::PlanDef::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(2544): error : member "caffe2::BlobProto::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
D:/Projects/Caffe2/caffe2/build\caffe2/proto/caffe2.pb.h(2741): error : member "caffe2::DBReaderProto::kIndexInFileMessages" may not be initialized [D:\Projects\Caffe2\caffe2\build\caffe2\caffe2_gpu.vcxproj]
是什么导致了错误“ :: kIndexInFileMessages”可能未初始化“?我检查了有问题的代码,我没有看到任何特别的东西。这些值是在caffe2.pb.h文件中启动的。
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const TensorProto_Segment* internal_default_instance() {
return reinterpret_cast<const TensorProto_Segment*>(
&_TensorProto_Segment_default_instance_);
}
static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 0;
这是我的构建设置的摘要:
-- ******** Summary ********
-- General:
-- CMake version : 3.11.0
-- CMake command : C:/Program Files (x86)/CMake/bin/cmake.exe
-- Git version : v0.8.1-1500-g0dd328452-dirty
-- System : Windows
-- C++ compiler : C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- C++ compiler version : 19.0.24215.1
-- BLAS : Eigen
-- CXX flags : /DWIN32 /D_WINDOWS /W3 /GR /EHsc -DONNX_NAMESPACE=onnx_c2 /MP /bigobj
-- Build type : Release
-- Compile definitions : PROTOBUF_USE_DLLS
--
-- BUILD_BINARY : ON
-- BUILD_CUSTOM_PROTOBUF : OFF
-- Protobuf compiler : Protobuf_PROTOC_EXECUTABLE-NOTFOUND
-- Protobuf includes :
-- Protobuf libraries : Protobuf_LIBRARY-NOTFOUND
-- BUILD_DOCS : OFF
-- BUILD_PYTHON : ON
-- Python version : 2.7.14
-- Python includes : C:/Python27/include
-- BUILD_SHARED_LIBS : ON
-- BUILD_TEST : OFF
-- USE_ATEN : OFF
-- USE_ASAN : OFF
-- USE_CUDA : ON
-- CUDA version : 9.1
-- CuDNN version : 7.1.2
-- CUDA root directory : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1
-- CUDA library : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/lib/x64/cuda.lib
-- CUDA NVRTC library : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/lib/x64/nvrtc.lib
-- CUDA runtime library: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/lib/x64/cudart.lib
-- CUDA include path : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/include
-- NVCC executable : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/bin/nvcc.exe
-- CUDA host compiler : $(VCInstallDir)bin
-- USE_EIGEN_FOR_BLAS : 1
-- USE_FFMPEG : OFF
-- USE_GFLAGS : OFF
-- USE_GLOG : OFF
-- USE_GLOO : OFF
-- USE_LEVELDB : OFF
-- USE_LITE_PROTO : OFF
-- USE_LMDB : OFF
-- USE_METAL : OFF
-- USE_MKL :
-- USE_MOBILE_OPENGL : OFF
-- USE_MPI : OFF
-- USE_NCCL : OFF
-- USE_NERVANA_GPU : OFF
-- USE_NNPACK : OFF
-- USE_OBSERVERS : ON
-- USE_OPENCV : OFF
-- USE_OPENMP : OFF
-- USE_PROF : OFF
-- USE_REDIS : OFF
-- USE_ROCKSDB : OFF
-- USE_ZMQ : OFF
-- Configuring done
BUILD_CUSTOM_PROTOBUF 已关闭,以便它可以构建随 caffe2 源文件一起提供的 protobuf 库。