2012-11-01 48 views
3

如何使用NDK构建我的Android源代码。
已经下载了ndk,我不知道如何设置arch编译器路径。

这是我的 “build-for-android.sh” 代码:在Linux中为Android NDK构建脚本

#!/bin/sh 
cairo=system 
curl=system 
pal=android 
alsa=no 
pulse=no 
sles=yes 
ffmpeg=yes 
gallium=no 
egl=yes 
glx=no 

PKG_CONFIG_PATH=$MOONLIGHT_PREFIX/lib/pkgconfig 
if [ -d /usr/X11/share/aclocal ]; then 
    export ACLOCAL_FLAGS="-I /usr/X11/share/aclocal" 
fi 

./autogen.sh --host=arm-linux-androideabi --prefix=$MOONLIGHT_PREFIX --with-manual-mono=yes --with-testing=no --enable-browser-support --disable-desktop-support --with-unwind=no --with-ffmpeg=$ffmpeg --with-alsa=$alsa --with-pulseaudio=$pulse --with-opensles=$sles --with-pal=$pal --with-curl=$curl --with-cairo=$cairo --with-gallium-path=$gallium --enable-sdk=no --with-egl=$egl --with-glx=$glx CFLAGS="-DPLATFORM_ANDROID -I$MOONLIGHT_PREFIX/include $CFLAGS" LDFLAGS="-L$MOONLIGHT_PREFIX/lib $LDFLAGS" CXXFLAGS="-fno-rtti -DPLATFORM_ANDROID -I$MOONLIGHT_PREFIX/include $CFLAGS" 
make [email protected] 

当我运行它,我得到以下错误:

checking for arm-linu-androideabi-g++... no 
checking for arm-linu-androideabi-c++... no 
checking for arm-linu-androideabi-gpp... no 
checking for arm-linu-androideabi-aCC... no 
checking for arm-linu-androideabi-cc... no 
. 
. 
. 
. 

我可以在〜/ Android的看到他们/ android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuild/linux-x86/bin/*目录。

+0

请说清楚 - 您是在构建您的应用程序还是Android本身? –

+0

嗨。谢谢您的回答。我想为Android构建月光 https://github.com/mono/moon –

+0

这是Android构建脚本 https://github.com/mono/moon/blob/master/build/android/build-for -android.sh –

回答

2

好的。我发现它。:

首先,创建一个独立的工具链,使配置脚本更容易使用

~$ android-ndk-r5b/build/tools/make-standalone-toolchain.sh --platform=android-8 --install-dir=android-8-toolchain 

接下来,工具链的bin目录添加到PATH。

~$ export PATH=$PATH:~/android-8-toolchain/bin/