Android NDK-arm-linux-androideabi-g ++:未找到 [英] Android NDK - arm-linux-androideabi-g++: not found

查看:519
本文介绍了Android NDK-arm-linux-androideabi-g ++:未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在刚刚为此安装的全新Ubuntu中为Android目标构建C ++ POCO库.

我已经在/home/user/dev/Android/android-ndk-r9-x86中安装了Android NDK,并使用以下命令在环境变量中添加了NDK的路径:

export ANDROID_NDK_ROOT=/home/user/dev/Android/android-ndk-r9-x86

要构建库,我首先移至POCO库的根目录,并使用:

对其进行配置.

./configure --omit=NetSSL_OpenSSL,Crypto,Data/ODBC,Data/MySQL --static --config=Android

以便它编译静态.a库,不编译我不需要的模块,并为Android目标编译.

但是调用make会导致以下错误:

user@user-VirtualBox:~/dev/Lib/POCO/poco-1.6.1$ make
make -C /home/user/dev/Lib/POCO/poco-1.6.1/Foundation
make[1]: Entering directory `/home/user/dev/Lib/POCO/poco-1.6.1/Foundation'
** Compiling src/ArchiveStrategy.cpp (debug, static)
arm-linux-androideabi-g++  -Iinclude -I/home/user/dev/Lib/POCO/poco-1.6.1/CppUnit/include -I/home/user/dev/Lib/POCO/poco-1.6.1/CppUnit/WinTestRunner/include -I/home/user/dev/Lib/POCO/poco-1.6.1/Foundation/include -I/home/user/dev/Lib/POCO/poco-1.6.1/XML/include -I/home/user/dev/Lib/POCO/poco-1.6.1/JSON/include -I/home/user/dev/Lib/POCO/poco-1.6.1/Util/include -I/home/user/dev/Lib/POCO/poco-1.6.1/Net/include -mthumb -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions -DPOCO_BUILD_HOST=user-VirtualBox  -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY  -g -D_DEBUG  -c src/ArchiveStrategy.cpp -o /home/user/dev/Lib/POCO/poco-1.6.1/Foundation/obj/Android/armeabi/debug_static/ArchiveStrategy.o
sh: 1: arm-linux-androideabi-g++: not found
make[1]: *** [/home/user/dev/Lib/POCO/poco-1.6.1/Foundation/obj/Android/armeabi/debug_static/ArchiveStrategy.o] Error 127
make[1]: Leaving directory `/home/user/dev/Lib/POCO/poco-1.6.1/Foundation'
make: *** [Foundation-libexec] Error 2

Make似乎找不到用于Android的编译器,我也不知道为什么?我想念什么? 安装" NDK时我忘了什么吗?

谢谢.

解决方案

您遇到的错误是由于缺少工具链调用引起的-而是找不到了arm-linux-androideabi-g++命令/可执行文件/二进制文件.

幸运的是,我们可以通过安装独立工具链来解决此问题-那实际上是您真正缺少的东西,一个通用的arm-linux-androideabi交叉编译器,而不是其他的,更晦涩的,特定于供应商/平台的交叉编译器/工具链,例如armv7a-marvell-linux-android,这是marvell所使用的,或Clang使用的arm-linux-android.有关Clang的详细信息,请在此处查看.但是我可能错了,而Clang实际上开箱即用地生成了arm-linux-androideabi工具链,但是我不确定.我知道您可以轻松使用它,只是不确定是否可以直接使用"它,这正是您要寻找的. 剩下的工作"只是一些途径的输出,但仍然如此.我们的目标是在这里找到最懒惰的解决方案.

独立的工具链应足以完成您的任务,因此请尝试在其他任何交叉编译解决方案中尽可能多地使用它.

但是,如果您喜欢冒险-您可以使用crosstool-ng工具自由创建自己的交叉编译器(或整个工具链!).但是,请尝试使用Linaro libc分支.亲身经历告诉我,某种方式效果最好,而造成的问题/时间浪费最少.

