ncnn icon indicating copy to clipboard operation
ncnn copied to clipboard

clang: error: linker command failed with exit code 1

Open CheungBH opened this issue 2 years ago • 3 comments

Hello. Thanks for your great work. I am building ncnn for Macos. However, some error occurs while building with "cmake --build . -j 4"

clang: error: linker command failed with exit code 1 (use -v to see invocation) "google::protobuf::Message::InitializationErrorString() const", referenced from: vtable for caffe::Yolov3DetectionOutputParameter in caffe.pb.cc.o vtable for caffe::YoloDetectionOutputParameter in caffe.pb.cc.o vtable for caffe::WindowDataParameter in caffe.pb.cc.o vtable for caffe::TransformationParameter in caffe.pb.cc.o vtable for caffe::TileParameter in caffe.pb.cc.o vtable for caffe::ThresholdParameter in caffe.pb.cc.o vtable for caffe::TanHParameter in caffe.pb.cc.o ... "google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const", referenced from: caffe::BlobShape::ByteSizeLong() const in caffe.pb.cc.o caffe::BlobProto::ByteSizeLong() const in caffe.pb.cc.o caffe::BlobProtoVector::ByteSizeLong() const in caffe.pb.cc.o caffe::Datum::ByteSizeLong() const in caffe.pb.cc.o caffe::FillerParameter::ByteSizeLong() const in caffe.pb.cc.o caffe::NetParameter::ByteSizeLong() const in caffe.pb.cc.o caffe::SolverParameter::ByteSizeLong() const in caffe.pb.cc.o ... "google::protobuf::internal::TaggedStringPtr::ForceCopy(google::protobuf::Arena*) const", referenced from: caffe::Datum::Datum(google::protobuf::Arena*, caffe::Datum const&) in caffe.pb.cc.o caffe::FillerParameter::FillerParameter(google::protobuf::Arena*, caffe::FillerParameter const&) in caffe.pb.cc.o caffe::FillerParameter::FillerParameter(google::protobuf::Arena*, caffe::FillerParameter const&) in caffe.pb.cc.o caffe::NetParameter::NetParameter(google::protobuf::Arena*, caffe::NetParameter const&) in caffe.pb.cc.o caffe::SolverParameter::SolverParameter(google::protobuf::Arena*, caffe::SolverParameter const&) in caffe.pb.cc.o caffe::SolverState::SolverState(google::protobuf::Arena*, caffe::SolverState const&) in caffe.pb.cc.o caffe::SolverState::SolverState(google::protobuf::Arena*, caffe::SolverState const&) in caffe.pb.cc.o ... "typeinfo for google::protobuf::Message", referenced from: typeinfo for caffe::Yolov3DetectionOutputParameter in caffe.pb.cc.o typeinfo for caffe::YoloDetectionOutputParameter in caffe.pb.cc.o typeinfo for caffe::WindowDataParameter in caffe.pb.cc.o typeinfo for caffe::TransformationParameter in caffe.pb.cc.o typeinfo for caffe::TileParameter in caffe.pb.cc.o typeinfo for caffe::ThresholdParameter in caffe.pb.cc.o typeinfo for caffe::TanHParameter in caffe.pb.cc.o ... ld: symbol(s) not found for architecture x86_64 make[2]: *** [tools/onnx/onnx2ncnn] Error 1 make[1]: *** [tools/onnx/CMakeFiles/onnx2ncnn.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [tools/caffe/caffe2ncnn] Error 1 make[1]: *** [tools/caffe/CMakeFiles/caffe2ncnn.dir/all] Error 2 [ 65%] Built target glslang [ 66%] Built target SPIRV make: *** [all] Error 2

Are there any suggestions for solving it?

CheungBH avatar Dec 30 '23 08:12 CheungBH

I am building it with macOS using A1 chip. And I downloaded protobuf using "brew install protobuf"

CheungBH avatar Dec 30 '23 08:12 CheungBH

https://github.com/Tencent/ncnn/wiki/faq

sxj731533730 avatar Jan 19 '24 02:01 sxj731533730

You can skip building tools via cmake option -DNCNN_BUILD_TOOLS=OFF and use the prebuilt pnnx tools here for converting torch model to ncnn ---> https://github.com/pnnx/pnnx

nihui avatar Mar 28 '24 11:03 nihui

针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn

pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]

详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx

nihui avatar Aug 05 '24 09:08 nihui