月度存档: 十二月 2012

ubuntu10.10下编译glibc

目的很单纯,就是下一个glibc看看源码,学习学习。学习之前想编译一下,编译不过当然不爽。
分享一下,希望对同样目的单纯的人有所帮助。

glibc源码下载地址ftp://ftp.gnu.org/gnu/glibc/
一开始下载了glibc-2.9.tar.bz2

configure: error:
*** These critical programs are missing or too old: as ld
*** Check the INSTALL file for required versions.

出现这个错误,估计是和内核版本不匹配。
查看下系统使用的libc的版本号

~$ ls -l /lib/libc.so.6
lrwxrwxrwx 1 root root 14 2012-11-03 23:16 /lib/libc.so.6 -> libc-2.12.1.so

因为只是学习,版本不重要,就下了glibc-2.12.2。

然后解压到glibc-2.12.2目录。

~/glibc-2.12.2$ ./configure 
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
configure: error: you must configure in a separate build directory

继续阅读 »