QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1223|回复: 1

如何使glibc2.3.x支持__ctype_b

[复制链接]
发表于 2005-11-30 10:04:02 | 显示全部楼层 |阅读模式
大家好,请教一个问题。
编译的时候出现如下错误的提示
/usr/local/streamer/streamerapi/c_api/Test/libjpo10_x86.a(po1012.o)(.text+0x96: In function `DateNumCheck':
: undefined reference to `__ctype_b'
/usr/local/streamer/streamerapi/c_api/Test/libjpo10_x86.a(p0ostring.o)(.text+0x75): In function `sp0_Upper_str':
: undefined reference to `__ctype_toupper'
上网查找了一下,发现从glibc2.3.x的版本后,__ctype_b, __ctype_toupper的属性都变成隐藏的了。也就是说glibc2.3.x的版本默认已经不支持这2个类型了,但是听说glibc的版本是向下兼容的(不好意思,我是linux编程新手),所以希望遇有知道的朋友告诉一下。
我这边也会努力的,如果解决了,会把解决方法放出来和大家共享。
 楼主| 发表于 2005-12-1 09:57:29 | 显示全部楼层
找到了解决的方法,但是还没有尝试。现在正在安装redhat 9,如果解决了,再给出具体操作。
这是找到的解决办法,英文的,大家参考一下吧。
The GLIBC_2.0 *is* the latest (and the only) version of that symbol.
The problem is that this symbol is hidden:
  $ objdump -T /lib/tls/libc.so.6 | grep __ctype_b
  00021c80 g    DF .text  00000072  GLIBC_2.3   __ctype_b_loc
  00119538 g    DO .data  00000004 (GLIBC_2.0)  __ctype_b

The parenthesis around GLIBC_2.0 mean the symbol is hidden, and
can only be used by runtime loader, but not by the linker.

There are multiple ways to achieve that. The simplest is to rebuild
RH-9 glibc from SRPM. Once you've built it (don't install, just
do "rpmbuild -bc glibc.spec"), edit locale/lc-ctype.c, replace:

  compat_symbol (libc, __ctype_b, __ctype_b, GLIBC_2_0);

with:

  versioned_symbol (libc, __ctype_b, __ctype_b, GLIBC_2_0);

and rebuild it again. The change above should "un-hide" __ctype_b
(the parenthesis around GLIBC_2.0 should disappear).

Now you should be able to relink your exe:

   echo "GROUP (/usr/src/redhat/BUILD/glibc-.../libc.so.6 /usr/lib/libc_nonshared.a )" > libc.so
   gcc -o MyExe ... -L.  # (will use ./libc.so)

The resulting MyExe will work with the libc.so.6 already installed,
since __ctype_b in it is available for runtime loader.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-3 02:31 , Processed in 0.150429 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表