Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PaddleOCR C++部署demo编译问题 #7569

Closed
sethome2 opened this issue Sep 13, 2022 · 7 comments
Closed

PaddleOCR C++部署demo编译问题 #7569

sethome2 opened this issue Sep 13, 2022 · 7 comments
Assignees

Comments

@sethome2
Copy link

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

  • 系统环境/System Environment:update import in train script #27~20.04.1-Ubuntu SMP With GCC11.2
  • 版本号/Version:Paddle:2.3.2 PaddleOCR:release-2.6
  • 问题相关组件/Related components:deploy/cpp_infer/
  • 运行指令/Command Code:tools/build.sh 里的脚本
OPENCV_DIR=/home/test/paddleBuild/deployCpp/opencv-3.4.7/opencv3
LIB_DIR=/home/test/paddleBuild/deployCpp/paddleOCR/PaddleOCR/deploy/cpp_infer/paddle_inference

BUILD_DIR=build
rm -rf ${BUILD_DIR}
mkdir ${BUILD_DIR}
cd ${BUILD_DIR}
cmake .. \
    -DPADDLE_LIB=${LIB_DIR} \
    -DWITH_MKL=ON \
    -DWITH_GPU=OFF \
    -DWITH_STATIC_LIB=ON \
    -DWITH_TENSORRT=OFF \
    -DOPENCV_DIR=${OPENCV_DIR} \

make -j16
  • 完整报错/Complete Error Message:
    多为multiple definition 和 undeclared 错误

Consolidate compiler generated dependencies of target ppocr
[ 7%] Linking CXX executable ppocr
/usr/bin/ld: ../paddle_inference/paddle/lib/libpaddle_inference.a(place.cc.o):(.bss+0x0): multiple definition of fLB::FLAGS_benchmark'; CMakeFiles/ppocr.dir/src/args.cpp.o:(.bss+0x70): first defined here 省略一大部分 /usr/bin/ld: faster_tokenizer_op.cc:(.text+0x1435): undefined reference to utf8proc_category'
/usr/bin/ld: faster_tokenizer_op.cc:(.text+0x1451): undefined reference to utf8proc_category' /usr/bin/ld: ../paddle_inference/paddle/lib/libpaddle_inference.a(faster_tokenizer_op.cc.o): in function paddle::operators::BasicTokenizer::do_lower_case(wchar_t) const':
faster_tokenizer_op.cc:(.text+0x423): undefined reference to utf8proc_tolower' /usr/bin/ld: ../paddle_inference/paddle/lib/libpaddle_inference.a(string_array.cc.o): in function paddle::framework::NFD(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >*)':
string_array.cc:(.text+0xe54): undefined reference to utf8proc_NFD' /usr/bin/ld: ../paddle_inference/paddle/lib/libpaddle_inference.a(unicode.cc.o): in function phi::strings::GetCharcasesMap()':
unicode.cc:(.text+0x41): undefined reference to utf8proc_toupper' /usr/bin/ld: unicode.cc:(.text+0x5a): undefined reference to utf8proc_islower'
/usr/bin/ld: unicode.cc:(.text+0x65): undefined reference to utf8proc_isupper' /usr/bin/ld: unicode.cc:(.text+0x70): undefined reference to utf8proc_tolower'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ppocr.dir/build.make:313:ppocr] 错误 1
make[1]: *** [CMakeFiles/Makefile2:100:CMakeFiles/ppocr.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2

补充一下具体过程,第一次是使用paddle的预编译包,其version.txt如下
GIT COMMIT ID: 4596b9a22540fb0ea5d369c3c804544de61d03d0
WITH_MKL: ON
WITH_MKLDNN: ON
WITH_GPU: OFF
WITH_ROCM: OFF
WITH_ASCEND_CL: OFF
WITH_ASCEND_CXX11: OFF
WITH_IPU: OFF
CXX compiler version: 8.2.0

怀疑是GCC之间不兼容,我用本地GCC又编译了一个paddle_inference_install_dir,其version.txt如下
GIT COMMIT ID: e755c07e6a5c0880e28b3025a7bb41d684850dd3
WITH_MKL: ON
WITH_MKLDNN: ON
WITH_GPU: OFF
WITH_ROCM: OFF
WITH_ASCEND_CL: OFF
WITH_ASCEND_CXX11: OFF
WITH_IPU: OFF
CXX compiler version: 11.2.0

但报错依旧是相同的,遂怀疑是deploy/cpp_infer的问题。

IMG_1135

@WenmuZhou
Copy link
Collaborator

试一下新的代码看看

@sethome2
Copy link
Author

试一下新的代码看看

好的谢谢,我看到release2.6的新提交了我拉取看看,如果不行我再试试dev分支的

@sethome2
Copy link
Author

试一下新的代码看看

在paddleOCR 分支 f9b0aa8dc9f7d18d1a125476d2361d65963e0eb4中,配合paddlepaddle预编译好的包,出现了以下错误:
image

@sethome2
Copy link
Author

笑,想起来之前paddlepaddle的编译优化参数都是-o3,改成-O3,至少能找到链接符号了

@sethome2
Copy link
Author

IMG_1156
好了,一切正常,我想拉一个请求。。把CMakeList改了,<\strong>-o3这个优化参数为-O3<\strong>。

或许在GCC8.2能正常工作,但是或许能说算一个UB?

@sethome2
Copy link
Author

如果有时间我拉一个请求吧,把所有的-o3换成-O3,除了之前cpp_infer的bug,就是这个o3的问题了。感谢管理员的帮助。

@ToddBear
Copy link
Collaborator

ToddBear commented Aug 1, 2023

请问这个问题怎么解决的呢?我把 -o3 改为 -O3 也没用。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants