Mobile
Mobile copied to clipboard
安装android版paddle,cmake提示错误
按照文档Inference demo配置android,cmake提示下面的错误:
CMake Error at CMakeLists.txt:32 (project): The CMAKE_CXX_COMPILER:
/Home/wyf/android-ndk-r14b/build/tools/arm64_standlone_toolchain/bin/aarch64-linux-android-g++
is not a full path to an existing compiler tool.
Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:32 (project): The CMAKE_C_COMPILER:
/Home/wyf/android-ndk-r14b/build/tools/arm64_standlone_toolchain/bin/aarch64-linux-android-gcc
is not a full path to an existing compiler tool.
Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
什么原因呢?是什么路径不对吗?还是缺少了哪一步?
您好,看cmake错误信息,应该是编译器/Home/wyf/android-ndk-r14b/build/tools/arm64_standlone_toolchain/bin/aarch64-linux-android-g++
不存在。请先确认一下。
编译inference demo
,需要按照Android平台编译指南中准备交叉编译环境小结中所述,生成独立工具链。
如果以上两点都确认没有问题,那请帖一下你所使用的CMake命令吧。
你好,
在准备交叉编译环境小结中也提到cmake:
cmake -DCMAKE_SYSTEM_NAME=Android
-DANDROID_STANDALONE_TOOLCHAIN=your/path/to/arm64_standalone_toolchain
-DANDROID_ABI=arm64-v8a
-DUSE_EIGEN_FOR_BLAS=OFF
-DCMAKE_INSTALL_PREFIX=your/path/to/install
-DWITH_C_API=ON
-DWITH_SWIG_PY=OFF
..
这里的 DCMAKE_INSTALL_PREFIX=your/path/to/install
是哪个路径呢?
@Xreki
Android平台编译指南
这个文档里面,讲的是如何编译Android上用的Paddle库,CMake
是在配置Paddle,CMAKE_INSTALL_PREFIX
所指定的,是你希望Paddle库安装到的路径,也就是inference demo
中的PADDLE_ROOT
。
inference demo
里面的cmake命令,则是在配置这个demo本身。
@Xreki
Android平台编译指南参照这里的cmake:
cmake -DCMAKE_SYSTEM_NAME=Android
-DANDROID_STANDALONE_TOOLCHAIN=/home/wyf/android-ndk-r14b/build/tools/arm64_standalone_toolchain
-DANDROID_ABI=arm64-v8a
-DUSE_EIGEN_FOR_BLAS=OFF
-DCMAKE_INSTALL_PREFIX=/home/wyf/paddle-android-demo
-DWITH_C_API=ON
-DWITH_SWIG_PY=OFF
..
提示错误
CMake Error: The source directory "/home/wyf" does not appear to contain CMakeLists.txt.
是哪个路径不对吗?
这个是你执行cmake命令所在的目录不对。如果是编译Paddle,一般是按照如下命令:
$ git clone https://github.com/PaddlePaddle/Paddle.git
$ cd Paddle
$ mkdir build
$ cd build
$ cmake -DCMAKE_SYSTEM_NAME=Android
-DANDROID_STANDALONE_TOOLCHAIN=/home/wyf/android-ndk-r14b/build/tools/arm64_standalone_toolchain
-DANDROID_ABI=arm64-v8a
-DUSE_EIGEN_FOR_BLAS=OFF
-DCMAKE_INSTALL_PREFIX=/home/wyf/paddle-android-demo
-DWITH_C_API=ON
-DWITH_SWIG_PY=OFF
..
cmake最后的..
代表源码所在目录,也就是Paddle源码所在的根目录。
另外:
-
inference demo
有中文使用文档https://github.com/PaddlePaddle/Mobile/blob/develop/benchmark/tool/C/README_cn.md 。 - 可以不必亲自编译Paddle库,wiki页面提供了预编译好的版本:https://github.com/PaddlePaddle/Mobile/wiki
好的,谢谢 “Android平台编译指南”的cmake可以编译了,我先按照文档“Inference demo”试一下,不行的话再用预编译好的Paddle
@Xreki 根据inference demo第一步完成,生成了一paddle-android-demo-DWITH_C_API=ON文件夹,这里面也出现了include/lib/third_party三个目录;但在进行第二步[Step 2,编译示例程序],我的cmake如下:
root@wyf-virtual-machine:/home/wyf/Mobile/benchmark/tool/C/build# cmake .. \
> -DANDROID_ABI=arm64-v8a \
> -DANDROID_STANDALONE_TOOLCHAIN=/Home/wyf/android-ndk-r14b/build/tools/arm64_standlone_toolchain \
> -DPADDLE_ROOT=paddle-android-demo-DWITH_C_API=ON \
> -DCMAKE_BUILD_TYPE=MinSizeRel
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:32 (project):
The CMAKE_CXX_COMPILER:
/Home/wyf/android-ndk-r14b/build/tools/arm64_standlone_toolchain/bin/aarch64-linux-android-g++
is not a full path to an existing compiler tool.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:32 (project):
The CMAKE_C_COMPILER:
/Home/wyf/android-ndk-r14b/build/tools/arm64_standlone_toolchain/bin/aarch64-linux-android-gcc
is not a full path to an existing compiler tool.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/wyf/Mobile/benchmark/tool/C/CMakeFiles/CMakeOutput.log".
See also "/home/wyf/Mobile/benchmark/tool/C/CMakeFiles/CMakeError.log".
提示有问题。。。 在/Home/wyf/android-ndk-r14b/build/tools/arm64_standlone_toolchain/bin/目录下有aarch64-linux-android-g++ 和 aarch64-linux-android-gcc
这个看起来有点奇怪了,可以看下/home/wyf/Mobile/benchmark/tool/C/CMakeFiles/CMakeError.log
有什么错误信息吗?
@Xreki CMakeError.log 这是CMakeError.log,麻烦看一下
@Xreki hi,这个问题搞定了,谢谢你的提示。。。。
我上午看了下你的CMakeError.log,其实没看出来原因,:worried:
谢谢你对Paddle的支持,另外,我们有一个正在开发中的Android demo,前端开发工作还没完成,https://github.com/PaddlePaddle/Mobile/pull/61 ,这个demo的效果将和iOS demo https://github.com/PaddlePaddle/Mobile/blob/develop/Demo/iOS/AICamera/README_cn.md 一样。希望能给你提供些参考。
经过如下几个步骤,你即可运行该demo:
- 下载该PR代码
$ cd Mobile
$ git fetch DemoAndroid
$ git checkout DemoAndroid
- 从https://github.com/PaddlePaddle/Mobile/wiki 下载android的预编译库,解压后目录重命名为
paddle-android
放在Demo/Android/AICamera
目录下 - 从https://github.com/PaddlePaddle/Mobile/blob/develop/Demo/iOS/AICamera/README_cn.md#%E6%A8%A1%E5%9E%8B 下载模型,放到
assets/models
目录下
@Xreki OK,期待你们的前端尽快搞定
@Xreki 再问一下,你上面说的“经过如下几个步骤,你即可运行该demo:”, 是你们Android demo做好之后,我就可以按照你说的步骤来,是这个意思吗?还是其他意思。。。。。
不是的,我的意思是, 我们的前端还没做好,但是当前版本也是可以运行的。如果你需要将Paddle集成到Android app里面,当前版本也可以提供一些参考。