3
votes

I downloaded the Android Open Source Project and built it on Linux (Ubuntu 12.04 64-bit) using the instructions here:

http://source.android.com/source/building.html

I can get it to build without a problem. When the build is done, I'm interested in the build tools, particularly aapt. When I run it, I see this:

awt@aosp-build:/aosp/out/host/linux-x86/sdk/sdk/android-sdk_eng.awt_linux-x86/build-tools/android-5.0.50.50.50.50$ ./aapt
./aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory

So, that's strange. Especially considering that libc++.so is right there in the same directory:

awt@aosp-build:/aosp/out/host/linux-x86/sdk/sdk/android-sdk_eng.awt_linux-x86/build-tools/android-5.0.50.50.50.50$ ls -l

-rwxrwxr-x 1 awt awt 1118633 Feb  4 19:42 aapt
-rwxrwxr-x 1 awt awt 1261036 Feb  4 19:42 libc++.so

$ file aapt
aapt: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, not stripped
$ file libc++.so 
libc++.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

I've built and used older Android versions of build-tools, the last one was 4.3. To get that one to run, I needed:

$ sudo apt-get install ia32-libs

That allowed me to run it and it worked. With the latest from Android, this is no longer enough. I still get the libc++.so: cannot open shared object file message.

There are other intermediate versions of aapt in the out directory. For example, this one:

$ file /aosp/out/host/linux-x86/bin/aapt aapt: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, not stripped $ ls -l /aosp/out/host/linux-x86/bin/aapt -rwxrwxr-x 1 awt awt 6978260 Feb 4 17:50 aapt

This one runs. It hasn't been stripped yet so the shared libs are still embedded in it. If I strip it:

$ strip -s aapt
$ ./aapt
./aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory

Then we're back to where we started. What can I do to to make the stripped version run the way it used to?

1

1 Answers

1
votes

This is an older question but a recent upvote on it reminded me that I do have a solution.

The answer is to append the location of libc++.so to the current LD_LIBRARY_PATH:

$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path/to/libc++.so
$ ./aapt -version
Android Asset Packaging Tool

Usage:
   aapt l[ist] [-v] [-a] file.{zip,jar,apk}
   List contents of Zip-compatible archive.