[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: compiling busybox-1.6.1 for cris architecture fails
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2007-08-31 12:45:38
Message-ID: 200708311345.39236.vda.linux () googlemail ! com
[Download RAW message or body]

On Friday 31 August 2007 13:06, hinko.kocevar@cetrtapot.si wrote:
> Denys Vlasenko wrote:
> > On Friday 31 August 2007 08:36, hinko.kocevar@cetrtapot.si wrote:
> >> Denys Vlasenko wrote:
> >>> On Thursday 30 August 2007 14:02, hinko.kocevar@cetrtapot.si wrote:
> >>>> Hi,
> >>>>
> >>>> We are using rather old version of busybox (1.1.2) on our embedded
> >>>> systems and would like to upgrade to the latest stable version -
> >>>> 1.6.1. The applets seem to compile just fine, but linking fails to
> >>>> produce busybox_unstripped. We are using uClibc.
> >>>>
> >>>> Complete build (with make V=1) is located at:
> >>>>
> >>>> http://4thway.0catch.com/busybox-error_3.txt
> >>>
> >>> Strange, I don't see error message.
> >>>
> >>> Do you have busybox_ld.err file? It may contain error message.
> >>
> >> Yes. I have uploaded it to the
> >> http://4thway.0catch.com/busybox_ld.err
> >>
> >>> Can you remove "-Wl,-M" from Makefile and rerun the command?
> >>
> >> I've rebuild without the "-Wl,-M" and the result seems the same but the
> >> busybox_ld.err is smaller. See
> >> http://4thway.0catch.com/busybox_ld.err_nowlm
> >
> > This is fixed in 1.7.0. Link map is saved into separate file,
> > making error message much easer to find. Sorry.
> >
> > Does it make sense to you to jump to 1.7.0, since you
> > have to jump anyway?
>
> I'll try it out. I guess it is not that of a problem, just that it is
> labeled unstable and I hesitate to break something else by introducing
> untested code in the production systems [like it is not enough that our
> own untested stuff makes it there :-/]...
>
> >> It is something about the glibc _start symbol?!
> >
> > uclibc.
> >
> > applets/built-in.o: In function `__negdi2':
> > /usr/src/redhat/BUILD/cris-dist-1.62/gnu-toplev/gcc/libgcc2.c:52:
> > multiple definition of `_start'
> > /fw/car2_R1.gen/stage.uclibc/lib/crt0.o(.text+0x0): first defined here
> > applets/built-in.o: In function `__negdi2':
> > /usr/src/redhat/BUILD/cris-dist-1.62/gnu-toplev/gcc/libgcc2.c:52:
> > multiple definition of `__mainp'
> > /fw/car2_R1.gen/stage.uclibc/lib/crt0.o(.data.rel+0x0): first defined
> > here applets/built-in.o: In function `__negdi2':
> > /usr/src/redhat/BUILD/cris-dist-1.62/gnu-toplev/gcc/libgcc2.c:52:
> > multiple definition of `__data_start'
> > /fw/car2_R1.gen/stage.uclibc/lib/crt0.o(.data+0x0): first defined here
> > collect2: ld returned 1 exit status
> >
> > Something is messed up in the toolchain.
> >
> > Does libgcc2.c in gcc you use really define _start? Why?
>
> Can't tell since the path points to non-existent source file on my
> system - it is pre-built toolchain that Axis supplies (makers of the
> cris CPU). Would have to download the toolchain source and check (maybe
> later).
>
> > Can you successfully cross-compile "Hello world"?
>
> Sure, it even runs:).
>
> hinkok@genovefa /tmp $ cat hello.c
> #include <stdio.h>
>
> int main (void)
> {
> 	printf("Hello world..\n");
> 	return 0;
> }
>
> hinkok@genovefa /tmp $ gcc_cris -mlinux -DLINUX -DLINUX_SYSTEM
> -D_REENTRANT -mno-mul-bug-workaround
> -muclibc=/fw/car2_R1.gen/stage.uclibc/ hello.c
> hinkok@genovefa /tmp $ scp a.out root@10.0.0.200:/tmp
> root@10.0.0.200's password:
> a.out                                         100% 2228     2.2KB/s
> 00:00
> hinkok@genovefa /tmp $ ssh root@10.0.0.200 /tmp/a.out
> root@10.0.0.200's password:
> Hello world..
>
>
> Let me just say that I had no problems while compiling (ancient)
> busybox-1.1.2 source. I would bet my money in the linker options - but
> which?!

According to your logs trylink script is started with:

/home/hinkok/delo/fw/car2_R1.gen/pkg/busybox-R2/build/uclibc/static/scripts/trylink 
gcc_cris -mlinux -DLINUX -DLINUX_SYSTEM -D_REENTRANT
-mno-mul-bug-workaround -muclibc=/fw/car2_R1.gen/stage.uclibc
-L/fw/car2_R1.gen/stage.uclibc/lib
-Wl,-rpath-link,/fw/car2_R1.gen/stage.uclibc/lib
-o busybox_unstripped
-Wl,-M
-Wl,--warn-common -Wl,--sort-common -Wl,--start-group
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  login
utils/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

Nothing especially interesting.

You may go into trylink and set debug=true, you will make
trylink report commands it tries to run.

Do gcc -v hello_world.c and compare linker flags used for it and for bbox.

And btw, note that gcc commands which compile .c files into .o contains
-static-libgcc - maybe this is the problem?

Makefile.flags
==============
CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
                                           ^^^^^^^^^^^^^^
--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic