您的位置:首页 > 其它

ubuntu升级glibc

2015-07-23 10:11 351 查看
需要运行一个DEMO,因为glibc版本过低,无法运行,所以需要升级glibc,错误提示如下:

$ ./nsm

./nsm: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./nsm)

查看系统的glibc版本:

$ ll /lib/i386-linux-gnu/libc.so.6

lrwxrwxrwx 1 root root 12 2012-11-16 05:21 /lib/i386-linux-gnu/libc.so.6 -> libc-2.13.so*

着手升级,正常步骤如下:

1、下载 glibc-2.14.tar.gz;

2、

注意要新创建那个build目录,不能在主目录下直接安装!

安装过程中遇到如下问题:

1、

root@ubuntu:/home/cq/下载/glibc-2.14/build# make && make instal

make -r PARALLELMFLAGS="" CVSOPTS="" -C .. objdir=`pwd` all

make[1]: 正在进入目录 `/home/cq/下载/glibc-2.14'

mawk -f scripts/gen-sorted.awk \

-v subdirs='csu assert ctype locale intl catgets math setjmp signal stdlib stdio-common libio malloc string wcsmbs time dirent grp pwd posix io termios resource misc socket sysvipc gmon gnulib iconv iconvdata wctype manual shadow gshadow po argp
crypt nss localedata timezone rt conform debug libidn dlfcn elf' \

-v srcpfx='' \

nptl/sysdeps/pthread/Subdirs sysdeps/unix/inet/Subdirs sysdeps/unix/Subdirs assert/Depend intl/Depend catgets/Depend stdlib/Depend stdio-common/Depend libio/Depend malloc/Depend string/Depend wcsmbs/Depend time/Depend posix/Depend iconvdata/Depend
nss/Depend localedata/Depend rt/Depend debug/Depend > /home/cq/下载/glibc-2.14/build/sysd-sorted-tmp

mawk: scripts/gen-sorted.awk: line 19: regular expression compile failed (bad class -- [], [^] or [)

/[^

mawk: scripts/gen-sorted.awk: line 19: syntax error at or near ]

mawk: scripts/gen-sorted.awk: line 19: runaway regular expression /, "", subd ...

make[1]: *** 没有规则可以创建“/home/cq/下载/glibc-2.14/build/abi-versions.h”需要的目标“/home/cq/下载/glibc-2.14/build/Versions.all”。 停止。

make[1]:正在离开目录 `/home/cq/下载/glibc-2.14'

make: *** [all] 错误 2

这是因为ubuntu使用的是mawk,安装上glibc需要的gawk即可:

$ sudo apt-get install gawk

2、

-build/math/s_isnanf.os

../sysdeps/i386/fpu/s_frexp.S: Assembler messages:

../sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"

../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'

../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'

../sysdeps/i386/fpu/s_frexp.S:66: Error: Missing symbol name in directive

../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'

../sysdeps/i386/fpu/s_frexp.S:66: Error: Missing symbol name in directive

../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.'

../sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'

../sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive

../sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if"

../sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression

make[2]: *** [/home/cq/下载/glibc-build/math/s_frexp.os] 错误 1

make[2]: *** 正在等待未完成的任务....

make[2]:正在离开目录 `/home/cq/下载/glibc-2.14/math'

make[1]: *** [math/subdir_lib] 错误 2

make[1]:正在离开目录 `/home/cq/下载/glibc-2.14'

make: *** [all] 错误 2

解决方法是:

1)、在glibc源码目录下找到文件:nptl/sysdeps/pthread/pt-initfini.c,找到第46行附近:asm("\n#include \"defs.h\"");在其后添加代码:

asm ("\n#if defined __i686 &&defined __ASSEMBLER__");

asm ("\n#undef __i686");

asm ("\n#define __i686 __i686");

asm ("\n#endif");

2)、在glibc源码目录下找到文件:sysdeps/unix/sysv/linux/i386/sysdep.h,找到第30行附近:#include<tls.h>,在其后添加代码:

#if defined __i686 && defined__ASSEMBLER__

#undef __i686

#define __i686 __i686

#endif

重新make

3、

-o /home/cq/下载/glibc-build/misc/err.o -MD -MP -MF /home/cq/下载/glibc-build/misc/err.o.dt -MT /home/cq/下载/glibc-build/misc/err.o

../misc/syslog.c:123:1: 对不起,尚未实现: 调用‘syslog’时内联失败:函数体不可用

../misc/syslog.c:155:9: 对不起,尚未实现: 从此处调用

make[2]: *** [/home/cq/下载/glibc-build/misc/syslog.o] 错误 1

make[2]: *** 正在等待未完成的任务....

make[2]:正在离开目录 `/home/cq/下载/glibc-2.14/misc',

make[1]: *** [misc/subdir_lib] 错误 2

make[1]:正在离开目录 `/home/cq/下载/glibc-2.14'

加入如下编译选项即可解决

export CFLAGS="-O2 -U_FORTIFY_SOURCE -march=i686 -mtune=native -fno-stack-protector"

4、

/home/cq/下载/glibc-build/elf/ldconfig: Can't open configuration file /home/cq/下载/glibc-build/etc/ld.so.conf: No such file or directory

make[1]: Leaving directory `/home/cq/下载/glibc-2.14'

root@ubuntu:/home/cq/下载/glibc-build#

解决办法:touch /etc/ld.so.conf


注:我的系统版本是ubuntu11.04, 内核是自己升级的3.4.4
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: