Ubuntu10.0.4安装NDK

android版本遇到.so文件crash,需要使用ndk来定位报错代码。

从这里下载ndk安装文件: http://www.androiddevtools.cn/

运行 ./android-ndk-r10d-linux-x86_64.bin     提示 libc.so.6: version `GLIBC_2.14' not found, 然后退出安装。

只好先安装glibc2.14          参考:http://blog.csdn.net/cpplang/article/details/8462768

 到http://www.gnu.org/software/libc/下载glibc2.14, 然后安装glibc2.14, 结果报错:

make[2]: *** [misc/syslog.o] Error 1
......
make[1]: *** [misc/subdir_lib] Error 2

根据报错信息misc/subdir_lib] Error 2搜索到此贴——http://blog.chinaunix.net/uid-223060-id-2215317.html ,修改configure配置

$ echo "CFLAGS +=-O2 -U_FORTIFY_SOURCE  -march=i586 -mtune=native -fno-stack-protector" >configparm
$ ../glibc-2.14/configure  --prefix=/usr  --disable-profile --enable-kernel=2.6.15
-march=i586改为自己机器对应的cpu架构,   -kernel=2.6.15改为自己的ubuntu内核版本

但修改configure配置后,还是报一样的错。然后是一堆重复的帖子,修改后重复同样的错误。

过了一天后,搜索ubuntu10.0.4安装glibc终于搜到了解决问题的帖子——http://blog.csdn.net/brucexu1978/article/details/8811836 ,

$ export CFLAGS="-O2 -U_FORTIFY_SOURCE -mtune=native -fno-stack-protector" 
$ ./glibc-2.14/configure --prefix=/usr --disable-profile --enable-add-ons --libexecdir=/usr/lib --with-headers=/usr/include 
$ make

然后glibc2.14顺利make(看来搜索关键字很重要啊!!!

但make install时,最后出现了报错信息

The script has found some problems with your installation! 
Please read the FAQ and the README file and check the following: 
- Did you change the gcc specs file (necessary after upgrading from 
Linux libc5)? 
- Are there any symbolic links of the form libXXX.so to old libraries? 
Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong, 
libm.so should point to the newly installed glibc file - and there should be 
only one such link (check e.g. /lib and /usr/lib) 
You should restart this script from your build directory after you've 
fixed all problems! 
Btw. the script doesn't work if you're installing GNU libc not as your 
primary library! 
make[1]: *** [install] Error 1 
make[1]: Leaving directory `/glibc-2.14' 
make: *** [install] Error 2 

难道要卡在glibc安装问题上了?看了下面的帖子后,发现此错误可以忽略,不影响glibc使用。

参考贴——http://www.linuxsir.org/bbs/thread311773.html

然后再运行 ./android-ndk-r10d-linux-x86_64.bin , ndk顺利安装

原文地址:https://www.cnblogs.com/antoon/p/4453056.html