Linux MIPS Architecture development
 help / color / mirror / Atom feed
* I built a mipsel-linux toolchain, but it doesn't work
@ 2005-06-30  7:26 zhan rongkai
  2005-06-30 15:08 ` David Daney
  0 siblings, 1 reply; 7+ messages in thread
From: zhan rongkai @ 2005-06-30  7:26 UTC (permalink / raw)
  To: linux-mips

Hi folks,

At last night, I built a mipsel-linux cross-toolchain according to the
following steps:

1) The list of GNU Toolchain source packages
=======================================================

* binutils: binutils-2.16.1.tar.gz
*      gcc: gcc-3.4.4.tar.gz
*    Linux: Linux-2.6.12.tar.bz2 (from www.kernel.org)
*   uClibc: uClibc-0.9.27.tar.gz
*      gdb: gdb-6.3.tar.gz

2 build binutils
----------------------

	# mkdir /opt/src
	# cp ~/binutils-2.16.1.tar.bz2 /opt/src/
	# cd /opt/src
	# tar jxvf binutils-2.16.1.tar.bz2
	# mkdir build-binutils
	# cd build-binutils
	# ../binutils-2.16.1/configure --prefix=/opt/gnu-toolch/mipsel-linux-uclibc \
	                               --target=mipsel-linux
	# make all install
	# export PATH=/opt/gnu-toolch/mipsel-linux-uclibc/bin:$PATH

3 Build bootstrap GCC
-----------------------------

	# cp ~/gcc-3.4.4.tar.bz2 /opt/src
	# tar jxvf gcc-3.4.4.tar.bz2
	# mkdir /opt/src/build-gcc-core
	# cd build-gcc-core
	# ../gcc-3.4.4/configure --prefix=/opt/gnu-toolch/mipsel-linux-uclibc \
           --target=mipsel-linux --without-headers --enable-languages=c \
           --disable-shared --disable-threads
	# make all install

4 Build uClibc
--------------------

4.1 Prepare Linux Kernel Header files for uClibc
--------------------------------------------------------------

	# cp ~/linux-2.6.12.tar.bz2 /opt/src
	# cd /opt/src
	# tar jxvf linux-2.6.12.tar.bz2
	# cd /opt/src/linux-2.6.12
	# make xconfig
	# make prepare CROSS_COMPILE=mipsel-linux-

This will generate the header file version.h in the directory
'include/linux', and build the 'asm' symbol link correctly.

4.2 Build uClibc
-----------------------

	# cp ~/uClibc-0.9.27.tar.bz2 /opt/src
	# cd /opt/src
	# tar jxvf uClibc-0.9.27.tar.bz2
	# cd uClibc-0.9.27
	# make menuconfig
	# make CROSS=mipsel-linux-

4.3 Install uClibc
-----------------

	# make PREFIX=/opt/gnu-toolch/mipsel-linux-uclibc/mipsel-linux install

The run-time shared libraries, the static libraries and the header
files of uClibc will be installed into this directory tree:

$(PREFIX)
	|
	|-- /lib:     All uClibc shared and static libraries
	|-- /usr/bin: The ldd & readelf utilities
	|-- /sbin:    ldconfig utility
	|-- /include: All uClibc header files and linux kernel header file.

5 Build Full GCC (--enable-shared --enable-threads)
------------------------------------------------------------------

	# mkdir /opt/src/build-gcc
	# cd /opt/src/build-gcc
	# ../gcc-3.4.4/configure --prefix=/opt/gnu-toolch/mipsel-linux-uclibc \
		--target=mipsel-linux --enable-languages=c --enable-shared --enable-threads \
		--with-headers=/opt/gnu-toolch/mipsel-linux-uclibc/mipsel-linux/include
	# make all install

All the above steps are over successfully.

But when i use this toolchain to compile a simple helloworld.c
program, it fails!!! Here is the verbose information:

================================================================
# mipsel-linux-gcc --verbose -o hello-mipsel hello.c
Reading specs from
/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/specs
Configured with: ../gcc-3.4.4/configure
--prefix=/opt/gnu-toolch/mipsel-linux-uclibc --target=mipsel-linux
--enable-languages=c --enable-shared --enable-threads
--with-headers=/opt/gnu-toolch/mipsel-linux-uclibc/mipsel-linux/include
Thread model: posix
gcc version 3.4.4
 /opt/gnu-toolch/mipsel-linux-uclibc/libexec/gcc/mipsel-linux/3.4.4/cc1
-quiet -v hello.c -quiet -dumpbase hello.c -auxbase hello -version -o
/tmp/ccXd4elJ.s
#include "..." search starts here:
#include <...> search starts here:
 /opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/include
 /opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/../../../../mipsel-linux/sys-include
/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/../../../../mipsel-linux/include
End of search list.
GNU C version 3.4.4 (mipsel-linux)
        compiled by GNU C version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129381
 /opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/../../../../mipsel-linux/bin/as
-EL -no-mdebug -32 -v -KPIC -o /tmp/ccoMRDJC.o /tmp/ccXd4elJ.s
GNU assembler version 2.16.1 (mipsel-linux) using BFD version 2.16.1
 /opt/gnu-toolch/mipsel-linux-uclibc/libexec/gcc/mipsel-linux/3.4.4/collect2
--eh-frame-hdr -EL -dynamic-linker /lib/ld.so.1 -o hello-mipsel
/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/../../../../mipsel-linux/lib/crt1.o
/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/../../../../mipsel-linux/lib/crti.o
/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/crtbegin.o
-L/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4
-L/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/../../../../mipsel-linux/lib
/tmp/ccoMRDJC.o -lgcc --as-needed -lgcc_s --no-as-needed -rpath-link
/lib:/usr/lib -lc -lgcc --as-needed -lgcc_s --no-as-needed
/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/crtend.o
/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/../../../../mipsel-linux/lib/crtn.o
/opt/gnu-toolch/mipsel-linux-uclibc/lib/gcc/mipsel-linux/3.4.4/../../../../mipsel-linux/lib/libgcc_s.so:
undefined reference to `dl_iterate_phdr'
collect2: ld returned 1 exit status
================================================================

It is that $(prefix)/mipsel-linux/lib/libgcc_s.so references the
symbol 'dl_iterate_phdr', which is defined in the uClibc libdl.a:

[zhanrk@zhanrk lib]$ mipsel-linux-nm libgcc_s.so.1 | grep -e 'dl_iterate_phdr'
         U dl_iterate_phdr
[zhanrk@zhanrk lib]$ mipsel-linux-nm -v libdl.a | grep -e 'dl_iterate_phdr'
00002780 T __dl_iterate_phdr
00002780 T dl_iterate_phdr

I don't know how to resolve this problem, someone can tell me what
should i do? Thanks in advance

--
Best Regard, 
Rongkai Zhan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: I built a mipsel-linux toolchain, but it doesn't work
  2005-06-30  7:26 I built a mipsel-linux toolchain, but it doesn't work zhan rongkai
@ 2005-06-30 15:08 ` David Daney
  0 siblings, 0 replies; 7+ messages in thread
From: David Daney @ 2005-06-30 15:08 UTC (permalink / raw)
  To: zhan rongkai; +Cc: linux-mips

zhan rongkai wrote:
> Hi folks,
> 
> At last night, I built a mipsel-linux cross-toolchain according to the
> following steps:
> 
> 1) The list of GNU Toolchain source packages
> =======================================================
> 
> * binutils: binutils-2.16.1.tar.gz
> *      gcc: gcc-3.4.4.tar.gz
> *    Linux: Linux-2.6.12.tar.bz2 (from www.kernel.org)
> *   uClibc: uClibc-0.9.27.tar.gz
> *      gdb: gdb-6.3.tar.gz
> 

IIRC gcc does not currently work out-of-the-box with uClibc.  If you are 
using uClibc, your best bet is probably to use the Buildroot system that 
can be found at the uClibc web site.

If you are building mips kernels, it is probably a better bet to get the 
source from linux-mips.org rather than kernel.org.  Because all fixes 
for mips related things show up in linux-mips.org first.

David Daney

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: I built a mipsel-linux toolchain, but it doesn't work
@ 2005-07-01  8:00 moreau francis
  2005-07-01 15:47 ` David Daney
  0 siblings, 1 reply; 7+ messages in thread
From: moreau francis @ 2005-07-01  8:00 UTC (permalink / raw)
  To: David Daney; +Cc: zhan rongkai, linux-mips

David Daney wrote:

> zhan rongkai wrote:
>
>> Hi folks,
>>
>> At last night, I built a mipsel-linux cross-toolchain according to the
>> following steps:
>>
>> 1) The list of GNU Toolchain source packages
>> =======================================================
>>
>> * binutils: binutils-2.16.1.tar.gz
>> *      gcc: gcc-3.4.4.tar.gz
>> *    Linux: Linux-2.6.12.tar.bz2 (from www.kernel.org)
>> *   uClibc: uClibc-0.9.27.tar.gz
>> *      gdb: gdb-6.3.tar.gz
>>
>
> IIRC gcc does not currently work out-of-the-box with uClibc.  If you are
> using uClibc, your best bet is probably to use the Buildroot system that 
> can be found at the uClibc web site.
>

Could you develop please ? What kind of config/hack does Buildroot to be able
to use GCC with uClibc ?

thanks

              Francis


	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: I built a mipsel-linux toolchain, but it doesn't work
  2005-07-01 15:47 ` David Daney
@ 2005-07-01 15:00   ` sjhill
  0 siblings, 0 replies; 7+ messages in thread
From: sjhill @ 2005-07-01 15:00 UTC (permalink / raw)
  To: David Daney; +Cc: moreau francis, zhan rongkai, linux-mips

> moreau francis wrote:
> > Could you develop please ? What kind of config/hack does Buildroot to be able
> > to use GCC with uClibc ?
> > 
> 
> It is quite complicated, but you can find a summary on this web page:
> 
> http://www.google.com/search?q=uclibc+buildroot
> 
Here is the page for it:

   http://buildroot.uclibc.org/

The mipsel target is supported and will build for your needs. Do not
use uClibc-0.9.27 when you configure your buildroot system. Use the
latest uClibc snapshot. There are issues with uClibc-0.9.27 with MIPS
targets.

-Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: I built a mipsel-linux toolchain, but it doesn't work
  2005-07-01  8:00 moreau francis
@ 2005-07-01 15:47 ` David Daney
  2005-07-01 15:00   ` sjhill
  0 siblings, 1 reply; 7+ messages in thread
From: David Daney @ 2005-07-01 15:47 UTC (permalink / raw)
  To: moreau francis; +Cc: zhan rongkai, linux-mips

moreau francis wrote:
> Could you develop please ? What kind of config/hack does Buildroot to be able
> to use GCC with uClibc ?
> 

It is quite complicated, but you can find a summary on this web page:

http://www.google.com/search?q=uclibc+buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: I built a mipsel-linux toolchain, but it doesn't work
@ 2005-07-02  8:40 Singh, Ajay
  2005-07-02  8:40 ` Singh, Ajay
  0 siblings, 1 reply; 7+ messages in thread
From: Singh, Ajay @ 2005-07-02  8:40 UTC (permalink / raw)
  To: sjhill, David Daney; +Cc: moreau francis, zhan rongkai, linux-mips

We are using uClibc-0.9.27 for MIPS target. Can you point out the issues
with uClibc-0.9.27 ??

~Ajay.

-----Original Message-----
From: linux-mips-bounce@linux-mips.org
[mailto:linux-mips-bounce@linux-mips.org] On Behalf Of
sjhill@realitydiluted.com
Sent: Friday, July 01, 2005 8:30 PM
To: David Daney
Cc: moreau francis; zhan rongkai; linux-mips@linux-mips.org
Subject: Re: I built a mipsel-linux toolchain, but it doesn't work

> moreau francis wrote:
> > Could you develop please ? What kind of config/hack does Buildroot 
> > to be able to use GCC with uClibc ?
> > 
> 
> It is quite complicated, but you can find a summary on this web page:
> 
> http://www.google.com/search?q=uclibc+buildroot
> 
Here is the page for it:

   http://buildroot.uclibc.org/

The mipsel target is supported and will build for your needs. Do not use
uClibc-0.9.27 when you configure your buildroot system. Use the latest
uClibc snapshot. There are issues with uClibc-0.9.27 with MIPS targets.

-Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: I built a mipsel-linux toolchain, but it doesn't work
  2005-07-02  8:40 Singh, Ajay
@ 2005-07-02  8:40 ` Singh, Ajay
  0 siblings, 0 replies; 7+ messages in thread
From: Singh, Ajay @ 2005-07-02  8:40 UTC (permalink / raw)
  To: sjhill, David Daney; +Cc: moreau francis, zhan rongkai, linux-mips

We are using uClibc-0.9.27 for MIPS target. Can you point out the issues
with uClibc-0.9.27 ??

~Ajay.

-----Original Message-----
From: linux-mips-bounce@linux-mips.org
[mailto:linux-mips-bounce@linux-mips.org] On Behalf Of
sjhill@realitydiluted.com
Sent: Friday, July 01, 2005 8:30 PM
To: David Daney
Cc: moreau francis; zhan rongkai; linux-mips@linux-mips.org
Subject: Re: I built a mipsel-linux toolchain, but it doesn't work

> moreau francis wrote:
> > Could you develop please ? What kind of config/hack does Buildroot 
> > to be able to use GCC with uClibc ?
> > 
> 
> It is quite complicated, but you can find a summary on this web page:
> 
> http://www.google.com/search?q=uclibc+buildroot
> 
Here is the page for it:

   http://buildroot.uclibc.org/

The mipsel target is supported and will build for your needs. Do not use
uClibc-0.9.27 when you configure your buildroot system. Use the latest
uClibc snapshot. There are issues with uClibc-0.9.27 with MIPS targets.

-Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-02  8:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-30  7:26 I built a mipsel-linux toolchain, but it doesn't work zhan rongkai
2005-06-30 15:08 ` David Daney
  -- strict thread matches above, loose matches on Subject: below --
2005-07-01  8:00 moreau francis
2005-07-01 15:47 ` David Daney
2005-07-01 15:00   ` sjhill
2005-07-02  8:40 Singh, Ajay
2005-07-02  8:40 ` Singh, Ajay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox