From 870bac010c21432db35f48b81ea2081d5f72878a Mon Sep 17 00:00:00 2001 From: jiangjiajun Date: Thu, 10 Sep 2020 07:31:07 +0000 Subject: [PATCH] modify build.sh for ubuntu18.04 --- deploy/cpp/scripts/bootstrap.sh | 20 +++++++++++++------- deploy/cpp/scripts/build.sh | 14 +++++++++----- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/deploy/cpp/scripts/bootstrap.sh b/deploy/cpp/scripts/bootstrap.sh index 438dd0b..e2434d1 100644 --- a/deploy/cpp/scripts/bootstrap.sh +++ b/deploy/cpp/scripts/bootstrap.sh @@ -8,25 +8,31 @@ fi # download pre-compiled opencv lib OPENCV_URL=https://bj.bcebos.com/paddleseg/deploy/opencv3.4.6gcc4.8ffmpeg.tar.gz2 -system_name=`awk -F= '/^NAME/{print $2}' /etc/os-release ` -system_version=`awk -F= '/^VERSION_ID/{print $2}' /etc/os-release ` +{ + system_name=`awk -F= '/^NAME/{print $2}' /etc/os-release ` +} || { + echo "[ERROR] There's some problems, maybe caused by your system is not Ubuntu, refer this doc for more informat: https://github.com/PaddlePaddle/PaddleX/tree/develop/docs/deploy/opencv.md" + exit -1 +} # download pre-compiled opencv lib OPENCV_URL=https://bj.bcebos.com/paddleseg/deploy/opencv3.4.6gcc4.8ffmpeg.tar.gz2 -if [ $system_name = '"Ubuntu"' ] +if [ $system_name == '"Ubuntu"' ] then - if [ $system_version = '"18.04"' ] + system_version=`awk -F= '/^VERSION_ID/{print $2}' /etc/os-release ` + if [ $system_version == '"18.04"' ] then OPENCV_URL=https://bj.bcebos.com/paddlex/deploy/opencv3.4.6gcc4.8ffmpeg_ubuntu_18.04.tar.gz2 - elif [ $system_version = '"16.04"' ] + elif [ $system_version == '"16.04"' ] then OPENCV_URL=https://bj.bcebos.com/paddleseg/deploy/opencv3.4.6gcc4.8ffmpeg.tar.gz2 else - echo "Cannot find pre-comipled opencv lib for your system environment, refer this doc for more information: https://github.com/PaddlePaddle/PaddleX/tree/develop/docs/deploy/opencv.md" + echo "[ERROR] Cannot find pre-comipled opencv lib for your system environment, refer this doc for more information: https://github.com/PaddlePaddle/PaddleX/tree/develop/docs/deploy/opencv.md" exit -1 fi else - echo "Cannot find pre-comipled opencv lib for your system environment, refer this doc for more information: https://github.com/PaddlePaddle/PaddleX/tree/develop/docs/deploy/opencv.md" + echo "[ERROR] Cannot find pre-comipled opencv lib for your system environment, refer this doc for more information: https://github.com/PaddlePaddle/PaddleX/tree/develop/docs/deploy/opencv.md" + exit -1 fi if [ ! -d "./deps/opencv3.4.6gcc4.8ffmpeg/" ]; then diff --git a/deploy/cpp/scripts/build.sh b/deploy/cpp/scripts/build.sh index 6d6ad25..790e216 100644 --- a/deploy/cpp/scripts/build.sh +++ b/deploy/cpp/scripts/build.sh @@ -5,9 +5,9 @@ WITH_MKL=ON # 是否集成 TensorRT(仅WITH_GPU=ON 有效) WITH_TENSORRT=OFF # TensorRT 的路径,如果需要集成TensorRT,需修改为您实际安装的TensorRT路径 -TENSORRT_DIR=/root/projects/TensorRT/ +TENSORRT_DIR=$(pwd)/TensorRT/ # Paddle 预测库路径, 请修改为您实际安装的预测库路径 -PADDLE_DIR=/root/projects/fluid_inference +PADDLE_DIR=$(pwd)/fluid_inference # Paddle 的预测库是否使用静态库来编译 # 使用TensorRT时,Paddle的预测库通常为动态库 WITH_STATIC_LIB=OFF @@ -16,14 +16,18 @@ CUDA_LIB=/usr/local/cuda/lib64 # CUDNN 的 lib 路径 CUDNN_LIB=/usr/local/cuda/lib64 +{ + bash $(pwd)/scripts/bootstrap.sh # 下载预编译版本的加密工具和opencv依赖库 +} || { + echo "Fail to execute script/bootstrap.sh" + exit -1 +} + # 是否加载加密后的模型 WITH_ENCRYPTION=ON # 加密工具的路径, 如果使用自带预编译版本可不修改 -sh $(pwd)/scripts/bootstrap.sh # 下载预编译版本的加密工具 ENCRYPTION_DIR=$(pwd)/paddlex-encryption - # OPENCV 路径, 如果使用自带预编译版本可不修改 -sh $(pwd)/scripts/bootstrap.sh # 下载预编译版本的opencv OPENCV_DIR=$(pwd)/deps/opencv3.4.6gcc4.8ffmpeg/ # 以下无需改动 -- GitLab