PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.81k stars 2.89k forks source link

Jetson平台编译指南 #4991

Closed SunYiLing123 closed 2 years ago

SunYiLing123 commented 2 years ago

我配置好环境路径执行 root@fniot-desktop:/data/download/PaddleDetection/deploy/cpp# sh ./scripts/build.sh 报错如下: [ 71%] Building CXX object CMakeFiles/main.dir/src/preprocess_op.cc.o [ 78%] Building CXX object CMakeFiles/main.dir/src/object_detector.cc.o [ 85%] Building CXX object CMakeFiles/main.dir/src/picodet_postprocess.cc.o [ 92%] Building CXX object CMakeFiles/main.dir/src/utils.cc.o make[2]: No rule to make target '/data/download/fluid_inference/paddle/lib/data/download/fluid_inference/paddle/lib/.so', needed by 'main'. Stop. CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/main.dir/all' failed make[1]: [CMakeFiles/main.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 make finished!

这里该如何解决

wangxinxin08 commented 2 years ago

你好,根据报错信息显示,可能的原因是scripts/build.sh中相关的配置文件没有填写正确,需要将scripts/build.sh相关的配置正确设置

SunYiLing123 commented 2 years ago

WITH_GPU=ON

WITH_MKL=OFF

WITH_TENSORRT=ON

PADDLE_LIB_NAME=fluid_inference

TENSORRT_INC_DIR=/usr/src/tensorrt/include

TENSORRT_LIB_DIR=/usr/src/tensorrt/lib

PADDLE_DIR=../fluid_inference/

CUDA_LIB=/usr/local/cuda-10.2/lib64/

CUDNN_LIB=/usr/lib/aarch64-linux-gnu/

WITH_KEYPOINT=OFF

MACHINE_TYPE=uname -m echo "MACHINE_TYPE: "${MACHINE_TYPE}

if [ "$MACHINE_TYPE" = "x86_64" ] then echo "set OPENCV_DIR for x86_64"

mkdir -p $(pwd)/deps && cd $(pwd)/deps wget -c https://paddledet.bj.bcebos.com/data/opencv-3.4.16_gcc8.2_ffmpeg.tar.gz tar -xvf opencv-3.4.16_gcc8.2_ffmpeg.tar.gz && cd ..

set OPENCV_DIR

OPENCV_DIR=$(pwd)/deps/opencv-3.4.16_gcc8.2_ffmpeg

elif [ "$MACHINE_TYPE" = "aarch64" ] then echo "set OPENCV_DIR for aarch64"

mkdir -p $(pwd)/deps && cd $(pwd)/deps wget -c https://bj.bcebos.com/v1/paddledet/data/TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0.tar.gz tar -xvf TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0.tar.gz && cd ..

set OPENCV_DIR

OPENCV_DIR=$(pwd)/deps/TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0/

else echo "Please set OPENCV_DIR manually" fi

echo "OPENCV_DIR: "$OPENCV_DIR

rm -rf build mkdir -p build cd build cmake .. \ -DWITH_GPU=${WITH_GPU} \ -DWITH_MKL=${WITH_MKL} \ -DWITH_TENSORRT=${WITH_TENSORRT} \ -DTENSORRT_LIB_DIR=${TENSORRT_LIB_DIR} \ -DTENSORRT_INC_DIR=${TENSORRT_INC_DIR} \ -DPADDLE_DIR=${PADDLE_DIR} \ -DWITH_STATIC_LIB=${WITH_STATIC_LIB} \ -DCUDA_LIB=${CUDA_LIB} \ -DCUDNN_LIB=${CUDNN_LIB} \ -DOPENCV_DIR=${OPENCV_DIR} \ -DPADDLE_LIB_NAME=${PADDLE_LIB_NAME} \ -DWITH_KEYPOINT=${WITH_KEYPOINT} \ -DWITH_MOT=${WITH_MOT}

make echo "make finished!"

上面是我的新配置文件填写内容,仍报错如下: make[2]: No rule to make target '../fluid_inference/paddle/lib/fluid_inference.so', needed by 'main'. Stop. CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/main.dir/all' failed make[1]: [CMakeFiles/main.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 make finished! @wangxinxin08

wangxinxin08 commented 2 years ago

这个应该是PADDLE_LIB_NAME和PADDLE_DIR这两个参数没设置好,首先PADDLE_DIR要设置成下载的PaddleInference的绝对路径,比如paddle_inference.tgz解压到paddle_inference文件夹,就指定paddle_inference的绝对路径,PADDLE_LIB_NAME可以查看paddle_inference/paddle/lib里面中的.so文件去掉后缀,比如如果是libpaddle_inference.so就填libpaddle_inference

SunYiLing123 commented 2 years ago

