Skip to contentSkip to conversation

gcc 3.0 / glibc 2.2.3 cross-toolchain

DISCUSSION Bradley D. LaRonde 4 participants 7 messages Aug 8, 2001 – Aug 9, 2001 MIPS

lore
Share & tools
lore
#0 lore raw

I have spent quite a bit of time trying to get a gcc 3.0 / glibc 2.2.3 cross-toolchain working. I am not a Toolchain Builder, but I really wanted to try this combo and I don't see any way around building it myself.

I've had some success. Everything seems to build fine. However, when I try to run a simple "hello world" dynamically linked with glibc, I get this:

<myprogram>: error while loading shared libraries: failed to map segment from shared object: cannot load shared object file: Invalid
argument

I think it is trying to load libc.so.6, which is in my root in /lib/, symlinked to libc-2.2.3.so, and so is ld.so.1, symlinked to ld-2.2.3.so.

I feel like I am pretty close, but I am starting to get discouraged and could really use some help. I really am clueless about what should/shouldn't work. I'm trying to do this based on bits and pieces of information that I've collected from countless sources. I have heard that gcc 3.0 isn't really "working", but I still want to try.

Here is what I've used:

* binutils-2.11.90.0.25.tar.gz (extracted from H. J. Lu's srpm on oss.sgi.com; I've tried others also)
* gcc-3.0.tar.gz (released version - no patches)
* glibc-linuxthreads-2.2.3.tar.gz (released version - no patches; glibc didn't want to configure without this)
* glibc-2.2.3.tar.gz (released version)

plus a tiny patch to glibc that looks like:

--- libc-04052001/sysdeps/mips/mipsel/rtld-parms Sat Jul 12 18:26:15 1997 +++ libc-04052001-patched/sysdeps/mips/mipsel/rtld-parms Fri Apr 6 09:23:27 2001
@@ -1,3 +1,3 @@
ifndef rtld-oformat
-rtld-oformat = elf32-littlemips
+rtld-oformat = elf32-tradlittlemips
endif

I built everything on my i386 Debian 2.2 box as follows:

Build the mipsel cross-binutils

tar -xzf binutils-2.11.90.0.25.tar.gz
mkdir mipsel-binutils
cd mipsel-binutils

  ../binutils-2.11.2/configure --target=mipsel-linux \
    --libdir='${exec_prefix}'/mipsel-linux/i386-linux/lib

make
make install
cd ..

Build the mipsel cross-gcc:

tar -xzf gcc-3.0.tar.gz
mkdir mipsel-gcc
cd mipsel-gcc

  ../gcc-3.0/configure --target=mipsel-linux \
     --enable-languages=c --disable-shared

make
make install
cd ..

Install the kernel headers

mkdir /usr/local/mipsel-linux/include
cp -r $LINUX_SRC/include/linux /usr/local/mipsel-linux/include cp -r $LINUX_SRC/include/asm-mips /usr/local/mipsel-linux/include/asm

Build glibc:

tar -xzf glibc-2.2.3
cd glibc-2.2.3
patch -p1 -i../elf32-tradlittlemips.diff
tar -xzf ../glibc-linuxthreads-2.2.3.tar.gz
cd ..
mkdir mipsel-glibc
cd mipsel-glibc

  ../glibc-2.2.3/configure --build=i686-linux --host=mipsel-linux \
    --enable-add-ons --prefix=/usr/local/mipsel-linux

make
make install
cd ..

Thanks.

Regards,
Brad

#1 lore raw
Quoted 20 lines · Bradley D. LaRonde

I have spent quite a bit of time trying to get a gcc 3.0 / glibc 2.2.3 cross-toolchain working. I am not a Toolchain Builder, but I really wanted to try this combo and I don't see any way around building it myself.

I've had some success. Everything seems to build fine. However, when I try to run a simple "hello world" dynamically linked with glibc, I get this:

<myprogram>: error while loading shared libraries: failed to map segment from shared object: cannot load shared object file: Invalid
argument

I think it is trying to load libc.so.6, which is in my root in /lib/, symlinked to libc-2.2.3.so, and so is ld.so.1, symlinked to ld-2.2.3.so.

I feel like I am pretty close, but I am starting to get discouraged and could really use some help. I really am clueless about what should/shouldn't work. I'm trying to do this based on bits and pieces of information that I've collected from countless sources. I have heard that gcc 3.0 isn't really "working", but I still want to try.

Quoted 8 lines

Here is what I've used:

* binutils-2.11.90.0.25.tar.gz (extracted from H. J. Lu's srpm on oss.sgi.com; I've tried others also)
* gcc-3.0.tar.gz (released version - no patches)
* glibc-linuxthreads-2.2.3.tar.gz (released version - no patches; glibc didn't want to configure without this)
* glibc-2.2.3.tar.gz (released version)

You're missing the patch to change MAP_BASE_ADDR. You need that. Something as simple as changing it to 0 will work for you, since you're building everything yourself.

If you want debugging info, of course, it's much more complicated :)

Signature · 2 lines
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer
#2 lore raw

----- Original Message -----
From: "Daniel Jacobowitz" <[email protected]>
To: "Bradley D. LaRonde" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, August 08, 2001 7:45 PM
Subject: Re: gcc 3.0 / glibc 2.2.3 cross-toolchain

Quoted 3 lines · Bradley D. LaRonde
Quoted 2 lines

I have spent quite a bit of time trying to get a gcc 3.0 / glibc 2.2.3 cross-toolchain working. I am not a Toolchain Builder, but I really

wanted

Quoted 3 lines
Quoted 3 lines

to try this combo and I don't see any way around building it myself.

I've had some success. Everything seems to build fine. However, when I

try

Quoted 6 lines
Quoted 6 lines

to run a simple "hello world" dynamically linked with glibc, I get this:

<myprogram>: error while loading shared libraries: failed to map segment from shared object: cannot load shared object file: Invalid
argument

Quoted 6 lines
Quoted 6 lines

I think it is trying to load libc.so.6, which is in my root in /lib/, symlinked to libc-2.2.3.so, and so is ld.so.1, symlinked to ld-2.2.3.so.

I feel like I am pretty close, but I am starting to get discouraged and could really use some help. I really am clueless about what should/shouldn't work. I'm trying to do this based on bits and pieces

of

Quoted 1 line
Quoted 1 line

information that I've collected from countless sources. I have heard

that

Quoted 11 lines
Quoted 10 lines

gcc 3.0 isn't really "working", but I still want to try.

Here is what I've used:

* binutils-2.11.90.0.25.tar.gz (extracted from H. J. Lu's srpm on oss.sgi.com; I've tried others also)
* gcc-3.0.tar.gz (released version - no patches)
* glibc-linuxthreads-2.2.3.tar.gz (released version - no patches; glibc didn't want to configure without this)
* glibc-2.2.3.tar.gz (released version)

Quoted 3 lines

You're missing the patch to change MAP_BASE_ADDR. You need that. Something as simple as changing it to 0 will work for you, since you're building everything yourself.

I tried applying the patch that H. J. Lu posted on linux-mips that contains that fix, but then glibc would compile. I'll try it again - maybe I messed something up. If that doesn't work, I'll try the simple fix. Thanks.

Regards,
Brad

#3 lore raw

Woohoo! It works! Thanks! I was using H. J. Lu's first patch and that was broken. I found the second patch and it worked, except it left the first line in rtld-ldscript.in, when it really should have removed the file entirely. Looks like it's right in the glibc CVS though.

Regards,
Brad

----- Original Message -----
From: "Bradley D. LaRonde" <[email protected]>
To: "Daniel Jacobowitz" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, August 08, 2001 7:58 PM
Subject: Re: gcc 3.0 / glibc 2.2.3 cross-toolchain

Quoted 8 lines

----- Original Message -----
From: "Daniel Jacobowitz" <[email protected]>
To: "Bradley D. LaRonde" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, August 08, 2001 7:45 PM
Subject: Re: gcc 3.0 / glibc 2.2.3 cross-toolchain

Quoted 7 lines
Quoted 3 lines · Bradley D. LaRonde
Quoted 2 lines

I have spent quite a bit of time trying to get a gcc 3.0 / glibc 2.2.3 cross-toolchain working. I am not a Toolchain Builder, but I really

wanted

Quoted 3 lines
Quoted 3 lines

to try this combo and I don't see any way around building it myself.

I've had some success. Everything seems to build fine. However, when

I

Quoted 2 lines

try

Quoted 1 line
Quoted 1 line

to run a simple "hello world" dynamically linked with glibc, I get

this:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<myprogram>: error while loading shared libraries: failed to map segment from shared object: cannot load shared object file:

Invalid

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

argument

I think it is trying to load libc.so.6, which is in my root in /lib/, symlinked to libc-2.2.3.so, and so is ld.so.1, symlinked to

ld-2.2.3.so.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I feel like I am pretty close, but I am starting to get discouraged

and

Quoted 16 lines
Quoted 2 lines
Quoted 2 lines

could really use some help. I really am clueless about what should/shouldn't work. I'm trying to do this based on bits and pieces

of

Quoted 1 line
Quoted 1 line

information that I've collected from countless sources. I have heard

that

Quoted 11 lines
Quoted 10 lines

gcc 3.0 isn't really "working", but I still want to try.

Here is what I've used:

* binutils-2.11.90.0.25.tar.gz (extracted from H. J. Lu's srpm on oss.sgi.com; I've tried others also)
* gcc-3.0.tar.gz (released version - no patches)
* glibc-linuxthreads-2.2.3.tar.gz (released version - no patches; glibc didn't want to configure without this)
* glibc-2.2.3.tar.gz (released version)

Quoted 5 lines
Quoted 3 lines

You're missing the patch to change MAP_BASE_ADDR. You need that. Something as simple as changing it to 0 will work for you, since you're building everything yourself.

I tried applying the patch that H. J. Lu posted on linux-mips that

contains

Quoted 1 line

that fix, but then glibc would compile. I'll try it again - maybe I

messed

Quoted 4 lines

something up. If that doesn't work, I'll try the simple fix. Thanks.

Regards,
Brad

#4 lore raw

I've chronicled my cross-toolchain mips-adventures at:

http://www.ltc.com/~brad/mips/mipsel-linux-cross-toolchain-building.txt

I included a copy of the glibc patch that has the MAP_BASE_ADDR fix in it in the same directory, namely:

http://www.ltc.com/~brad/mips/

Regards,
Brad

----- Original Message -----
From: "Bradley D. LaRonde" <[email protected]>
To: "Bradley D. LaRonde" <[email protected]>; "Daniel Jacobowitz" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, August 08, 2001 10:44 PM
Subject: Re: gcc 3.0 / glibc 2.2.3 cross-toolchain

Quoted 1 line

Woohoo! It works! Thanks! I was using H. J. Lu's first patch and that

was

Quoted 7 lines

broken. I found the second patch and it worked, except it left the first line in rtld-ldscript.in, when it really should have removed the file entirely. Looks like it's right in the glibc CVS though.

Regards,
Brad

Quoted 18 lines

----- Original Message -----
From: "Bradley D. LaRonde" <[email protected]>
To: "Daniel Jacobowitz" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, August 08, 2001 7:58 PM
Subject: Re: gcc 3.0 / glibc 2.2.3 cross-toolchain

Quoted 10 lines

----- Original Message -----
From: "Daniel Jacobowitz" <[email protected]>
To: "Bradley D. LaRonde" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, August 08, 2001 7:45 PM
Subject: Re: gcc 3.0 / glibc 2.2.3 cross-toolchain

Quoted 2 lines · Bradley D. LaRonde
Quoted 1 line

I have spent quite a bit of time trying to get a gcc 3.0 / glibc

2.2.3

Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

cross-toolchain working. I am not a Toolchain Builder, but I really

wanted

Quoted 3 lines
Quoted 3 lines

to try this combo and I don't see any way around building it myself.

I've had some success. Everything seems to build fine. However,

when

Quoted 11 lines

I

Quoted 2 lines

try

Quoted 1 line
Quoted 1 line

to run a simple "hello world" dynamically linked with glibc, I get

this:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

<myprogram>: error while loading shared libraries: failed to map segment from shared object: cannot load shared object file:

Invalid

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

argument

I think it is trying to load libc.so.6, which is in my root in

/lib/,

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

symlinked to libc-2.2.3.so, and so is ld.so.1, symlinked to

ld-2.2.3.so.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I feel like I am pretty close, but I am starting to get discouraged

and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

could really use some help. I really am clueless about what should/shouldn't work. I'm trying to do this based on bits and

pieces

Quoted 2 lines
Quoted 2 lines

of

Quoted 1 line
Quoted 1 line

information that I've collected from countless sources. I have

heard

Quoted 12 lines
Quoted 12 lines

that

Quoted 11 lines
Quoted 10 lines

gcc 3.0 isn't really "working", but I still want to try.

Here is what I've used:

* binutils-2.11.90.0.25.tar.gz (extracted from H. J. Lu's srpm on oss.sgi.com; I've tried others also)
* gcc-3.0.tar.gz (released version - no patches)
* glibc-linuxthreads-2.2.3.tar.gz (released version - no patches; glibc didn't want to configure without this)
* glibc-2.2.3.tar.gz (released version)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

You're missing the patch to change MAP_BASE_ADDR. You need that. Something as simple as changing it to 0 will work for you, since

you're

Quoted 10 lines
Quoted 3 lines
Quoted 1 line

building everything yourself.

I tried applying the patch that H. J. Lu posted on linux-mips that

contains

Quoted 1 line

that fix, but then glibc would compile. I'll try it again - maybe I

messed

Quoted 4 lines

something up. If that doesn't work, I'll try the simple fix. Thanks.

Regards,
Brad

#6 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I offered something along these lines a while ago. I even started a little site. Unfortunately I don't have enough time to keep up with current toolchain patches, etc. myself, but if people send me patches, along with comments, I'll post them at my site.

Quoted 8 lines · Arnaud Rolly

Le Mercredi 8 AoШt 2001 23:49, vous avez Иcrit :

Quoted 7 lines

I've chronicled my cross-toolchain mips-adventures at:

http://www.ltc.com/~brad/mips/mipsel-linux-cross-toolchain-building.txt

I included a copy of the glibc patch that has the MAP_BASE_ADDR fix in it in the same directory, namely:

Quoted 7 lines
Quoted 4 lines

http://www.ltc.com/~brad/mips/

Regards,
Brad

It would be great to have a patch repository, for example just a directory on the FTP of oss.sgi.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjtyN5kACgkQtKh84cA8u2lORwCcDr0csXgikuVFizIgBXJgncPv zpQAoIGtXsSE7WMiBP0XODyWhEMhj9zb
=VJLD
-----END PGP SIGNATURE-----