patching ndk compiling error

42 views
Skip to first unread message

guivigon

unread,
May 9, 2011, 2:10:52 PM5/9/11
to android-objc
Hi

I tried to patch ndk following instructions and I got an error. I'm
using Mac Os 10.5. The error is:

/Users/guillermo/software/android/ndk-toolchain/build/gcc-4.2.1/./gcc/
xgcc -B/Users/guillermo/software/android/ndk-toolchain/build/
gcc-4.2.1/./gcc/ -B/usr/local/android//arm-android-eabi/bin/ -B/usr/
local/android//arm-android-eabi/lib/ -isystem /usr/local/android//arm-
android-eabi/include -isystem /usr/local/android//arm-android-eabi/sys-
include -c -DHAVE_CONFIG_H -O2 -Os -g -I. -I../../../../gcc-4.2.1/
libiberty/../include -W -Wall -pedantic -Wwrite-strings -Wstrict-
prototypes -Wc++-compat ../../../../gcc-4.2.1/libiberty/regex.c -o
regex.o
In file included from /usr/local/android//arm-android-eabi/include/sys/
types.h:34,
from /usr/local/android//arm-android-eabi/include/
strings.h:42,
from /usr/local/android//arm-android-eabi/include/
stdlib.h:42,
from ../../../../gcc-4.2.1/libiberty/regex.c:128:
/usr/local/android//arm-android-eabi/include/stdint.h:212: error:
duplicate 'unsigned'
In file included from /usr/local/android//arm-android-eabi/include/
strings.h:42,
from /usr/local/android//arm-android-eabi/include/
stdlib.h:42,
from ../../../../gcc-4.2.1/libiberty/regex.c:128:
/usr/local/android//arm-android-eabi/include/sys/types.h:72: error:
two or more data types in declaration specifiers
make[3]: *** [regex.o] Error 1
make[2]: *** [all-target-libiberty] Error 2
make[1]: *** [all] Error 2
make: *** [stmp-build-target-gcc] Error 2

Looks like the error is from android ndk header files. Does anyone
knows how to solve it?

Thanks in advance.

Best regards.

Philippe Hausler

unread,
May 9, 2011, 3:26:35 PM5/9/11
to android-...@googlegroups.com, guivigon
What version of the NDK are you patching?

guivigon

unread,
May 10, 2011, 4:10:14 AM5/10/11
to android-objc
Hi

- the ndk is the last version: r5b

- the toolchain is the one that can be downloaded from the patching
tutorial.

Should I try with an older version of the ndk?

Best regards.

Philippe Hausler

unread,
May 10, 2011, 11:40:40 AM5/10/11
to android-...@googlegroups.com, guivigon

On May 10, 2011, at 3:10 AM, guivigon wrote:

> Hi
>
> - the ndk is the last version: r5b
>
> - the toolchain is the one that can be downloaded from the patching
> tutorial.
>
> Should I try with an older version of the ndk?

Give r3 a whirl (that was the last rev that I had tested against). My current versions are no longer using a patched version of GCC and using clang instead due to licensing issues.

guivigon

unread,
May 12, 2011, 2:24:23 PM5/12/11
to android-objc
Hi

I've tried with ndk version r3. Toolchain is the one in the link and
got this error:

../../../../gcc-4.2.1/libiberty/getpwd.c: In function 'getpwd':
../../../../gcc-4.2.1/libiberty/getpwd.c:87: error: 'PATH_MAX'
undeclared (first use in this function)
../../../../gcc-4.2.1/libiberty/getpwd.c:87: error: (Each undeclared
identifier is reported only once
../../../../gcc-4.2.1/libiberty/getpwd.c:87: error: for each function
it appears in.)
make[3]: *** [getpwd.o] Error 1
make[3]: Leaving directory `/home/localgv11/software/android/android-
ndk-toolchain-20090323/build/gcc-4.2.1/arm-android-eabi/libiberty'
make[2]: *** [all-target-libiberty] Error 2
make[2]: Leaving directory `/home/localgv11/software/android/android-
ndk-toolchain-20090323/build/gcc-4.2.1'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/localgv11/software/android/android-
ndk-toolchain-20090323/build/gcc-4.2.1'
make: *** [stmp-build-target-gcc] Error 2

Anyway, I'm considering to use 'clang', but how do you use it? You
just download clang and later use it as compiler to generate native
code with the android ndk to be used from Android application? If this
is correct, how to tell ndk that it must used the clang compiler? Any
modifications to makefiles used by ndk?

I have other cuestion. I would like to use from Android a game engine
implemented in objective-C and available for iPhone SDK. I guess it
uses Foundation, etc... So you think it will be possible get it using
clang and using other libraries like GNUStep or others mentioned in
some topics of this forum?

Thank you in advance.

Best regards.

Philippe Hausler

unread,
May 12, 2011, 3:16:14 PM5/12/11
to android-...@googlegroups.com

Clang if compiled from scratch (not the one included in the Xcode dev tools, but if your host OS is a linux or bsd it may work since the clang packages for those are actually clang and not apple-clang) can support a target triple of arm-android-eabi which will generate proper binaries. However you will have to have the libs and headers in a proper sysroot for your targets (along the lines of using the NDK dirs as a sysroot w/ some modifications of file locations or using a few header path and lib path flags). Using clang is then separate from the standard NDK build mechanics, you have to make the jni libs as if they were for a standard linux and then manually copy them into your project directory.

As per building a game engine on this process: I would highly suggest against it at the current moment since GNUStep is not portable yet to Android, as well as there are missing libraries and differences for accessing graphics APIs. This is all still very thought-experement stage and no where near production stable methodologies.

My current compiler takes a bit of a different tact than strictly compiling the source directly into jni binaries and hopefully will end up creating non cpu dependent products for Android.

Reply all
Reply to author
Forward
0 new messages