此外,请确保为您的体系结构(架构)和OS下载正确的版本,这里也涉及32位和64位.经过长时间的讨论,我们意识到这是一个"32位与64位"的问题. 这是一个链接,以了解更多信息.

I am trying to build the C++ POCO library for an Android target in a fresh Ubuntu that I just installed for that.

I have installed the Android NDK in /home/user/dev/Android/android-ndk-r9-x86 and added the path to the NDK in the environement variables using :

export ANDROID_NDK_ROOT=/home/user/dev/Android/android-ndk-r9-x86

To build the libraries I first move to the root directory of the POCO library, and configure it using :

./configure --omit=NetSSL_OpenSSL,Crypto,Data/ODBC,Data/MySQL --static --config=Android

So that it compiles static .a libraries, doesn't compile the modules I don't want and compiles for an Android target.

But than calling make causes the following error :

user@user-VirtualBox:~/dev/Lib/POCO/poco-1.6.1$ make
make -C /home/user/dev/Lib/POCO/poco-1.6.1/Foundation
make[1]: Entering directory `/home/user/dev/Lib/POCO/poco-1.6.1/Foundation'
** Compiling src/ArchiveStrategy.cpp (debug, static)
arm-linux-androideabi-g++  -Iinclude -I/home/user/dev/Lib/POCO/poco-1.6.1/CppUnit/include -I/home/user/dev/Lib/POCO/poco-1.6.1/CppUnit/WinTestRunner/include -I/home/user/dev/Lib/POCO/poco-1.6.1/Foundation/include -I/home/user/dev/Lib/POCO/poco-1.6.1/XML/include -I/home/user/dev/Lib/POCO/poco-1.6.1/JSON/include -I/home/user/dev/Lib/POCO/poco-1.6.1/Util/include -I/home/user/dev/Lib/POCO/poco-1.6.1/Net/include -mthumb -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions -DPOCO_BUILD_HOST=user-VirtualBox  -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY  -g -D_DEBUG  -c src/ArchiveStrategy.cpp -o /home/user/dev/Lib/POCO/poco-1.6.1/Foundation/obj/Android/armeabi/debug_static/ArchiveStrategy.o
sh: 1: arm-linux-androideabi-g++: not found
make[1]: *** [/home/user/dev/Lib/POCO/poco-1.6.1/Foundation/obj/Android/armeabi/debug_static/ArchiveStrategy.o] Error 127
make[1]: Leaving directory `/home/user/dev/Lib/POCO/poco-1.6.1/Foundation'
make: *** [Foundation-libexec] Error 2

Make seems unable to find the compiler used for Android, and I have no idea why ? What am I missing ? Did i forget something when "installing" the NDK ?

Thank you.

解决方案

The error you're getting is caused by a missing toolchain invocation - rather, the arm-linux-androideabi-g++ command/executable/binary was nowhere to be found.

Luckily, we can get around that by installing the Standalone toolchain - that one actually has the exact thing you're missing, a general purpose arm-linux-androideabi cross-compiler instead of some other, a bit more obscure, vendor/platform-specific crosscompiler/toolchain, such as armv7a-marvell-linux-android which is what marvell uses, or arm-linux-android which is what Clang uses. For more info on Clang, look here. I could be wrong though and that Clang actually produces a arm-linux-androideabi toolchain out of the box, but I'm unsure. I know you can use it easily, I'm just unsure if it can be used "straight out of the box" which is what you're looking for. The "rest of the work" is just a few path exports - but still. We're aiming for the laziest solution here.

The standalone toolchain should be quite sufficient for your task, so try using it as much as possible over any other cross-compilation solutions.

However, if you're feeling adventurous - you're free to make your own cross-compiler (or the whole toolchain!) using the crosstool-ng tool. However, try to stick with the Linaro libc branch; personal experience showed me that one somehow works the best and causes the least amount of problems/time wasted.

Also, make sure you download the right one for your architecture (arch) and OS, 32bit vs 64bit matters here as well. After a lengthy discussion, we realized it was a "32bit vs 64bit" problem. Here's a link to read more about it.

这篇关于Android NDK-arm-linux-androideabi-g ++:未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