参考如下执行:
https://github.com/PaddlePaddle/PaddleOCR/tree/develop/deploy/lite
准备交叉编译环境(已准备)
Linux
Linux lc-virtual-machine 5.8.0-38-generic #43~20.04.1-Ubuntu SMP Tue Jan 12 16:39:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[推荐]编译Paddle-Lite得到预测库,Paddle-Lite的编译方式如下:
git clone https://github.com/PaddlePaddle/Paddle-Lite.git
cd Paddle-Lite
切换到Paddle-Lite release/v2.7 稳定分支
git checkout release/v2.7
./lite/tools/build_android.sh --arch=armv8 --with_cv=ON --with_extra=ON
ERR:
fatal: 没有标签准确匹配 '0b0ac44900bcda7837a6471e7a666bc94f7a09ba'
-- tag:
-- branch: release/v2.8
-- commit: 0b0ac44
-- Collected 181 ops
-- Collected 0 X86 kernels
-- Collected 0 CUDA kernels
-- Collected 50 Host kernels
-- Collected 86 ARM kernels
-- Collected 0 OpenCL kernels
-- Collected 0 NPU kernels
-- Collected 0 APU kernels
-- Collected 0 XPU kernels
-- Collected 0 RKNPU kernels
-- Collected 0 FPGA kernels
-- Collected 0 BM kernels
-- Collected 0 MLU kernels
-- Collected 0 HUAWEI_ASCEND_NPU kernels
-- Collected 0 IMAGINATION_NNA kernels
-- bundled_tgt_full_name: /opt/Paddle-Lite/build.lite.android.armv8.gcc/libpaddle_api_light_bundled.a
CMakeError.log 片段:
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find crtbegin_dynamic.o: 没有那个文件或目录
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lstdc++
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lm
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lc
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -ldl
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find crtend_android.o: 没有那个文件或目录
collect2: error: ld returned 1 exit status
3条答案
按热度按时间8zzbczxx1#
请设置一下 sysroot 变量试试,谢谢
kzmpq1sx2#
su -
vim /etc/profile
###last line add
PATH=$PATH:/opt/android-ndk-r17c
vim ~/.bashrc
last line add
source /etc/profile
source ~/.bashrc
ndk-build
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/opt/android-ndk-r17c/build/core/build-local.mk:151:***Android NDK: Aborting . Stop.
ERR
./lite/tools/build_android.sh --arch=armv8 --with_cv=ON --with_extra=ON
-- Found Paddle host system: ubuntu, version: 20.04.1
-- Found Paddle host system's CPU: 2 cores
-- Found host C compiler: /usr/bin/gcc
-- Found host CXX compiler: /usr/bin/g++
-- Lite ARM Compile android with armv8
-- Android: Targeting API '23' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected GCC toolchain 'aarch64-linux-android-4.9'
-- The CXX compiler identification is GNU 4.9.0
-- The C compiler identification is GNU 4.9.0
-- Check for working CXX compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++
-- Check for working CXX compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc
-- Check for working C compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- CXX compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++, version: GNU 4.9.0
-- C compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc, version: GNU 4.9.0
-- AR tools: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar
-- Found Git: /usr/bin/git (found version "2.25.1")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Performing Test FMA_FOUND
-- Performing Test FMA_FOUND - Failed
-- Performing Test MMX_FOUND
-- Performing Test MMX_FOUND - Failed
-- Performing Test SSE2_FOUND
-- Performing Test SSE2_FOUND - Failed
-- Performing Test SSE3_FOUND
-- Performing Test SSE3_FOUND - Failed
-- Performing Test AVX_FOUND
-- Performing Test AVX_FOUND - Failed
-- Performing Test AVX2_FOUND
-- Performing Test AVX2_FOUND - Failed
-- Performing Test AVX512F_FOUND
-- Performing Test AVX512F_FOUND - Failed
-- CMAKE_BUILD_TYPE: Release
--
lite/model_parser/flatbuffers/framework.fbs
: add generation of C++ code with '--no-includes;--gen-compare;--force-empty'-- SRC_FBS_DIR: lite/model_parser/flatbuffers
--
lite/model_parser/flatbuffers/param.fbs
: add generation of C++ code with '--no-includes;--gen-compare;--force-empty'-- SRC_FBS_DIR: lite/model_parser/flatbuffers
-- Building the mobile framework
-- Performing Test out_var
-- Performing Test out_var - Success
-- Found OpenMP_C: -fopenmp (found version "4.0")
-- Found OpenMP_CXX: -fopenmp (found version "4.0")
-- Found OpenMP: TRUE (found version "4.0")
-- Found OpenMP 4.0
-- OpenMP C flags: -fopenmp
-- OpenMP CXX flags: -fopenmp
-- OpenMP OpenMP_CXX_LIB_NAMES: log;gomp
-- OpenMP OpenMP_CXX_LIBRARIES: /opt/android-ndk-r17c/platforms/android-23/arch-arm64/usr/lib/liblog.so;/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/lib64/libgomp.a
-- Flatbuffers will be used as cpp default program description.
-- LIGHT_FRAMEWORK: ON
-- LITE_WITH_CUDA: OFF
-- LITE_WITH_X86: OFF
-- LITE_WITH_ARM: ON
-- LITE_WITH_OPENCL: OFF
-- LITE_WITH_NPU: OFF
-- LITE_WITH_RKNPU: OFF
-- LITE_WITH_XPU: OFF
-- LITE_WITH_APU: OFF
-- LITE_WITH_XTCL:
-- LITE_WITH_FPGA: OFF
-- LITE_WITH_MLU: OFF
-- LITE_WITH_HUAWEI_ASCEND_NPU: OFF
-- LITE_WITH_BM: OFF
-- LITE_WITH_PROFILE: OFF
-- LITE_WITH_CV: ON
-- generating arm dotprod code
-- Found PythonInterp: /usr/bin/python (found version "2.7.18")
('input file: ', '/opt/Paddle-Lite/lite/backends/arm/math/dotprod/gemm_sdot_meta.h')
('output file: ', '/opt/Paddle-Lite/lite/backends/arm/math/dotprod/gemm_sdot.h')
-- add lite kernels
-- compile with lite host kernels
-- compile with lite ARM kernels
fatal: 没有标签准确匹配 '1c0b963962269698856ccdc65c370116886023ab'
-- tag:
-- branch: release/v2.7
-- commit: 1c0b963
-- Collected 165 ops
-- Collected 0 X86 kernels
-- Collected 0 CUDA kernels
-- Collected 35 Host kernels
-- Collected 82 ARM kernels
-- Collected 0 OpenCL kernels
-- Collected 0 NPU kernels
-- Collected 0 APU kernels
-- Collected 0 XPU kernels
-- Collected 0 RKNPU kernels
-- Collected 0 FPGA kernels
-- Collected 0 BM kernels
-- Collected 0 MLU kernels
-- Collected 0 HUAWEI_ASCEND_NPU kernels
-- bundled_tgt_full_name: /opt/Paddle-Lite/build.lite.android.armv8.gcc/libpaddle_api_light_bundled.a
CMake Error at /opt/cmake-3.10/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Java (missing: Java_JAVAH_EXECUTABLE) (found version
"11.0.9.1")
Call Stack (most recent call first):
/opt/cmake-3.10/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/opt/cmake-3.10/share/cmake-3.10/Modules/FindJava.cmake:271 (find_package_handle_standard_args)
lite/api/android/jni/CMakeLists.txt:6 (find_package)
-- Configuring incomplete, errors occurred!
See also "/opt/Paddle-Lite/build.lite.android.armv8.gcc/CMakeFiles/CMakeOutput.log".
See also "/opt/Paddle-Lite/build.lite.android.armv8.gcc/CMakeFiles/CMakeError.log".
tp5buhyn3#
sysroot变量
export NDK_ROOT=/opt/android-ndk-r17c
export SYSROOT="$NDK_ROOT/platforms/android-21/arch-arm64"
ERR
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++
Build flags: ;-flto
Id flags:
The output was:
1
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find crtbegin_dynamic.o: 没有那个文件或目录
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lstdc++
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lm
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lc
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -ldl
/opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find crtend_android.o: 没有那个文件或目录
collect2: error: ld returned 1 exit status
The CXX compiler identification could not be found in "/opt/Paddle-Lite/build.lite.android.armv8.gcc/CMakeFiles/3.10.3/CompilerIdCXX/CMakeCXXCompilerId.o"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++
Build flags: ;-flto
Id flags: --c++
The output was:
1
aarch64-linux-android-g++: error: unrecognized command line option '--c++'
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++
Build flags: ;-flto
Id flags: --ec++
The output was:
1
aarch64-linux-android-g++: error: unrecognized command line option '--ec++'
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++
Build flags:
Id flags: