Bug 4219

Summary: can't complie microperl with error undefined reference to `__ctype_b'
Product: buildroot Reporter: 万新明 <xiaxiaojin>
Component: OtherAssignee: unassigned
Status: RESOLVED INVALID    
Severity: minor CC: buildroot, uclibc-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description 万新明 2011-09-21 09:19:49 UTC
I have a uclibc tool-chain.(0.9.30.3) and build it with buildroot .


root [ perl-5.14.0 ]# make -f Makefile.micro CC=i686-linux-gcc
i686-linux-ld -o microperl uav.o udeb.o udoio.o udoop.o udump.o uglobals.o ugv.o uhv.o umro.o umg.o uperlmain.o uop.o ureentr.o upad.o uperl.o uperlio.o uperly.o upp.o upp_ctl.o upp_hot.o upp_sys.o upp_pack.o upp_sort.o uregcomp.o uregexec.o urun.o uscope.o usv.o utaint.o utoke.o unumeric.o ulocale.o umathoms.o uuniversal.o uutf8.o uutil.o uperlapi.o ukeywords.o  -lm
i686-linux-ld: warning: cannot find entry symbol _start; defaulting to 08049720
upp.o: In function `Perl_pp_split':
pp.c:(.text+0x14294): undefined reference to `__ctype_b'
pp.c:(.text+0x1446b): undefined reference to `__ctype_b'
pp.c:(.text+0x14696): undefined reference to `__ctype_b'
uregexec.o: In function `S_find_byclass':
regexec.c:(.text+0x2983): undefined reference to `__ctype_b'
regexec.c:(.text+0x2a6a): undefined reference to `__ctype_b'
uregexec.o:regexec.c:(.text+0x2bb5): more undefined references to `__ctype_b' follow
make: *** [microperl] 错误 1


root [ perl-5.14.0 ]# i686-linux-gcc -v
使用内建 specs。
COLLECT_GCC=i686-linux-gcc
COLLECT_LTO_WRAPPER=/mnt/lfs/tmp/buildroot-2011.05/output/host/usr/libexec/gcc/i686-unknown-linux-uclibc/4.6.0/lto-wrapper
目标:i686-unknown-linux-uclibc
配置为:/mnt/lfs/tmp/buildroot-2011.05/output/toolchain/gcc-4.6.0/configure --prefix=/mnt/lfs/tmp/buildroot-2011.05/output/host/usr --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=i686-unknown-linux-uclibc --enable-languages=c,c++ --with-sysroot=/mnt/lfs/tmp/buildroot-2011.05/output/host/usr/i686-unknown-linux-uclibc/sysroot --with-build-time-tools=/mnt/lfs/tmp/buildroot-2011.05/output/host/usr/i686-unknown-linux-uclibc/bin --disable-__cxa_atexit --enable-target-optspace --disable-libgomp --with-gnu-ld --disable-libssp --disable-multilib --disable-tls --enable-shared --with-gmp=/mnt/lfs/tmp/buildroot-2011.05/output/host/usr --with-mpfr=/mnt/lfs/tmp/buildroot-2011.05/output/host/usr --with-mpc=/mnt/lfs/tmp/buildroot-2011.05/output/host/usr --enable-threads --disable-decimal-float --with-arch=i686 --with-tune=i686 --with-pkgversion='Buildroot 2011.05' --with-bugurl=http://bugs.buildroot.net/
线程模型:posix
gcc 版本 4.6.0 (Buildroot 2011.05)


root [ perl-5.14.0 ]# i686-linux-ld --version
GNU ld (GNU Binutils) 2.20.1.20100303
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
root [ perl-5.14.0 ]#
Comment 1 Bernhard Reutner-Fischer 2011-09-22 17:36:35 UTC
Buildroot issue.
Comment 2 Thomas Petazzoni 2011-09-22 18:44:49 UTC
I guess your uClibc lacks UCLIBC_HAS_CTYPE_TABLES, which is enabled in the default uClibc configuration that Buildroot uses to build a toolchain. Can you check your uClibc configuration ?
Comment 3 Mike Frysinger 2011-09-23 14:34:14 UTC
usually when this error comes up, it's because the cross-compile incorrectly used things like -I/usr/include.  please post the *full* build log of all the objects as an attachment.
Comment 4 万新明 2011-09-24 09:24:26 UTC
I checked uclibc.config contains UCLIBC_HAS_CTYPE_TABLES.
I tried many times, compiling microperl success, here is my compilation steps:
1. Chmod + w Makefile.micro

2 In line 39, as described below, the last uudmap.h bitcount.h removed.
        38 clean:
      39-rm-f $ (O) microperl generate_uudmap $ (_X)
      40 #-rm-f $ (O) microperl generate_uudmap $ (_X) uudmap.h bitcount.h

3. First in the x86 compiler normally generates two files uudmap.h bitcount.h
   root [perl-5.14.0] # make-f Makefile.micro

4 comments Dir 181,182 lines
     181 # uudmap.h bitcount.h: generate_uudmap $ (_X)
     182 # $ (RUN). / Generate_uudmap $ (_X) uudmap.h bitcount.h

5 Executive root [perl-5.14.0] # make-f Makefile.micro clean
    Then uudmap.h bitcount.h not delete the two files. uclibc compile perl will be used.

6 Finally compile uclibc microperl
   root [perl-5.14.0] # make-f Makefile.micro CC = i686-linux-gcc

Thank you for your help.