检查系统当前的版本 # rpm -qi glibc Name : glibc Relocations: (not relocatable) Version : 2.5 Vendor: Red Hat, Inc. Release : 49 Build Date: Wed 10 Mar 2010 07:01:43 PM CST Install Date: Wed 01 Jun 2011 05:50:51 PM CST Build Host: x86-005.build.bos.redhat.com Group : System Environment/Libraries Source RPM: glibc-2.5-49.src.rpm Size : 11658546 License: LGPL Signature : DSA/SHA1, Thu 18 Mar 2010 01:18:05 AM CST, Key ID 5326810137017186 Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Summary : The GNU libc libraries. Description : The glibc package contains standard libraries which are used by multiple programs on the system. In order to save disk space and memory, as well as to make upgrading easier, common system code is kept in one place and shared between programs. This particular package contains the most important sets of shared libraries: the standard C library and the standard math library. Without these two libraries, a Linux system will not function.
出错与解决: 1. 运行configure时报错: # /usr/src/glibc-2.22-build/glibc-2.22/configure --prefix=/usr/src/glibc-2.22-build/ --with-headers=/usr/include checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking for suffix of object files... configure: error: in `/usr/src/glibc-2.22-build/glibc-2.22‘: configure: error: cannot compute suffix of object files: cannot compile See `config.log‘ for more details
解决方案: 是本机的GCC没有安装或配置好,需要重新安装和配置GCC;
2. 运行configure时报错: checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-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 readelf... readelf checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking whether g++ can link programs... yes checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nacl nios2 powerpc s390 sh sparc tile x86_64 checking whether gcc
compiles in -mx32 mode by default... no
configure: running configure fragment for add-on libidn checking for assembler and linker STT_GNU_IFUNC support... no checking whether .text pseudo-op must be used... yes checking sysdep dirs... sysdeps/unix/sysv/linux/x86_64/64 sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/x86 sysdeps/unix/sysv/linux/wordsize-64 sysdeps/x86_64/nptl
sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/x86_64 sysdeps/unix sysdeps/posix sysdeps/x86_64/64 sysdeps/x86_64/fpu sysdeps/x86/fpu sysdeps/x86_64 sysdeps/x86 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64/wordsize-64
sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/wordsize-64 sysdeps/ieee754 sysdeps/generic checking for a BSD-compatible install... /usr/bin/install -c checking whether ln -s works... yes checking whether as is GNU as... yes checking whether ld is GNU ld... yes checking for as... as checking version of as... 2.17.50.0.6, bad checking for ld... ld checking version of ld... 2.17.50.0.6, bad checking for gnumake... no checking for gmake... gmake checking version of gmake... 3.81, ok checking for gnumsgfmt... no checking for gmsgfmt... no checking for msgfmt... msgfmt checking version of msgfmt... 0.17, ok checking for makeinfo... makeinfo checking version of makeinfo... 4.8, ok checking for sed... sed checking version of sed... 4.1.5, ok checking for gawk... gawk checking version of gawk... 3.1.5, ok checking if gcc is sufficient to build libc... no checking for nm... nm configure: error: *** These critical programs are missing or too old: as ld compiler *** Check the INSTALL file for required versions.
解决办法: 问题原因: 缺少autoconf或版本太低
下载安装新版本
# wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz # tar zxvf autoconf-2.68.tar.gz # cd autoconf-2.68 # ./configure --prefix=/usr/ # make && make install
查看当前版本:
# autoconf -V autoconf (GNU Autoconf) 2.68 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+/Autoconf: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
3. 运行configure时报错:: checking whether ranlib is necessary... no checking LD_LIBRARY_PATH variable... contains current directory configure: error: *** LD_LIBRARY_PATH shouldn‘t contain the current directory when *** building glibc. Please change the environment variable *** and run configure again.
4.当有如下错误时: configure: error: gcc must provide the header
解决办法: get the cpuid.h file from official GCC respositories> (http://gcc.gnu.org/viewcvs/gcc/tags/GC_4_14/boehm-gc/)> and put it into /usr/include(上面指定的--with-headers) “locate cpuid”,其中可以发现“/usr/lib/gcc/i686-redhat-linux/4.7.0/include/cpuid.h”。打开该文件
5. 当以上问题都解决时,make make install吧,由于东西比较多,需要些时间,大概半小时左右。
glibc版本查看, 可使用命令: # ldd --version ldd (GNU libc) 2.5 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper.