(参考 https://github.com/lemonsqueeze/mingw-caffe )
有关需要安装的工具,上面这篇已经说的很明白了,照搬于下。
pacman -S git make patch diffutils
# 32-bit build:
pacman -S mingw32/mingw-w64-i686-tools-git # gendef, dlltool
pacman -S mingw32/mingw-w64-i686-gcc
pacman -S mingw32/mingw-w64-i686-boost
pacman -S mingw32/mingw-w64-i686-protobuf-c
pacman -S mingw32/mingw-w64-i686-gflags
pac服务器托管网man -S mingw32/mingw-w64-i686-glog
pacman -S mingw32/mingw-w64-i686-hdf5
pacman -S mingw32/mingw-w64-i686-openblas
# 64-bit build:
pacman -S mingw64/mingw-w64-x86_64-tools-git # gendef, dlltool
pacman -S mingw64/mingw-w64-x86_64-gcc
pacman -S mingw64/mingw-w64-x86_64-boost
pacman -S mingw64/mingw-w64-x86_64-protobuf-c
pacman -S mingw64/mingw-w64-x86_64-gflags
pacman -S mingw64/mingw-w64-x86_64-glog
pacman -S mingw64/mingw-w64-x86_64-hdf5
pacman -S mingw64/mingw-w64-x86_64-openblas
还要下载 caffe 源代码
wget https://github.com/BVLC/caffe/archive/refs/tags/1.0.tar.gz
tar xf 1.0.tar.gz
cd caffe
Error 1:
/home/rd/NN/caffe/src/caffe/layers/window_data_layer.cpp: In member function ‘virtual void caffe::WindowDataLayer::load_batch(caffe::Batch*)’:
/home/rd/NN/caffe/src/caffe/layers/window_data_layer.cpp:293:42: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
293 | cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
| ^~~~~~~~~~~~~~~~~~~
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/build.make:1090:src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:400:src/caffe/CMakeFiles/caffe.dir/all] 错误 2
Root Cause : codes for opencv2 or opencv3 are not compatiable to opencv4, so add below codes
Solution :
#if (CV_MAJOR_VERSION > 3)
#include "opencv2/imgcodecs/legacy/constants服务器托管网_c.h"
#endif
Error 2:
home/rd/NN/caffe/src/caffe/util/io.cpp: In function ‘bool caffe::ReadProtoFromBinaryFile(const char*, google::protobuf::Message*)’:
/home/rd/NN/caffe/src/caffe/util/io.cpp:60:66: error: no matching function for call to ‘google::protobuf::io::CodedInputStream::SetTotalBytesLimit(const int&, int)’
60 | coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
Root Cause : refer to https://github.com/onnx/onnx/issues/2678
Solution :
#if GOOGLE_PROTOBUF_VERSION >= 3002000
coded_input->SetTotalBytesLimit(kProtoReadBytesLimit);
#else
coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
#endif
Error 3:
/usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5′ can not be used when making a shared object;
Root Cause:
refer to https://github.com/BVLC/caffe/issues/2171, 2016-08-26/2022-06-21
Solution :
libgflags library is not built as shared. You may recompile it with below commands
cd build/
cmake .. -DBUILD_SHARED_LIBS=ON
make
sudo make install
Error 4:
/usr/bin/ld: common.cc:(.text+0x29e): undefined reference to `absl::lts_20230125::log_internal::LogMessageFatal::~LogMessageFatal()’
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net