2012-11-01 52 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/