@wangxinxin08 /data/download/PaddleDetection/deploy/cpp/src/main.cc:265:15: steps); ^ [ 71%] Building CXX object CMakeFiles/main.dir/src/preprocess_op.cc.o [ 78%] Building CXX object CMakeFiles/main.dir/src/object_detector.cc.o [ 85%] Building CXX object CMakeFiles/main.dir/src/picodet_postprocess.cc.o [ 92%] Building CXX object CMakeFiles/main.dir/src/utils.cc.o [100%] Linking CXX executable main ../paddle_inference/third_party/install/openblas/lib/libopenblas.a: file not recognized: File truncated collect2: error: ld returned 1 exit status CMakeFiles/main.dir/build.make:221: recipe for target 'main' failed make[2]: [main] Error 1 CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/main.dir/all' failed make[1]: [CMakeFiles/main.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 make finished!

我的build.sh如下:

WITH_GPU=ON

WITH_MKL=OFF

WITH_TENSORRT=ON

PADDLE_LIB_NAME=libpaddle_inference

TENSORRT_INC_DIR=/usr/include/aarch64-linux-gnu

TENSORRT_LIB_DIR=/usr/lib/aarch64-linux-gnu

PADDLE_DIR=/data/download/PaddleDetection/deploy/cpp/paddle_inference/

PADDLE_DIR=../paddle_inference/

CUDA_LIB=/usr/local/cuda-10.2/lib64/

CUDNN_LIB=/usr/lib/aarch64-linux-gnu/

WITH_KEYPOINT=OFF

MACHINE_TYPE=uname -m echo "MACHINE_TYPE: "${MACHINE_TYPE}

if [ "$MACHINE_TYPE" = "x86_64" ] then echo "set OPENCV_DIR for x86_64"

mkdir -p $(pwd)/deps && cd $(pwd)/deps wget -c https://paddledet.bj.bcebos.com/data/opencv-3.4.16_gcc8.2_ffmpeg.tar.gz tar -xvf opencv-3.4.16_gcc8.2_ffmpeg.tar.gz && cd ..

set OPENCV_DIR

OPENCV_DIR=$(pwd)/deps/opencv-3.4.16_gcc8.2_ffmpeg

elif [ "$MACHINE_TYPE" = "aarch64" ] then echo "set OPENCV_DIR for aarch64"

mkdir -p $(pwd)/deps && cd $(pwd)/deps wget -c https://bj.bcebos.com/v1/paddledet/data/TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0.tar.gz tar -xvf TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0.tar.gz && cd ..

set OPENCV_DIR

OPENCV_DIR=$(pwd)/deps/TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0/

else echo "Please set OPENCV_DIR manually" fi

echo "OPENCV_DIR: "$OPENCV_DIR

rm -rf build mkdir -p build cd build cmake .. \ -DWITH_GPU=${WITH_GPU} \ -DWITH_MKL=${WITH_MKL} \ -DWITH_TENSORRT=${WITH_TENSORRT} \ -DTENSORRT_LIB_DIR=${TENSORRT_LIB_DIR} \ -DTENSORRT_INC_DIR=${TENSORRT_INC_DIR} \ -DPADDLE_DIR=${PADDLE_DIR} \ -DWITH_STATIC_LIB=${WITH_STATIC_LIB} \ -DCUDA_LIB=${CUDA_LIB} \ -DCUDNN_LIB=${CUDNN_LIB} \ -DOPENCV_DIR=${OPENCV_DIR} \ -DPADDLE_LIB_NAME=${PADDLE_LIB_NAME} \ -DWITH_KEYPOINT=${WITH_KEYPOINT} \ -DWITH_MOT=${WITH_MOT}

make echo "make finished!"

这个如何解决?

SunYiLing123 commented 2 years ago

@wangxinxin08 hello,能帮忙看看吗

wangxinxin08 commented 2 years ago

@SunYiLing123 ok,等下我看下能不能复现你的问题

SunYiLing123 commented 2 years ago

我的TX2上环境如下: root@fniot-desktop:/data/download/PaddleDetection/deploy/cpp# deepstream-app --version-all deepstream-app version 5.0.0 DeepStreamSDK 5.0.0 CUDA Driver Version: 10.2 CUDA Runtime Version: 10.2 TensorRT Version: 7.1 cuDNN Version: 8.0 Dewarper: not found

paddle_inference中version.txt如下: GIT COMMIT ID: a5cf2e305b744e3ebd2f2210341f88d349d4ec5e WITH_MKL: OFF WITH_MKLDNN: OFF WITH_GPU: ON WITH_ROCM: OFF CUDA version: 10.2 CUDNN version: v8.0 CXX compiler version: 7.5.0 WITH_TENSORRT: ON TensorRT version: v7.1.3.0

@wangxinxin08

wangxinxin08 commented 2 years ago

@SunYiLing123 我这边能够正常编译,看你报错的原因是../paddle_inference/third_party/install/openblas/lib/libopenblas.a: file not recognized: File truncated,你可以尝试重新下载下PaddleInference的包试下

paddle-bot-old[bot] commented 2 years ago

Since this issue has not been updated for more than three months, it will be closed, if it is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. It is recommended to pull and try the latest code first. 由于该问题超过三个月未更新,将会被关闭,若问题未解决或有后续问题,请随时重新打开(建议先拉取最新代码进行尝试),我们会继续跟进。