ctype.h problem ?

Guillaume Dargaud dargaud at lpsc.in2p3.fr
Fri Mar 21 10:40:11 UTC 2008


Hello all,
I'm trying to compile busybox for the first time as part of buildroot, for a 
ppc405 architecture.

I have a problem I've seen in the archive but without finding a solution.

During the compilation, there are a few warnings:
/usr/bin/make -j1 
CC=/home/guinevere/buildroot/build_ppc/staging_dir/usr/bin/ppc-linux-uclibc-gcc 
CROSS_COMPILE="/home/guinevere/buildroot/build_ppc/staging_dir/usr/bin/ppc-linux-uclibc-" 
\
        CROSS="/home/guinevere/buildroot/build_ppc/staging_dir/usr/bin/ppc-linux-uclibc-" 
PREFIX="/home/guinevere/buildroot/project_build_ppc/genepy/root" \
        ARCH=powerpc \
        EXTRA_CFLAGS="-O2  -I/home/guinevere/buildroot/build_ppc/staging_dir/usr/include 
 -I/home/guinevere/buildroot/build_ppc/staging_dir/include --sysroot=/home/guinevere/buildroot/build_ppc/staging_dir/ 
 -isysroot 
/home/guinevere/buildroot/build_ppc/staging_dir -mtune=405 -msoft-float" -C 
/home/guinevere/buildroot/project_build_ppc/genepy/busybox-1.9.1


[...]
  CC      coreutils/printf.o
coreutils/printf.c: In function 'conv_strtod':
coreutils/printf.c:72: warning: implicit declaration of function 'strtod'
  CC      coreutils/pwd.o
  CC      coreutils/readlink.o
  CC      coreutils/realpath.o
  CC      coreutils/rm.o
  CC      coreutils/rmdir.o
  CC      coreutils/seq.o
coreutils/seq.c: In function 'seq_main':
coreutils/seq.c:23: warning: implicit declaration of function 'atof'
  CC      coreutils/sleep.o
  CC      coreutils/sort.o
coreutils/sort.c: In function 'compare_keys':
coreutils/sort.c:195: warning: implicit declaration of function 'strtod'
coreutils/sort.c:237: warning: implicit declaration of function 'atof'
[...]

And then the ball drops at linking stage:
  AR      util-linux/lib.a
  LINK    busybox_unstripped
Trying libraries: crypt m
Failed: busybox_unstripped 
/home/guinevere/buildroot/build_ppc/staging_dir/usr/bin/ppc-linux-uclibc-gcc 
applets/built-in.o  archival/lib.a  archival/libunarchive/lib.a 
console-tools/lib.a  coreutils/lib.a  coreutils/libcoreutils/lib.a 
debianutils/lib.a  e2fsprogs/lib.a  editors/lib.a  findutils/lib.a 
init/lib.a  ipsvd/lib.a  libbb/lib.a  libpwdgrp/lib.a  loginutils/lib.a 
miscutils/lib.a  modutils/lib.a  networking/lib.a 
networking/libiproute/lib.a  networking/udhcp/lib.a  procps/lib.a 
runit/lib.a  selinux/lib.a  shell/lib.a  sysklogd/lib.a  util-linux/lib.a 
archival/built-in.o  archival/libunarchive/built-in.o 
console-tools/built-in.o  coreutils/built-in.o 
coreutils/libcoreutils/built-in.o  debianutils/built-in.o 
e2fsprogs/built-in.o  editors/built-in.o  findutils/built-in.o 
init/built-in.o  ipsvd/built-in.o  libbb/built-in.o  libpwdgrp/built-in.o 
loginutils/built-in.o  miscutils/built-in.o  modutils/built-in.o 
networking/built-in.o  networking/libiproute/built-in.o 
networking/udhcp/built-in.o  procps/built-in.o  runit/built-in.o 
selinux/built-in.o  shell/built-in.o  sysklogd/built-in.o 
util-linux/built-in.o  m crypt -Wl,--start-group -lcrypt -lm -Wl,--end-group
Output of:
/home/guinevere/buildroot/build_ppc/staging_dir/usr/bin/ppc-linux-uclibc-gcc 
 -o 
busybox_unstripped -Wl,--sort-common -Wl,--sort-section -Wl,alignment -Wl,--gc-sections 
 -Wl,--start-group applets/built-in.o 
archival/lib.aarchival/libunarchive/lib.a console-tools/lib.a 
coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a 
e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a ipsvd/lib.a 
libbb/lib.a libpwdgrp/lib.a loginutils/lib.a miscutils/lib.a modutils/lib.a 
networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a 
procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a 
util-linux/lib.a archival/built-in.o archival/libunarchive/built-in.o 
console-tools/built-in.o coreutils/built-in.o 
coreutils/libcoreutils/built-in.o debianutils/built-in.o 
e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o 
ipsvd/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o 
miscutils/built-in.o modutils/built-in.o networking/built-in.o 
networking/libiproute/built-in.o networking/udhcp/built-in.o 
procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o 
sysklogd/built-in.o 
util-linux/built-in.o -Wl,--end-group -Wl,--start-group -lcrypt -lm -Wl,--end-group
==========
networking/lib.a(ifupdown.o): In function `setlocalenv':
ifupdown.c:(.text.setlocalenv+0x8e): undefined reference to 
`__ctype_toupper'
ifupdown.c:(.text.setlocalenv+0xae): undefined reference to 
`__ctype_toupper'
networking/lib.a(ipcalc.o): In function `ipcalc_main':
ipcalc.c:(.text.ipcalc_main+0x2b6): undefined reference to `__ctype_tolower'
ipcalc.c:(.text.ipcalc_main+0x2ba): undefined reference to `__ctype_tolower'
networking/lib.a(wget.o): In function `gethdr':
wget.c:(.text.gethdr+0x8e): undefined reference to `__ctype_tolower'
wget.c:(.text.gethdr+0xa2): undefined reference to `__ctype_tolower'
util-linux/lib.a(fdisk.o): In function `fdisk_main':
fdisk.c:(.text.fdisk_main+0x26a): undefined reference to `__ctype_tolower'
util-linux/lib.a(fdisk.o):fdisk.c:(.text.fdisk_main+0x2a2): more undefined 
references to `__ctype_tolower' follow
util-linux/lib.a(mount.o): In function `xdr_fhstatus':
mount.c:(.text.xdr_fhstatus+0x1c): undefined reference to `xdr_u_int'
mount.c:(.text.xdr_fhstatus+0x60): undefined reference to `xdr_opaque'
util-linux/lib.a(mount.o): In function `xdr_mountres3':
mount.c:(.text.xdr_mountres3+0x1c): undefined reference to `xdr_enum'
mount.c:(.text.xdr_mountres3+0x60): undefined reference to `xdr_bytes'
mount.c:(.text.xdr_mountres3+0x6e): undefined reference to `xdr_int'
mount.c:(.text.xdr_mountres3+0x7a): undefined reference to `xdr_int'
mount.c:(.text.xdr_mountres3+0x88): undefined reference to `xdr_array'
util-linux/lib.a(mount.o): In function `xdr_dirpath':
mount.c:(.text.xdr_dirpath+0x10): undefined reference to `xdr_string'
util-linux/lib.a(mount.o): In function `singlemount':
mount.c:(.text.singlemount+0xb04): undefined reference to `pmap_getmaps'
mount.c:(.text.singlemount+0xbe0): undefined reference to `clnttcp_create'
mount.c:(.text.singlemount+0xbf0): undefined reference to 
`authunix_create_default'
mount.c:(.text.singlemount+0x1080): undefined reference to `clntudp_create'
mount.c:(.text.singlemount+0x10bc): undefined reference to 
`clnt_spcreateerror'
mount.c:(.text.singlemount+0x1214): undefined reference to `clnt_sperror'
mount.c:(.text.singlemount+0x123c): undefined reference to `clnt_sperror'
mount.c:(.text.singlemount+0x1398): undefined reference to `bindresvport'
mount.c:(.text.singlemount+0x14b0): undefined reference to `pmap_getport'
coreutils/lib.a(sort.o): In function `get_key':
sort.c:(.text.get_key+0x30e): undefined reference to `__ctype_toupper'
sort.c:(.text.get_key+0x312): undefined reference to `__ctype_toupper'
editors/lib.a(vi.o): In function `get_one_address':
vi.c:(.text.get_one_address+0x8a): undefined reference to `__ctype_tolower'
vi.c:(.text.get_one_address+0x92): undefined reference to `__ctype_tolower'
editors/lib.a(vi.o): In function `do_cmd':
vi.c:(.text.do_cmd+0x35e): undefined reference to `__ctype_toupper'
vi.c:(.text.do_cmd+0x362): undefined reference to `__ctype_toupper'
vi.c:(.text.do_cmd+0xa0e): undefined reference to `__ctype_tolower'
vi.c:(.text.do_cmd+0xa12): undefined reference to `__ctype_tolower'
vi.c:(.text.do_cmd+0xe06): undefined reference to `__ctype_tolower'
vi.c:(.text.do_cmd+0xe0a): undefined reference to `__ctype_tolower'
vi.c:(.text.do_cmd+0xfa2): undefined reference to `__ctype_tolower'
editors/lib.a(vi.o):vi.c:(.text.do_cmd+0xfa6): more undefined references to 
`__ctype_tolower' follow
collect2: ld returned 1 exit status
make[1]: *** [busybox_unstripped] Error 1
make[1]: Leaving directory 
`/home/guinevere/buildroot/project_build_ppc/genepy/busybox-1.9.1'
make: *** 
[/home/guinevere/buildroot/project_build_ppc/genepy/busybox-1.9.1/busybox] 
Error 2

So basically it appears to be a problem with ctype.h...
There's something about it here: 
http://lists.debian.org/debian-arm/2005/02/msg00027.html
But it's from 3 years ago, so I'd be surprised if there wasn't a simpler way 
to fix it.
I've tried adding various LOCALE or WCHAR options, but it does not appear to 
make a difference.

Thank you for any insight.
-- 
Guillaume Dargaud
http://www.gdargaud.net/
  "I have a hunch that the unknown sequences of DNA will decode into 
copyright notices and patent protections."    - Donald E. Knuth. 





More information about the busybox mailing list