【发布时间】:2015-04-04 20:04:51
【问题描述】:
我下载了 Android 开源项目并使用此处的说明在 Linux(Ubuntu 12.04 64 位)上构建它:
http://source.android.com/source/building.html
我可以毫无问题地构建它。构建完成后,我对构建工具很感兴趣,尤其是 aapt。当我运行它时,我看到了这个:
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
所以,这很奇怪。特别是考虑到 libc++.so 就在同一目录中:
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
我已经构建并使用了较旧的 Android 版本的构建工具,最后一个是 4.3。为了让那个运行,我需要:
$ sudo apt-get install ia32-libs
这让我可以运行它并且它有效。使用 Android 的最新版本,这已经不够了。我仍然收到libc++.so: cannot open shared object file message。
在 out 目录中还有其他中间版本的 aapt。比如这个:
$ 文件 /aosp/out/host/linux-x86/bin/aapt aapt:ELF 32 位 LSB 共享对象,Intel 80386,版本 1 (SYSV),动态链接(使用共享库),用于 GNU/Linux 2.6.24,未剥离 $ ls -l /aosp/out/host/linux-x86/bin/aapt -rwxrwxr-x 1 awt awt 6978260 Feb 4 17:50 aapt
这个运行。它还没有被剥离,所以共享库仍然嵌入其中。如果我剥离它:
$ strip -s aapt
$ ./aapt
./aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory
然后我们回到我们开始的地方。我该怎么做才能使剥离的版本以以前的方式运行?
【问题讨论】: