如何安装 glibc-2.15.tar

作者&投稿:毅砖 (若有异议请与网页底部的电邮联系)
Linux中如何升级glibc?~

编译安装glibc1.下载glibc
wget http://ftp.gnu.org/gnu/glibc/glibc-2.3.2.tar.gz2.下载glibc-linuxthreads
wget http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.3.2.tar.gz3.解压
tar -zxvf glibc-2.3.2.tar.gzcd glibc-2.3.2tar -zxvf ../glibc-linuxthreads-2.3.2.tar.gzcd .../glibc-2.3.2/configure --prefix=/usr --disable-profile --enable-add-ons --libexecdir=/usr/lib --with-headers=/usr/includemakemake install注意点:1、要将glibc-linuxthreads解压到glibc目录下。2、不能在glibc当前目录下运行configure

1.试图运行程序,提示"libc.so.6: version `GLIBC_2.14' not found",原因是系统的glibc版本太低,软件编译时使用了较高版本的glibc引起的:
[ghui@StuOS bin]$ pwd
/var/VMdisks/cross/mingw32/bin
[ghui@StuOS bin]$ ls
lrelease QtCore4.dll QtNetwork4.dll QtSql4.dll QtXml4.dll
moc QtDeclarative4.dll QtOpenGL4.dll QtSvg4.dll rcc
phonon4.dll QtGui4.dll QtScript4.dll QtTest4.dll uic
qmake QtMultimedia4.dll QtScriptTools4.dll QtWebKit4.dll
[ghui@StuOS bin]$ ./qmake
./qmake: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./qmake)

2.查看系统glibc支持的版本:
[ghui@StuOS bin]$ strings /lib64/libc.so.6 |grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_PRIVATE
[ghui@StuOS bin]$ rpm -qa |grep glibc
glibc-static-2.12-1.80.el6_3.6.x86_64
glibc-headers-2.12-1.80.el6_3.6.x86_64
glibc-common-2.12-1.80.el6_3.6.x86_64
glibc-devel-2.12-1.80.el6_3.6.x86_64
glibc-static-2.12-1.80.el6_3.6.i686
glibc-devel-2.12-1.80.el6_3.6.i686
glibc-2.12-1.80.el6_3.6.i686
glibc-2.12-1.80.el6_3.6.x86_64

3.可以看到最高只支持2.12版本,所以考虑编译解决这个问题:
a. 到http://www.gnu.org/software/libc/下载最新版本,我这里下载了glibc-2.14.tar.xz 这个版本,解压到任意目录准备编译
b.这里解压到/var/VMdisks/glibc-2.14/
[ghui@StuOS bin]$ cd /var/VMdisks/glibc-2.14/
[ghui@StuOS glibc-2.14]$ pwd
/var/VMdisks/glibc-2.14
[ghui@StuOS glibc-2.14]$ ls
abilist config.h.in intl README.libm
abi-tags config.log io resolv
aclocal.m4 config.make.in libc-abis resource
aout configure libidn rt
argp configure.in libio Rules
assert conform LICENSES scripts
autom4te.cache CONFORMANCE locale setjmp
bits COPYING localedata shadow
BUGS COPYING.LIB login shlib-versions
build cppflags-iterator.mk mach signal
CANCEL-FCT-WAIVE crypt Makeconfig socket
CANCEL-FILE-WAIVE csu Makefile soft-fp
catgets ctype Makefile.in stdio-common
ChangeLog debug Makerules stdlib
ChangeLog.1 dirent malloc streams
ChangeLog.10 dlfcn manual string
ChangeLog.11 elf math sunrpc
ChangeLog.12 extra-lib.mk misc sysdeps
ChangeLog.13 extra-modules.mk NAMESPACE sysvipc
ChangeLog.14 FAQ NEWS termios
ChangeLog.15 FAQ.in nis test-skeleton.c
ChangeLog.16 gmon NOTES time
ChangeLog.17 gnulib nptl timezone
ChangeLog.2 grp nptl_db tls.make.c
ChangeLog.3 gshadow nscd version.h
ChangeLog.4 hesiod nss Versions.def
ChangeLog.5 hurd o-iterator.mk wcsmbs
ChangeLog.6 iconv po wctype
ChangeLog.7 iconvdata posix WUR-REPORT
ChangeLog.8 include PROJECTS
ChangeLog.9 inet pwd
conf INSTALL README

c.在glibc源码目录建立构建目录,并cd进入构建目录
[ghui@StuOS glibc-2.14]$ mkdir build
[ghui@StuOS glibc-2.14]$ cd build

d.运行configure配置,make && sudo make install
[ghui@StuOS build]$ ../configure --prefix=/opt/glibc-2.14
[ghui@StuOS build]$ make -j4
[ghui@StuOS build]$ sudo make install
[sudo] password for ghui:

4.临时修改环境变量
[ghui@StuOS bin]$ export LD_LIBRARY_PATH=/opt/glibc-2.14/lib:$LD_LIBRARY_PATH
[ghui@StuOS glibc-2.14]$ cd /var/VMdisks/cross/mingw32/bin/

[ghui@StuOS bin]$ ./qmake
Usage: ./qmake [mode] [options] [files]

QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project
...

编译步骤:
下载glibc-2.15.tar.gz和补丁包glibc-ports-2.15.tar.gz
解压
$mv glibc-ports-2.15 glibc-2.15/ports
$mkdir glibc-build-2.15 &&cd glibc-build-2.15
$ ../glibc-2.15/configure \
--prefix=/usr/local/glibc_mips \
CC=mipsel-linux-gcc \
--host=mipsel-linux \
--build=i686-pc-linux-gnu \
--enable-add-on=nptl \
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes \
libc_cv_mips_tls=yes \
libc_cv_gnu99_inline=yes
ok,没问题
$make &&make install
大功告成

##########################################################################

下面是我编译时的过程和遇到的问题及解决:
##########################################################################

$tar xvf glibc-2.16.0.tar.bz2
$cd glibc-2.16.0
$./configure --prefix=/usr/local/glibc //先不加其他选项,除了安装路径,一切默认,网上一般配置arm的选项如下 --prefix=$HOME/usr/arm --with-headers=$HOME/usr/arm/glibc/arm-linux-glibc/include --with-libs=$HOME/usr/arm/glibc/arm-linux-glibc/lib
报错:
configure: error: you must configure in a separate build directory

很奇怪的问题,必须配置一个构建目录,刚开始以为是安装目录为创建
$mkdir /usr/local/glibc
问题仍然存在,百度之
$mkdir ../glibc-build && cd ../glibc-build
$../glibc-2.16.0/configure --prefix=/usr/local/glibc
出现新的问题:
configure: WARNING:
*** These auxiliary programs are missing or incompatible versions: msgfmt
*** some features will be disabled.
*** Check the INSTALL file for required versions.
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.
第一个警告不用管它,第二个LD_LIBRARY_PATY也会有错?我的这个路径用了多少天了。仔细看提示,不应包含当前路径。打开~/.bash_profile
$cat ~/.bash_profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib export LD_LIBRARY_PATH

这也没当前路径啊。还是百度吧。
一个兄弟的解释是这样“LD_LIBRARY_PATH不能以终结符作为开始和最后一个字符,不能有2个终结符连在一起,我的LD_LIBRARY_PATH为 :/usr/local/firefox:/usr/local/firefox,只要在前面加上一个路径,不让:出现在第一个字符就可以了 ”
原来如此,第一个字符不能是":",修改~/.bash_profile
export LD_LIBRARY_PATH=/usr/local/lib export LD_LIBRARY_PATH

$../glibc-2.16.0/configure --prefix=/usr/local/glibc
ls一下,发现,当前目录生成了Makefile等一堆东西
$make && make install
没问题
下一步开始交叉编译
$mkdir ../glibc-build-mips && cd ../glibc-build-mips
$ ../glibc-2.16.0/configure --prefix=/usr/local/glibc_mips CC=mipsel-linux-gcc --host=mips
出现新的问题:
configure: running configure fragment for add-on libidn
configure: running configure fragment for add-on nptl
*** The GNU C library is currently not available for this platform.
*** So far nobody cared to port it and if there is no volunteer it
*** might never happen. So, if you have interest to see glibc on
*** this platform visit
*** http://www.gnu.org/software/libc/porting.html
*** and join the group of porters
看起来像是需要path,下载glibc-ports-2.16.tar.gz,放在源码包目录,解压
$ ../glibc-2.16.0/configure \
--prefix=/usr/local/glibc_mips \
CC=mipsel-linux-gcc \
CXX=mipsel-linux-g++ \
--host=mips \
--enable-add-ons=/home/hb/code/glibc/glibc-ports-2.16.0/sysdeps/mips
仍然报错:
configure: error: fragment must set $libc_add_on_canonical
改为:
$ ../glibc-2.16.0/configure \
--prefix=/usr/local/glibc_mips \
CC=mipsel-linux-gcc \
CXX=mipsel-linux-g++ \
--host=mips \
--enable-add-ons
报错:
configure: error: The mipsel is not supported.
这样不行,谷歌半天,总算知道补丁怎么用的了。把补丁目录拷到glibc目录下,改名为ports
$mv glibc-ports-2.16.0/ glibc-2.16.0/ports

$../glibc-2.16.0/configure \
--prefix=/usr/local/glibc_mips \
CC=mipsel-linux-gcc \
CXX=mipsel-linux-g++ \
--host=mipsel-linux \
--build=i686-pc-linux-gnu \
--enable-add-on
继续报错:
configure: error:
*** These critical programs are missing or too old: ld as
*** Check the INSTALL file for required versions.
这个问题可折腾死我了。弄了好半天,就是不行,最后google发现,原来是ld和as版本不对,不是太高就是太低。
configure中找到$AS --version
发现版本是这么匹配的2.1*.*
$mipsel-linux-ld
GNU ld (GNU Binutils) 2.18.50.20080908
原来是这样,在configure版本号那一行修改,最后的括号前面加入
|2.18.50.×
as那一行也同样修改
然后
$make
开始编译,看起来不错
好半天后,编译也报错了

In file included from ../include/uchar.h:1,
from mbrtoc16.c:23:
../wcsmbs/uchar.h:47:5: error: #error "<uchar.h> requires ISO C11 mode"
In file included from ../include/uchar.h:1,
from mbrtoc16.c:23:
../wcsmbs/uchar.h:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char16_t'
../wcsmbs/uchar.h:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char32_t'
../wcsmbs/uchar.h:61: error: expected ')' before '*' token
../wcsmbs/uchar.h:66: error: expected declaration specifiers or '...' before 'char16_t'
../wcsmbs/uchar.h:73: error: expected ')' before '*' token
../wcsmbs/uchar.h:78: error: expected declaration specifiers or '...' before 'char32_t'
mbrtoc16.c:37: error: expected ')' before '*' token
make[2]: *** [/home/hb/code/glibc/glibc-build-mips/wcsmbs/mbrtoc16.o] 错误 1
make[2]:正在离开目录 `/home/hb/code/glibc/glibc-2.16.0/wcsmbs'
make[1]: *** [wcsmbs/subdir_lib] 错误 2
make[1]:正在离开目录 `/home/hb/code/glibc/glibc-2.16.0'
make: *** [all] 错误 2
看看这个头文件咋回事
$ vim ../glibc-2.16.0/wcsmbs/uchar.h
#if defined __GNUC__ && !defined __USE_ISOCXX11
/* Define the 16-bit and 32-bit character types. Use the information
provided by the compiler. */
# if !defined __CHAR16_TYPE__ || !defined __CHAR32_TYPE__
# if defined __STDC_VERSION__ && __STDC_VERSION__ < 201000L
# error "<uchar.h> requires ISO C11 mode"
# else
# error "definitions of __CHAR16_TYPE__ and/or __CHAR32_TYPE__ missing"
# endif

# endif

明白了,原来是需要c11支持,mipsel-linux-gcc -v一下,我的支持c99.原来如此。暂时没招了,我还做不到修改c11的支持,只剩两个办法,不用这个glibc版本或者重新编译一个支持c11的交叉编译器。编译器需要做的比较多,暂时先换个低点的版本吧。
下载galibc-2.15版本
重复上面步骤,解压tar包
解压ports包
$mv glibc-ports-2.15 glibc-2.15/ports
$mkdir glibc-build-2.15 &&cd glibc-build-2.15
$ ../glibc-2.15/configure \
--prefix=/usr/local/glibc_mips \
CC=mipsel-linux-gcc \
--host=mipsel-linux \
--build=i686-pc-linux-gnu \
--enable-add-on=nptl \
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes \
libc_cv_mips_tls=yes \
libc_cv_gnu99_inline=yes
ok,没问题
$make &&make install
库已经编好了,但是不能直接使用,必须再用新的库重编一遍编译器才行。

上一篇


临县15235034223: 如何安装 glibc - 2.15.tar -
牟丹热淋: 一般来说,像这种tar.gz的包都是需要用户自己编译来安装的 所以首先tar zxvf glibc2.1.tar.gz解压文件 然后cd进入目录,然后看下有没有makefile 然后就configure,make,make install 类似这样的方式安装

临县15235034223: ubuntu下怎么安装glibc -
牟丹热淋: 你确定Ubuntu下面的glibc的开发包叫glibc-devel?devel后缀是rpm系的习惯吧,deb系用的是dev,而且Ubuntu下面的glibc不叫这名字吧,libc才是吧.至于zlib,我就不知道你要安装的是开发包还是运行库了.

临县15235034223: mysql怎么在linux安装 -
牟丹热淋: mysql怎么在linux安装 安装包:mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz 使用xshell连接linux服务器,使用root用户名登录,依次执行以下命令:======================================================/usr/sbin/groupadd mysql 【添...

临县15235034223: glibc是linux自带的吗,如果不是怎么下载?直接在网上下还是有什么要求 -
牟丹热淋: 可以用yum的指定下载进行下载这个包,但是不安装.不过依赖可能出问题 关于服务的安装以及管理,请参考书籍《Linux就该这么学》

临县15235034223: linux自带mysql 怎么安装 -
牟丹热淋: 到mysql官网下载mysql编译好的二进制安装包,在下载页面Select Platform:选项选择linux-generic,然后把页面拉到底部,64位系统下载Linux - Generic (glibc 2.5) (x86, 64-bit),32位系统下载Linux - Generic (glibc 2.5) (x86, 32-bit) 解压32位安装...

临县15235034223: 安装linux时如何安装GCC? -
牟丹热淋: 你可在你的光盘上找,有一个GCC包和4个依赖文件: glibc-devel-2.3.4-2.13.i386.rpm cpp-3.4.4-2.i386.rpm glibc-kernheaders-2.4-9.1.98.EL.i386.rpm glibc-headers-2.3.4-2.13.i386.rpm gcc-3.4.4-2.i386.rpm如没有的话,可以用网上自动更新的方式安装,如fedora的话可用yum install gcc这条命令自动安装.

临县15235034223: 哪位大神简要介绍一下Linux如何安全升级glibc?我在debian下成功编译了新版本的glibc -
牟丹热淋: 你可以借鉴一下gentoo的升级思路,因为gentoo都是源代码编译的 首先编译核心工具组(gcc, ld, binutils),注意使用静态编译(--disable-shared),安装到指定的位置(--with-sysroot --with-local-prefix) 然后chroot到那个位置编译glibc并安装 然后使用新的glibc静态编译核心工具组,chroot回去,覆盖安装回原来的地方 用此工具组再次本地编译glibc

临县15235034223: linux系统怎样安装mysql -
牟丹热淋: 方法/步骤 到mysql官网下载mysql编译好的二进制安装包,在下载页面Select Platform:选项选择linux-generic,然后把页面拉到底部,64位系统下载Linux - Generic (glibc 2.5) (x86, 64-bit),32位系统下载Linux - Generic (glibc 2.5) (x86, 32-bit) 解压...

临县15235034223: ubuntu 12.04怎么安装 glibc -
牟丹热淋: ubuntu 12.04 好像是eglibc, 不是glibc, 安装eglibc 请sudo apt-get install libc-dev-bin如果一定要装glibc, 请源码编译, 但是, 一定注意, 不能覆盖掉原来的eglibc, 可以通过configure 时添加--prefix=安装位置来安装. 然而这并没有什么鸟用, 因为, 这种方式安装上的glibc 没法用.

临县15235034223: linux下如何更新glibc包 -
牟丹热淋: 请不要自己更新 glibc .因为他是系统基础库.他如果出现函数接口变化(版本升级很容易出现这个问题),那么你的整个系统就不能用了. Linux 的依赖关系就是为了防止这种情况而设计的.

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网