相关疑难解决方法(0)

生成 Android.mk 的工具

我有一个很大的 C++ 项目,它有大约一百个源文件,它们位于一堆子文件夹中。它们最初是使用 Xcode IDE 开发的,因此那里没有 makefile。

现在我需要使用 NDK 为 Android 构建它。我了解如何创建 Android.mk,但我想知道是否有任何可视化工具或脚本可以自动执行此操作(或至少是基本结构)(可能像 cmake 一样),或者我是否必须手动完成所有操作(我会花很多时间在这...)?

android makefile android-ndk

5
推荐指数
1
解决办法
6689
查看次数

交叉编译libevent for Android

我一直试图将libevent交叉编译到Android,我想知道我做错了什么并得到一些帮助.

我正在尝试构建的版本是libevent-2.0.19-stable

我开始按照http://warpedtimes.wordpress.com/2010/02/03/building-open-source-libraries-with-android-ndk/中描述的步骤进行操作,以及如何将Makefile重写为android.mk?

目标设备是运行cyanogenMod 7的三星Galaxy S2

经过多次尝试,我做的最好的是运行以下步骤:

1) Install android NDK and download libevent source code

2) Android NDK downloaded and running in ~/android-ndk/android-ndk-r8b
Run Code Online (Sandbox Code Playgroud)

3)执行:

export ANDROID_ROOT=~/android-ndk/android-ndk-r8b

export    PATH=$PATH:$ANDROID_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/
Run Code Online (Sandbox Code Playgroud)

您需要导出设备的ABI.armeabi-v7a适用于ARMv7或更高版本的设备,任何其他设备都使用armeabi.

4)使用适当的参数执行./configure:

./configure \
--host=arm-linux-androideabi \
CC=arm-linux-androideabi-gcc \
LD=arm-linux-androideabi-ld \
CPPFLAGS="-I$ANDROID_ROOT/platforms/android-8/arch-arm/usr/include/" \
CFLAGS="-nostdlib" \
LDFLAGS="-Wl,-rpath-link=$ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib/ -L$ANDROID_ROOT/platforms/android-8/arch-arm/usr/lib/" \
LIBS="-lc"
Run Code Online (Sandbox Code Playgroud)

在此期间发出警告:

configure: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used
Run Code Online (Sandbox Code Playgroud)

(我认为没关系)

由于它没有将arm-linux-androideabi识别为主机,因此我从http://git.savannah.gnu.org/gitweb/?p=config.git …

android cross-compiling libevent

5
推荐指数
2
解决办法
1万
查看次数