PaddlePaddle / FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
https://www.paddlepaddle.org.cn/fastdeploy
Apache License 2.0
3k stars 465 forks source link

MacOS M1平台 ,使用预编译的lib编译example报错 #1346

Closed ANDROIDTODO closed 1 year ago

ANDROIDTODO commented 1 year ago

温馨提示:根据社区不完全统计,按照模板提问,可以加快回复和解决问题的速度


环境

问题日志及出现问题的操作流程

编译examples/vision/detection/fastestdet/cpp路径下时,出现如下错误

-- The path of ONNXRuntime is /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/onnxruntime/lib.
-- The path of OpenCV is /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv.
-- Found OpenCV: /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv (found version "3.4.16") 
-- 
-- *************FastDeploy Building Summary**********
--   CMake version             : 3.23.1
--   CMake command             : /opt/homebrew/Cellar/cmake/3.23.1/bin/cmake
--   System                    : Darwin
--   C++ compiler              : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
--   C++ compiler version      : 13.0.0.13000029
--   CXX flags                 : -Wno-format
--   WITH_GPU                  : OFF
--   ENABLE_ORT_BACKEND        : ON
--   ENABLE_RKNPU2_BACKEND     : OFF
--   ENABLE_SOPHGO_BACKEND     : OFF
--   ENABLE_PADDLE_BACKEND     : OFF
--   ENABLE_POROS_BACKEND      : OFF
--   ENABLE_OPENVINO_BACKEND   : OFF
--   ENABLE_TRT_BACKEND        : OFF
--   ENABLE_LITE_BACKEND       : OFF
--   ENABLE_TRT_BACKEND        : OFF
--   ENABLE_VISION             : ON
--   ENABLE_TEXT               : ON
--   ENABLE_ENCRYPTION         : OFF
--   DEPENDENCY_LIBS           : /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/lib/libfastdeploy.dylib;/Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/onnxruntime/lib/libonnxruntime.dylib;opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_shape;opencv_stitching;opencv_superres;opencv_video;opencv_videoio;opencv_videostab;/Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/fast_tokenizer/lib/libcore_tokenizers.dylib;/Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/paddle2onnx/lib/libpaddle2onnx.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/examples/vision/detection/fastestdet/cpp/build
(base) yangjun@yangjun build % make -j4
[ 50%] Building CXX object CMakeFiles/infer_demo.dir/infer.cc.o
[100%] Linking CXX executable infer_demo
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/lib/libfastdeploy.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/onnxruntime/lib/libonnxruntime.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_highgui.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_dnn.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_objdetect.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_ml.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_shape.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_stitching.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_superres.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_videostab.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/paddle2onnx/lib/libpaddle2onnx.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/fast_tokenizer/lib/libcore_tokenizers.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_calib3d.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_flann.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_features2d.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_photo.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_video.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_imgcodecs.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_videoio.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_core.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/yangjun/Downloads/fastdeploy-osx-arm64-1.0.3/third_libs/install/opencv/lib/libopencv_imgproc.3.4.16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "fastdeploy::RuntimeOption::UseTrtBackend()", referenced from:
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "fastdeploy::RuntimeOption::SetTrtInputShape(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<int, std::__1::allocator<int> > const&, std::__1::vector<int, std::__1::allocator<int> > const&, std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "fastdeploy::RuntimeOption::UseGpu(int)", referenced from:
      GpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "fastdeploy::vision::VisDetection(cv::Mat const&, fastdeploy::vision::DetectionResult const&, float, int, float)", referenced from:
      CpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      GpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "fastdeploy::vision::DetectionResult::Str()", referenced from:
      CpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      GpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "fastdeploy::vision::detection::FastestDet::Predict(cv::Mat const&, fastdeploy::vision::DetectionResult*)", referenced from:
      CpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      GpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "fastdeploy::vision::detection::FastestDet::FastestDet(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, fastdeploy::RuntimeOption const&, fastdeploy::ModelFormat const&)", referenced from:
      CpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      GpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "fastdeploy::FDTensor::FreeFn()", referenced from:
      fastdeploy::FDTensor::~FDTensor() in infer.cc.o
  "cv::Mat::~Mat()", referenced from:
      CpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      GpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "cv::String::deallocate()", referenced from:
      cv::String::~String() in infer.cc.o
  "cv::String::allocate(unsigned long)", referenced from:
      cv::String::String(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      cv::String::String(char const*) in infer.cc.o
  "cv::imread(cv::String const&, int)", referenced from:
      CpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      GpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "cv::imwrite(cv::String const&, cv::_InputArray const&, std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
      CpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      GpuInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
      TrtInfer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in infer.cc.o
  "vtable for fastdeploy::FastDeployModel", referenced from:
      fastdeploy::FastDeployModel::~FastDeployModel() in infer.cc.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for fastdeploy::vision::detection::FastestDet", referenced from:
      fastdeploy::vision::detection::FastestDet::~FastestDet() in infer.cc.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [infer_demo] Error 1
make[1]: *** [CMakeFiles/infer_demo.dir/all] Error 2
make: *** [all] Error 2
jiangjiajun commented 1 year ago

@ANDROIDTODO 刚检查发现文档中arm64的预编译包其实是x86平台的,请先使用如下的预编译包 https://bj.bcebos.com/fastdeploy/tests/fastdeploy-mac-arm64-0.0.0.tgz