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

undefined reference to `__ctype_b' (fwd)



------- Forwarded Message

Date:    Mon, 21 Jul 2003 15:49:33 -0600
From:    Russ Rew <address@hidden>
To:      "Bryan G. White" <address@hidden>
Subject: undefined reference to `__ctype_b'

Bryan,

In reference to the message below, we finally tested our current
netCDF-beta release on RedHat 9.0 and can report that it appears to
work OK, not getting the problem you reported below.  Specifically,
with netCDF 3.5.1-beta release, available from

  ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-beta.tar.Z

building and testing on RedHat 9.0 with the following environment
variable settings:

 CPPFLAGS=-Df2cFortran
 FFLAGS=-Wno-globals

worked fine, except that we have no Fortran90 compiler for that
platform, so it didn't build the Fortran90 interface.

Just setting the above two environment variables and running

 configure
 make all test

the compilation, linking, and all the tests ran through with no
errors.

--Russ


On June 19, I wrote:

>To: address@hidden
>From: "Bryan G. White" <address@hidden>
>Subject: undefined reference to `__ctype_b'
>Organization: UCAR/Unidata
>Keywords: 200306182219.h5IMJ2Ld004225

Hi Bryan,

> Found this in the email archives:
> 
> >> 
> >> /nfs/user22/netcdf-3.5.0/src/libsrc/libnetcdf.a(string.o)(.text+0x37): In 
> >> function
> >> `NC_check_name':
> >> : undefined reference to `__ctype_b'
> >> collect2: ld returned 1 exit status
> >> 
> >> Any idea how to fix this? 
> >
> >The reference to `__ctype_b' should be satisfied by the C runtime
> >library.  Either your linker isn't referencing the C runtime library, or
> >the necessary definition is missing from the C runtime library that the
> >linker is using.  This latter case could be becaue the compiler that was
> >used to compile the netCDF file "string.c" assumed a differenct C runtime
> >library than the one actually used by your linker.
> 
> The problem is related to glibc.  Anything on redhat9 with a glibc >=
> glibc-2.3.2-11.9 is causing the problems.  Actually, any stock glibc
> from atleast 2.3.0 and on is causing problems.
> 
> glibc is no longer exporting ctype_b.
> The compat_symbol lines were removed from ctype/ctype-info.c in the
> newer glibc libraries.  RedHat8 kept the lines in ctype-info.c
> to support old static libraries.
> 
> The offending line of code in netcdf is in libsrc/string.c.
> The line is:  
>    if(!isalnum(ch))
> 
> isalnum is found in /usr/include/ctype.h.  ctype.h does have
> reference to ctype_b.
> Sorry, I'm not much of a C programmer and I can't follow what's
> going on.
> 
> My temporary solution is to compile netcdf on a RedHat 8 system
> and transfer it over to RedHat 9.

Thanks for letting us know about this.  We haven't upgraded any of our
RedHat platforms to RedHat 9 yet, so hadn't seen this, but I think our
RedHat 8 may have glibc-2.3.2.  Since isalnum() is required by ANSI C
(ANSI C3.159-1989), I think any ANSI-compliant C development
environment must support it.  Maybe the problem is that the argument
to the isalnum() macro is supposed to be representable as an unsigned
char.  We'll check if we can duplicate the problem on RedHat 8 with
glibc-2.3.2 and see if the code works when an (unsigned char) cast is
inserted, as in:

    if(!isalnum((unsigned char)ch))

--Russ


------- End of Forwarded Message