Reputation: 36289
I am working off of Jackie Gleason's presentation about getting objective-c to compile on Android as well as Michael f1337's blog post on the same subject (with the addition of working on Mac OS X, which I am). The major difference between their posts and mine is that I am working to use the latest NDK (r8b). I have followed these steps:
1) Download the latest NDK here: http://developer.android.com/tools/sdk/ndk/index.html
2) Create a directory called NDK, and unpack the download here.
3) In the NDK directory, create the folder toolchain-src. cd to this directory.
4) Download the toolchain:
git clone https://android.googlesource.com/toolchain/build.git
git clone https://android.googlesource.com/toolchain/gmp.git
git clone https://android.googlesource.com/toolchain/gdb.git
git clone https://android.googlesource.com/toolchain/mpc.git
git clone https://android.googlesource.com/toolchain/mpfr.git
5) Create the directory binutils. cd to this directory.
6) Download the latest binutils tar ball here: http://ftp.gnu.org/gnu/binutils/
7) Unpack file to current directory.
8) back in the toolchain-src directory, create the directory gcc.
9) Download a gcc that supports objective c (tested with gcc-4.6.1) http://ftp.gnu.org/gnu/gcc/
10) Unpack this file into the gcc folder, then navigate back to the toolchain-src directory
11) cd to the build directory, and edit the Makefile.in file, changing the line:
--with-gnu-as --with-gnu-ld --enable-languages=c,c++
to
--with-gnu-as --with-gnu-ld --enable-languages=c,c++,objc
12) From the gcc directory, Download and install the gcc patch:
curl http://gcc.gnu.org/bugzilla/attachment.cgi?id=24879 > gcc.patch
cd gcc-4.6.1
patch -p1 < ../gcc-4.6.1.patch
13) find this file in the ndk: build/tools/build-mingw64-toolchain.sh. In this file, change the line:
var_append GCC_CONFIGURE_OPTIONS "--enable-languages=c,c++"
to
var_append GCC_CONFIGURE_OPTIONS "--enable-languages=c,c++,objc"
14) Next, find this file in the ndk: build/tools/build-host-gcc.sh. Here, change the line:
ARGS=$ARGS" --enable-languages=c,c++"
to
ARGS=$ARGS" --enable-languages=c,c++,objc"
15) Enter the bash terminal (by typing bash), and enter these lines (replacing <...> with actual paths:
LOC="<path to NDK folder>/android-ndk-r8b/build/tools/build-gcc.sh"
SRC="<path to NDK folder>/toolchain-src"
NDK="<path to NDK folder>/android-ndk-r8b"
TOOL="arm-linux-androideabi-4.6.1"
sh $LOC --gmp-version=4.2.4 --mpfr-version=2.4.1 --mpc-version=0.8.1 --binutils-version=2.23 --try-64 $SRC $NDK $TOOL
This begins to work, but fails with the following message (found in the output config.log file):
build-gcc.sh:1771: error: cannot find install-sh, install.sh, or shtool in "<path to NDK>/android-ndk-r8b/build/tools" "<path to NDK>/android-ndk-r8b/build/tools/.." "<path to NDK>/android-ndk-r8b/build/tools/../.."
Looking at the build-gcc.sh file, it has far less lines than 1771. Further investigation has brought me to believe that this error is occurring in the /toolchain-src/gcc/gcc-4.6.1/configure file, but I do not know what to fix.
Does anyone know how I can fix this? I am not looking for external links, or prebuilt solutions (such as CrystaX' custom ndk-r7), as I have already read and tried a lot.
Upvotes: 1
Views: 1816
Reputation: 36289
Strangely, I had to delete my existing NDK and re-unarchive it. After that it worked. I had originally installed the NDK as the first step, however it should be moved to before step 15.
Upvotes: 2