PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed building C++ inference demo, getting error "undefined reference to"

csho opened this issue · comments

commented

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:docker image (centos7, alpine)
  • 版本号/Version:Paddle:manylinux_cpu_avx_mkl_gcc8.2 2.3.0, also tried avx_openblas, noavx_openblas versions
  • PaddleOCR:release/2.5 问题相关组件/Related components:cpp_infer
  • 运行指令/Command Code:sh tools/build.sh
  • 完整报错/Complete Error Message:
    -- The CXX compiler identification is GNU 7.3.1 -- The C compiler identification is GNU 7.3.1 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Found OpenCV: /opt/app-root/src/opencv3 (found version "3.4.7") cmake cxx flags -g -O3 -fopenmp -std=c++11 -- Found Git: /usr/bin/git (found version "1.8.3.1") default cmake for auto_log, no need to compile -- Configuring done -- Generating done -- Build files have been written to: /opt/app-root/src/paddleocr/deploy/cpp_infer/build [ 9%] Building CXX object CMakeFiles/ppocr.dir/src/args.cpp.o [ 18%] Building CXX object CMakeFiles/ppocr.dir/src/clipper.cpp.o [ 27%] Building CXX object CMakeFiles/ppocr.dir/src/main.cpp.o [ 36%] Building CXX object CMakeFiles/ppocr.dir/src/ocr_cls.cpp.o [ 45%] Building CXX object CMakeFiles/ppocr.dir/src/ocr_det.cpp.o [ 54%] Building CXX object CMakeFiles/ppocr.dir/src/ocr_rec.cpp.o [ 63%] Building CXX object CMakeFiles/ppocr.dir/src/paddleocr.cpp.o [ 72%] Building CXX object CMakeFiles/ppocr.dir/src/postprocess_op.cpp.o [ 90%] Building CXX object CMakeFiles/ppocr.dir/src/preprocess_op.cpp.o [ 90%] Building CXX object CMakeFiles/ppocr.dir/src/utility.cpp.o [100%] Linking CXX executable ppocr /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(place.cc.o):(.bss+0x0): multiple definition offLB::FLAGS_benchmark'
    CMakeFiles/ppocr.dir/src/args.cpp.o:(.bss+0x58): first defined here
    CMakeFiles/ppocr.dir/src/ocr_cls.cpp.o: In function PaddleOCR::Classifier::LoadModel(std::string const&)': /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_cls.cpp:101: undefined reference to paddle::AnalysisConfig::SetModel(std::string const&, std::string const&)'
    CMakeFiles/ppocr.dir/src/ocr_cls.cpp.o: In function PaddleOCR::Classifier::Run(std::vector<cv::Mat, std::allocator<cv::Mat> >, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&, std::vector<double, std::allocator<double> >&)': /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_cls.cpp:58: undefined reference to paddle_infer::Predictor::GetInputNames()'
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_cls.cpp:59: undefined reference to paddle_infer::Predictor::GetInputHandle(std::string const&)' /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_cls.cpp:67: undefined reference to paddle_infer::Predictor::GetOutputNames()'
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_cls.cpp:68: undefined reference to paddle_infer::Predictor::GetOutputHandle(std::string const&)' CMakeFiles/ppocr.dir/src/ocr_det.cpp.o: In function PaddleOCR::DBDetector::LoadModel(std::string const&)':
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_det.cpp:22: undefined reference to paddle::AnalysisConfig::SetModel(std::string const&, std::string const&)' /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_det.cpp:70: undefined reference to paddle::AnalysisConfig::SetTRTDynamicShapeInfo(std::map<std::string, std::vector<int, std::allocator >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<int, std::allocator > > > >, std::map<std::string, std::vector<int, std::allocator >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<int, std::allocator > > > >, std::map<std::string, std::vector<int, std::allocator >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<int, std::allocator > > > >, bool)'
    CMakeFiles/ppocr.dir/src/ocr_det.cpp.o: In function PaddleOCR::DBDetector::Run(cv::Mat&, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&, std::vector<double, std::allocator<double> >&)': /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_det.cpp:117: undefined reference to paddle_infer::Predictor::GetInputNames()'
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_det.cpp:118: undefined reference to paddle_infer::Predictor::GetInputHandle(std::string const&)' /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_det.cpp:126: undefined reference to paddle_infer::Predictor::GetOutputNames()'
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_det.cpp:127: undefined reference to paddle_infer::Predictor::GetOutputHandle(std::string const&)' CMakeFiles/ppocr.dir/src/ocr_rec.cpp.o: In function PaddleOCR::CRNNRecognizer::LoadModel(std::string const&)':
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_rec.cpp:133: undefined reference to paddle::AnalysisConfig::SetModel(std::string const&, std::string const&)' /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_rec.cpp:172: undefined reference to paddle::PaddlePassBuilder::DeletePass(std::string const&)'
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_rec.cpp:156: undefined reference to paddle::AnalysisConfig::SetTRTDynamicShapeInfo(std::map<std::string, std::vector<int, std::allocator<int> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::vector<int, std::allocator<int> > > > >, std::map<std::string, std::vector<int, std::allocator<int> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::vector<int, std::allocator<int> > > > >, std::map<std::string, std::vector<int, std::allocator<int> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::vector<int, std::allocator<int> > > > >, bool)' CMakeFiles/ppocr.dir/src/ocr_rec.cpp.o: In function PaddleOCR::CRNNRecognizer::Run(std::vector<cv::Mat, std::allocatorcv::Mat >, std::vector<std::string, std::allocatorstd::string >&, std::vector<float, std::allocator >&, std::vector<double, std::allocator >&)':
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_rec.cpp:71: undefined reference to paddle_infer::Predictor::GetInputNames()' /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_rec.cpp:72: undefined reference to paddle_infer::Predictor::GetInputHandle(std::string const&)'
    /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_rec.cpp:79: undefined reference to paddle_infer::Predictor::GetOutputNames()' /opt/app-root/src/paddleocr/deploy/cpp_infer/src/ocr_rec.cpp:80: undefined reference to paddle_infer::Predictor::GetOutputHandle(std::string const&)'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(analysis_predictor.cc.o): In function __static_initialization_and_destruction_0(int, int) [clone .constprop.1310]': analysis_predictor.cc:(.text.startup+0x796): undefined reference to OrtGetApiBase'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(mkldnn_quantizer.cc.o): In function __static_initialization_and_destruction_0(int, int) [clone .constprop.949]': mkldnn_quantizer.cc:(.text.startup+0x62a): undefined reference to OrtGetApiBase'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(onnxruntime_predictor.cc.o): In function paddle::CheckConvertToONNX(paddle::AnalysisConfig const&)': onnxruntime_predictor.cc:(.text+0x1508): undefined reference to paddle2onnx::IsExportable(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool, int, bool, bool, bool, bool, bool)'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(onnxruntime_predictor.cc.o): In function paddle::ONNXRuntimePredictor::Init()': onnxruntime_predictor.cc:(.text+0x2bdc): undefined reference to paddle2onnx::Export(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, int, bool, bool, bool, bool, bool)'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(onnxruntime_predictor.cc.o): In function paddle::ONNXRuntimePredictor::Init()': onnxruntime_predictor.cc:(.text+0x2bdc): undefined reference to paddle2onnx::Export(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >
    , bool, int, bool, bool, bool, bool, bool)'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(onnxruntime_predictor.cc.o): In function __static_initialization_and_destruction_0(int, int) [clone .constprop.385]': onnxruntime_predictor.cc:(.text.startup+0x8f6): undefined reference to OrtGetApiBase'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(zero_copy_tensor.cc.o): In function __static_initialization_and_destruction_0(int, int) [clone .constprop.478]': zero_copy_tensor.cc:(.text.startup+0x6ea): undefined reference to OrtGetApiBase'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(helper.cc.o): In function __static_initialization_and_destruction_0(int, int) [clone .constprop.187]': helper.cc:(.text.startup+0x827): undefined reference to OrtGetApiBase'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(api.cc.o): In function _GLOBAL__sub_I_api.cc': api.cc:(.text.startup+0xaf): undefined reference to OrtGetApiBase'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(io_utils.cc.o): In function _GLOBAL__sub_I_io_utils.cc': io_utils.cc:(.text.startup+0xaf): undefined reference to OrtGetApiBase'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(analyzer.cc.o):analyzer.cc:(.text.startup+0xaf): more undefined references to OrtGetApiBase' follow /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(cipher_utils.cc.o): In function paddle::framework::CipherUtils::GenKeyabi:cxx11':
    cipher_utils.cc:(.text+0x65): undefined reference to CryptoPP::RandomPool::RandomPool()' cipher_utils.cc:(.text+0x86): undefined reference to CryptoPP::AutoSeededRandomPool::Reseed(bool, unsigned int)'
    cipher_utils.cc:(.text+0xd3): undefined reference to CryptoPP::RandomNumberGenerator::GenerateBlock(unsigned char*, unsigned long)' cipher_utils.cc:(.text+0xda): undefined reference to vtable for CryptoPP::RandomPool'
    /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(cipher_utils.cc.o): In function paddle::framework::CipherUtils::GenKeyToFile(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': cipher_utils.cc:(.text+0xcbe): undefined reference to CryptoPP::RandomPool::RandomPool()'
    cipher_utils.cc:(.text+0xce0): undefined reference to CryptoPP::AutoSeededRandomPool::Reseed(bool, unsigned int)' cipher_utils.cc:(.text+0xd2b): undefined reference to CryptoPP::RandomNumberGenerator::GenerateBlock(unsigned char*, unsigned long)'
    cipher_utils.cc:(.text+0xef5): undefined reference to vtable for CryptoPP::RandomPool' /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(cipher_utils.cc.o): In function CryptoPP::AutoSeededRandomPool::~AutoSeededRandomPool()':
    cipher_utils.cc:(.text._ZN8CryptoPP20AutoSeededRandomPoolD2Ev[_ZN8CryptoPP20AutoSeededRandomPoolD5Ev]+0xf): undefined reference to vtable for CryptoPP::RandomPool' /opt/app-root/src/paddle_inference/paddle/lib/libpaddle_inference.a(cipher_utils.cc.o): In function CryptoPP::AutoSeededRandomPool::~AutoSeededRandomPool()':
    cipher_utils.cc:(.text._ZN8CryptoPP20AutoSeededRandomPoolD0Ev[_ZN8CryptoPP20AutoSeededRandomPoolD5Ev]+0xf): undefined reference to vtable for CryptoPP::RandomPool'.
    ..............
    /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference tostd::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
    /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21' /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference to std::__cxx11::basic_stringstream<char, std::char_traits, std::allocator >::basic_stringstream(std::_Ios_Openmode)@GLIBCXX_3.4.21'
    /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)@GLIBCXX_3.4.21' /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference to std::__cxx11::basic_string<char, std::char_traits, std::allocator >::compare(char const*) const@GLIBCXX_3.4.21'
    /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference to std::logic_error::logic_error(std::logic_error const&)@GLIBCXX_3.4.21' /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference to std::__atomic_futex_unsigned_base::_M_futex_wait_until(unsigned int*, unsigned int, bool, std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >)@GLIBCXX_3.4.21'
    /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21' /opt/app-root/src/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0: undefined reference to std::logic_error::logic_error(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)@GLIBCXX_3.4.21'
    collect2: error: ld returned 1 exit status
    make[2]: *** [ppocr] Error 1
    make[1]: *** [CMakeFiles/ppocr.dir/all] Error 2
    make: *** [all] Error 2
    build.log
    `

make sure you use the right Paddle Inference lib, you can download
from https://paddleinference.paddlepaddle.org.cn/user_guides/download_lib.html#c

commented

make sure you use the right Paddle Inference lib, you can download from https://paddleinference.paddlepaddle.org.cn/user_guides/download_lib.html#c

Yes, I downloaded libs from this page, I've tried all three C++ (cpu, gcc8, version 2.3) infer libs, but none of them worked.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.