[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RH 9 & glibc 2.2: Undefined reference to `__ctype_b'

From: Paul Pluzhnikov
Subject: Re: RH 9 & glibc 2.2: Undefined reference to `__ctype_b'
Date: Thu, 07 Jul 2005 16:44:27 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"jgowland@genacapwarecom" <> writes:

> I have a static library from a third party which I need to use in an
> application, and I need to build it on a system running Red Hat 9.  It
> links fine on older versions of Red Hat (e.g. 7.3), but when I try to
> link it on RH 9, I get:
>     undefined reference to `__ctype_b'
> Is there any way I can tell ld that I want the LIBC_2.0 version of the
> symbol even if it isn't the latest version?

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/ | 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);


  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-.../ 
/usr/lib/libc_nonshared.a )" >
   gcc -o MyExe ... -L.  # (will use ./

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

In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]