I'm at the end of my rope on this one.
I'm new to Android development. I've read the GCC install documentation and parts of Embedded Android. I'm trying to cross-compile gcc 4.7 using an Android NDK toolchain built with the make-standalone-toolchain.sh script. I'm using the gcc and binutils source files from the NDK toolchain sources.
I copied the gcc-4.7 and binutils-2.23 into a directory gcc-src and created a 'build' directory alongside both, as follows:
gcc-src/gcc-4.7
gcc-src/binutils-2.23
gcc-src/build
I've symlinked the sources for
bfd,
gas,
gprof,
ld,
gprof
opcodes
from binutils to the gcc-4.7 source directory. I also ran the script in contrib/ that downloads the relevant sources for
gmp,
mpfr
mpc
and creates the appropriate symlinks
I've run configure with the (latest) following options:
sh ../gcc-4.7/configure --prefix=/usr/arm --disable-option-checking --host=arm-linux-eabi
--target=arm-linux-eabi --with-sysroot=/usr/sysroot --with-build-sysroot=/usr/sysroot --with-build-time-tools=/usr/bin --program-prefix=arm-
--disable-multilib --with-cpu=arm7 --enable-languages=c,c++,lto --disable-werror --disable-nls CC=arm-linux-androideabi-gcc GCC=arm-linux-androideabi-gcc
CFLAGS='-Wall -g -mfloat-abi=softfp -mbionic -mandroid -Wl,-lsupc++ -Wl,-lgnustl_shared'
CPPFLAGS='-Wall -g -mbionic -mandroid' LDFLAGS='-Wl,-lsupc++ -Wl,-lgnustl_shared' CXX=arm-linux-androideabi-g++
LD=arm-linux-androideabi-ld STRIP=arm-linux-androideabi-strip OBJDUMP=arm-linux-androideabi-objdump READELF=arm-linux-androideabi-readelf
AS=arm-linux-androideabi-as NM=arm-linux-androideabi-nm
LIBS='-lc -ldl -lm' CC_FOR_TARGET=arm-linux-androideabi-gcc CPP_FOR_TARGET=arm-linux-androideabi-gcc CXX_FOR_TARGET=arm-linux-androideabi-g++
GCC_FOR_TARGET=arm-linux-androideabi-gcc RANLIB_FOR_TARGET=arm-linux-androideabi-gcc-ranlib LD_FOR_TARGET=arm-linux-androideabi-ld
AS_FOR_TARGET=arm-linux-androideabi-as NM_FOR_TARGET=arm-linux-androideabi-gcc-nm AR_FOR_TARGET=arm-linux-androideabi-gcc-ar
READELF_FOR_TARGET=arm-linux-androideabi-readelf
OBJDUMP_FOR_TARGET=arm-linux-androideabi-objdump STRIP_FOR_TARGET=arm-linux-androideabi-strip
host_configargs=--with-headers=/usr/sysroot/usr/include target_configargs=/usr/sysroot/usr/include
When I run make -d...or make -d all-host...it constantly fails when it tries to compile gen-fac_ui.c because it can't find the includes stdio.h, stdint.h or string.h.
I'll add the exact error tomorrow after I re-set my build directory and start again, but I wanted to post the details and problem tonight before I pass out.
Any help...is greatly appreciated. I'm at a loss on this one.
QUICK NOTE: I noticed that the binutils src directory contains an include/ folder...I'll try symlinking that into the gcc src directory and running 'make distclean' then '../gcc-4.7/configure && make again.'
UPDATE: symlinking include/ did not fix the problem. Here's the error I'm continuously getting
make[2]: Entering directory `/project/android/tc-src/gcc/gcc-src/build/gmp'
gcc `test -f 'gen-fac_ui.c' || echo '../../gcc-4.7/gmp/'`gen-fac_ui.c -o gen-fac_ui
Putting child 0x007ddd30 (gen-fac_ui) PID 25531 on the chain.
Live child 0x007ddd30 (gen-fac_ui) PID 25531
../../gcc-4.7/gmp/gen-fac_ui.c:20:19: error: stdio.h: No such file or directory
../../gcc-4.7/gmp/gen-fac_ui.c:21:20: error: stdlib.h: No such file or directory
In file included from ../../gcc-4.7/gmp/gen-fac_ui.c:23:
../../gcc-4.7/gmp/dumbmp.c:42:20: error: string.h: No such file or directory
In file included from ../../gcc-4.7/gmp/gen-fac_ui.c:23:
I successfully compiled gen-fac_ui by doing the following:
Uninstalling the build gcc which is not (I think) needed as I'm using the cross-compiler toolchain generated by the make-standalone-toolchain.sh script from the Android NDK
Configuring the appropriate variables to set up the cross-compiler tools as the BUILD tools.
I have a different problem now, which I'll post in a different question. Basically, while gen-fac_ui compiles, it (of course) won't run.
Related
I'm making a project with 2 variations, a desktop version and an android version. Both of them are using the same c++ code base. I want to use TFLite without getting into any android configuration like gradle or an aar file. I just want a pure .so file that my c++ can use thus android can through ndk. I know there are some complications like ndk using clang and requiring arm64 architecture, but I think it should be possible. Note that my project requires ndk version 22 and above.
Here is how I configured tflite for my desktop/debian project:
On ~/Desktop/ I ran git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
mkdir tflite_build & cd ~/Desktop/tflite_build
cmake ../tensorflow_src/tensorflow/lite
cmake --build . I've removed the -J flag regardless of what the docs says because it causes my pc to freeze.
mkdir ~/Desktop/tf_test & cd ~/Desktop/tf_test
Create a CMakeLists.txt and a main.cpp file inside tf_testdirectory.
Put the main code from the minimal example on the github repo provided above then this code in CMake:
cmake_minimum_required(VERSION 3.16)
project(minimal C CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTFLITE_DISABLE_TELEMETRY=1")
set(TENSORFLOW_SOURCE_DIR "" CACHE PATH
"Directory that contains the TensorFlow project" )
if(NOT TENSORFLOW_SOURCE_DIR)
get_filename_component(TENSORFLOW_SOURCE_DIR
"/home/user/Desktop/tensorflow_src" ABSOLUTE)
endif()
add_subdirectory(
"${TENSORFLOW_SOURCE_DIR}/tensorflow/lite"
"${CMAKE_CURRENT_BINARY_DIR}/tensorflow-lite" EXCLUDE_FROM_ALL)
add_executable(minimal minimal.cc)
target_link_libraries(minimal tensorflow-lite)
Created the folder tf_Test/build and ran cmake .. inside it.
After cmake is completed I run make inside the build directory
This works just fine on debian. However when I try to add this to my cmake on my android ndk project, connect my tablet and run the project I get all these errors:
...
- Looking for strtoull_l - found
-- Using toolchain file: /home/user/Android/Sdk/ndk/25.0.8775105/build/cmake/android.toolchain.cmake.
-- CMAKE_CXX_FLAGS: -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions -fvisibility=hidden -std=c++17 -O0 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pthread -frtti -fexceptions
-- Found Python3: /usr/bin/python3.9 (found suitable version "3.9.2", minimum required is "3.5") found components: Interpreter
-- Downloading pthreadpool to /home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/pthreadpool-source (define PTHREADPOOL_SOURCE_DIR to avoid it)
-- Configuring incomplete, errors occurred!
See also "/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/pthreadpool-download/CMakeFiles/CMakeOutput.log".
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /home/user/Android/Sdk/ndk/25.0.8775105/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Downloading FP16 to /home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/FP16-source (define FP16_SOURCE_DIR to avoid it)
-- Configuring incomplete, errors occurred!
See also "/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/FP16-download/CMakeFiles/CMakeOutput.log".
-- Downloading FXdiv to /home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/FXdiv-source (define FXDIV_SOURCE_DIR to avoid it)
-- Configuring incomplete, errors occurred!
See also "/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/FXdiv-download/CMakeFiles/CMakeOutput.log".
-- RUY is enabled.
-- Configuring incomplete, errors occurred!
See also "/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/CMakeFiles/CMakeOutput.log".
See also "/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/CMakeFiles/CMakeError.log".
CMake Warning at /home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/abseil-cpp/CMakeLists.txt:70 (message):
A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake
3.8 and up. We recommend enabling this option to ensure your project still
builds correctly.
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
No such file or directory
CMake Error: Generator: execution of make failed. Make command was: &&
CMake Error at /home/user/Desktop/official_stuff/tensorflow_src/tensorflow/lite/CMakeLists.txt:167 (add_subdirectory):
add_subdirectory given source
"/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/pthreadpool-source"
which is not an existing directory.
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
No such file or directory
CMake Error: Generator: execution of make failed. Make command was: &&
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
No such file or directory
CMake Error: Generator: execution of make failed. Make command was: &&
CMake Error at /home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/xnnpack/CMakeLists.txt:844 (ADD_SUBDIRECTORY):
ADD_SUBDIRECTORY given source
"/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/pthreadpool-source"
which is not an existing directory.
CMake Error at /home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/xnnpack/CMakeLists.txt:884 (ADD_SUBDIRECTORY):
ADD_SUBDIRECTORY given source
"/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/FXdiv-source"
which is not an existing directory.
CMake Error at /home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/xnnpack/CMakeLists.txt:908 (ADD_SUBDIRECTORY):
ADD_SUBDIRECTORY given source
"/home/user/Desktop/native/examples/android/app/.cxx/Debug/5c1w1z3w/arm64-v8a/FP16-source"
which is not an existing directory.
What's the right way to approach this? Following the android build documentation on tflite's website causes a lot of problems.
Update:
Installing ninja fixed almost all my problems, the only error I have now is:
In file included from /home/user/Desktop/official_stuff/tensorflow_src/tensorflow/lite/python/interpreter_wrapper/python_error_reporter.cc:16:
/home/user/Desktop/official_stuff/tensorflow_src/tensorflow/lite/python/interpreter_wrapper/python_error_reporter.h:19:10: fatal error: 'Python.h' file not found
python3 is in fact installed on my system, I used it on a c code before.
Update: Adding this to top of my cmake solved the python issue:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/python3.9 -I/usr/include/python3.9 -Wno-unused-result -Wsign-compare -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -Wall")
Update:
Now I get:
In file included from /home/user/Desktop/SmartAlpha/official_stuff/tensorflow_src/tensorflow/lite/python/interpreter_wrapper/numpy.cc:17:
In file included from /home/user/Desktop/SmartAlpha/official_stuff/tensorflow_src/tensorflow/lite/python/interpreter_wrapper/numpy.h:49:
In file included from /usr/include/python3.9/Python.h:8:
/usr/include/python3.9/pyconfig.h:9:12: fatal error: 'aarch64-linux-gnu/python3.9/pyconfig.h' file not found
LAST EDIT: You seem to completely overlook what I'm trying to explain you the whole time about different architectures. Your phone is not running on the same cpu architecture as your desktop. Your desktop machine is most likely running on amd64, while your phone is most likely arm64 which is also known as Aarch64 (do you now see what the latest error means? - It can't find the appropriate packages for the correct architecture - you can see that from the path in the error message).
You installed the amd64 package by issuing sudo apt-get install python-dev not the arm64 package. Check this official debian wiki on how to use MultiArch packages
You need to:
Update your system so that it can download the packages for different architectures
And sudo apt-get install python-dev:arm64
EDIT: Regarding the error in the updated question, you are most likely missing python development packages. Since you are on Debian I've looked for a possible package of interested and this might be it:
python-dev, try to apt-get it for the correct architecture that you need and maybe it will resolve your issues.
Make sure that Ninja is installed. CMake is trying to use it - this confuses a lot of users as they most commonly use Makefiles and don't know that an alternative exists. I don't see you explicitly stating that you use CMake + Ninja and hence I mention it.
If you have Ninja installed then the issue is most likely caused by the fact that it can't resolve the path via just the executable name. Take a look at CMAKE_MAKE_PROGRAM to better understand what I mean.
If 2. is your issue then you can try and set the whole path to this CMAKE_MAKE_PROGRAM variable, i.e. set(CMAKE_MAKE_PROGRAM /absolute/path/to/bin/ninja) and see if resolves the issue.
I'm trying to cross port a big autotools project to Android, but I'm having some issues with the NDK configuration (I guess). When I run the configure script, everything goes well until I reach a point where the C++ Standard Template Library support is checked. Then configure: error: C++ Standard Template Libary unsupported shows up.
Taking a closer look into the config.log I found
/home/user/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c --sysroot=/home/user/android-ndk-r10e/platforms/android-21/arch-arm -Wall -O2 -DNDEBUG conftest.cpp >&5
conftest.cpp:30:16: fatal error: list: No such file or directory
#include <list>
These are the values for the environment variables
export ANDROID_NDK_ROOT=/home/user/android-ndk-r10e
export SYS_ROOT=/home/user/android-ndk-r10e/platforms/android-21/arch-arm
export ANDROID_EABI=arm-linux-androideabi-4.9
export ANDROID_TOOLCHAIN=${ANDROID_NDK_HOME}/toolchains/${ANDROID_EABI}/prebuilt/linux-x86_64
export CC="$ANDROID_TOOLCHAIN/bin/arm-linux-androideabi-gcc"
export CXX="$ANDROID_TOOLCHAIN/bin/arm-linux-androideabi-g++"
export CFLAGS="--sysroot=${SYS_ROOT}"
export LDFLAGS="--sysroot=${SYS_ROOT}"
export CXXFLAGS="--sysroot=${SYS_ROOT}"
I guess that I'm missing some includes or some libraries on the command (Although they should be in the sysroot folder).
Thanks for your help
According to http://developer.android.com/intl/es/ndk/guides/standalone_toolchain.html
The C++ Standard Template Library is not included in the pre-built toolchain. You need to install a standalone toolchain so a stl implementation is copied into the platform. See the Advanced Method section of the link above to solve it.
How can I build OpenSSL for Android ARM v7 (using Android NDK) on Win32?
Until the OpenSSL's wiki and setenv-android.sh are updated accordingly, I'll publish the recipe here. The required fixes to the process are:
Update setenv-android.sh to support Windows.
Update PATH to use Android NDK's (mingw) GNU make (rather than Cygwin's).
Invoke make with a Windows-style path to Cygwin's perl.
This recipe will be a strange hybrid of Cygwin and mingw (since Android NDK gcc toolchains for win32 are mingw). I'm assuming a Windows x86_64 build of the Android NDK unpacked into c:\android-ndk-r9d, and that you wish to use a gcc 4.8 toolchain.
Install Android NDK (duh!).
Install Cygwin -- make sure to include perl
Start Cygwin shell as an administrator to make sure native symlinks will work.
Within the console, run the following script to set the variables:
export \
CYGWIN=winsymlinks:native \
ANDROID_API=android-14 \
ANDROID_DEV=c:/android-ndk-r9d/platforms/android-14/arch-arm/usr \
PATH=/cygdrive/c/android-ndk-r9d/prebuilt/windows-x86_64/bin:/cygdrive/c/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin:$PATH \
MACHINE=armv7 \
SYSTEM=android \
ARCH=arm \
CROSS_COMPILE=arm-linux-androideabi-
Now, unpack openssl:
tar xzfv openssl-1.0.1i.tar.gz (or whatever your tarball is)
cd openssl-1.0.1i (or whatever your version is)
Make sure you have actual native Win32 (!) symlinks in include/openssl:
cmd /c "dir include\openssl"
You should see something like:
13-Aug-14 05:59 PM <SYMLINK> aes.h [..\..\crypto\aes\aes.h]
13-Aug-14 05:59 PM <SYMLINK> asn1.h [..\..\crypto\asn1\asn1.h]
(etc.)
Now it's time to configure:
./config shared -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine --openssldir=/foo/bar
Ignore the failure to build (due to failure to find perl). We'll rectify this right away. Do this:
make PERL=$(cygpath -w $(which perl))
Now wait for a few minutes until it builds, and presto, you have your libcrypto.so etc.
Just a couple of comments on my experience with this:
Executing this statement:
PERL=$(cygpath -w $(which perl))
in the cygwin shell allows the shell to interpret the backslashes as escape characters and the build process chokes. To solve this I did the following:
$ echo $(cygpath -w $(which perl))
which produced the windows formatted path to the perl executable:
C:\cygwin64\bin\perl
Then I added this line to the export shown above:
PERL=c:/cygwin64/bin/perl \
There are other ways of doing this, but it worked and headed off the problem with the ./config statement documented above (not finding perl).
Second issue was the -no- statements. After running the configure, the script reports that you'll have to run make depend. I wanted to exclude MD5 (i.e. -no-md5) and when I did the make depend, it errored out with a report that MD5 was disabled. Uhhh, yes, that was kind of the idea, but I just won't use MD5 hashes. I did use the -no-ssl2 and didn't get any complaints after the make depend.
Third issue and this is a mystery. The build broke on compiling crypto because it could not find a symbol that is supposed to be defined in /crypto/objects/obj_xref.h. When I looked at the file, it was empty. Something in the perl script I suppose, but no time to debug right now, since I'm at proof of concept phase. I placed a copy from a patch that I picked up at https://github.com/devpack/openssl-android
After that, my build ran to completion. I've done no testing with this and it is not a trustworthy solution, but it did compile and produce the static libraries that I need for proof of concept for my client.
Just as an update, my shared library built with these libraries loaded fine on my target.
I create two standalone ndk compiler arm and x86, and set environment variable of windows, let's say CUSTOM_NDK. When I put arm path to CUSTOM_NDK, and under cygwin command line to compile such as arm-linux-androideabi-gcc -c xxx.cpp, it's working fine. But when I put x86 path to CUSTOM_NDK, close cygwin and reopen it to ensure the env variable is loaded, every time I launch i686-linux-android-gcc -c xxx.cpp, it gives me the following error:
i686-linux-android-gcc.exe: error: CreateProcess: No such file or directory
I use i686-linux-android-gcc --print-search-dirs, it gives me the following which seems correct to me
$ i686-linux-android-gcc -print-search-dirs
install: c:\dev\custom-android-toolchian_x86\bin\../lib/gcc/i686-linux-android/4.6/
programs: =c:/dev/custom-android-toolchian_x86/bin/../libexec/gcc/i686-linux-android/4.6/;c:/dev/custom-android-toolchian_x86/bin/../libexec/gcc/;c:/dev/custom-android-toolchian_x86/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/i686-linux-android/4.6/;c:/dev/custom-android-toolchian_x86/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/
libraries: =c:/dev/custom-android-toolchian_x86/bin/../lib/gcc/i686-linux-android/4.6/;c:/dev/custom-android-toolchian_x86/bin/../lib/gcc/;c:/dev/custom-android-toolchian_x86/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/lib/i686-linux-android/4.6/;c:/dev/custom-android-toolchian_x86/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/lib/;c:/dev/custom-android-toolchian_x86/bin/../sysroot/lib/i686-linux-android/4.6/;c:/dev/custom-android-toolchian_x86/bin/../sysroot/lib/;c:/dev/custom-android-toolchian_x86/bin/../sysroot/usr/lib/i686-linux-android/4.6/;c:/dev/custom-android-toolchian_x86/bin/../sysroot/usr/lib/
Any help is much appreciated!
Thanks
I've build the Android NDK toolchain manually. Everything works except when I use the compiler it can't find basic STL stuff like . So it can't compile code containing STL because it doesn't know where to look for the headers by default. I've never had this problem before using a custom or prebuilt toolchain. However if I manually add the include directories like
-I$(NDK_TOOLCHAIN)/arm-linux-androideabi/include/c++/4.6/
Then it works just fine. It is a pain to add every important dir manually (there is more than this one). Surely something broken in the process.
These are the steps I followed to get it build:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl
Download NDK
Untar NDK to [SOME_LOCATION], using /opt/ndk/
Set NDK_ROOT=/opt/ndk/
./build/tools/download-toolchain-sources.sh src/
Download MPC 0.9
Move mpc tar to ./src/mpc/
./build/tools/build-gcc.sh --gmp-version=4.3.2 --mpc-version=0.9 --mpfr-version=2.4.2 --binutils-version=2.21 $(pwd)/src $(pwd) arm-linux-androideabi-4.6
./build/tools/build-gcc.sh --gmp-version=4.3.2 --mpc-version=0.9 --mpfr-version=2.4.2 --binutils-version=2.21 $(pwd)/src $(pwd) x86-4.6
./build/tools/build-gcc.sh --gmp-version=4.3.2 --mpc-version=0.9 --mpfr-version=2.4.2 --binutils-version=2.21 $(pwd)/src $(pwd) mipsel-linux-android-4.6
All the STL files exist in the proper location. All the headers and compiled libraries for each version if I build a STANDALONE toolchain after using as reference these custom built toolchains.
==
UPDATE
Forcing gcc to spit out its include search paths:
echo "#include <bogus.h> int main(){}" > t.c; /opt/android-9_arm/bin/arm-linux-androideabi-gcc -v t.c; rm t.c
This contains a search path under includes:
/opt/android-9_arm/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/include
At that location is indeed the following ./cxx/4.6/STL_HEADERS
Comparing the output with a NDK build from google does indeed differ in serious spots. The real question is now how do I guarantee my custom build of GCC points to the appropriate G++ STL header location.
It turned out to be a bug in make-standalone-toolchain.sh. The fix was:
mv $NDK_TOOLCHAIN/arm-linux-androideabi/include/c++/4.6 $NDK_TOOLCHAIN/arm-linux-androideabi/include/c++/4.6.x-google
That fixed it for the most part. However now that the ndkr8b has released with official GCC 4.6 support this bug stills exists (as of july 25 2012). More details on some bugs related to the standalone toolchain (http://code.google.com/p/android/issues/detail?id=35279).