LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-28-2009, 02:10 AM   #1
and73y
LQ Newbie
 
Registered: May 2009
Location: Ekb, Russia
Distribution: Slackware 12.2
Posts: 6

Rep: Reputation: 0
Unhappy compiling cross gcc for powerpc, glibc trouble


I am building a gcc cross compiler for powerpc on Slackware 12.2.
I did several steps:

1. make binutils
configure --target=powerpc-88x-linux-gnu --prefix=/powerpc --enable-languages=c,c++
make

2. make cross gcc
configure --target=powerpc-88x-linux-gnu --prefix=/powerpc --disable-shared --disable-threads --enable-languages=c
make

3. make glibc
configure --prefix=/powerpc --build=i686-pc-linux-gnu --host=powerpc-88x-linux-gnu --enable-add-ons=nptl --with-headers=/powerpc/powerpc-88x-linux-gnu/sys-include --with-binutils=/powerpc/powerpc-88x-linux-gnu/bin

I have error on this step:
checking for forced unwind support... no
configure: error: forced unwind support is required

config.log:
...
configure:27: checking for forced unwind support
configure:56: powerpc-88x-linux-gnu-gcc -o conftest -g -O2 conftest.c >&5
/powerpc/lib/gcc/powerpc-88x-linux-gnu/4.4.0/../../../../powerpc-88x-linux-gnu/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
...


Please tell me what's wrong!!!
 
Old 05-28-2009, 02:30 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by and73y View Post
I am building a gcc cross compiler for powerpc on Slackware 12.2.
I did several steps:

1. make binutils
configure --target=powerpc-88x-linux-gnu --prefix=/powerpc --enable-languages=c,c++
make

2. make cross gcc
configure --target=powerpc-88x-linux-gnu --prefix=/powerpc --disable-shared --disable-threads --enable-languages=c
make

3. make glibc
configure --prefix=/powerpc --build=i686-pc-linux-gnu --host=powerpc-88x-linux-gnu --enable-add-ons=nptl --with-headers=/powerpc/powerpc-88x-linux-gnu/sys-include --with-binutils=/powerpc/powerpc-88x-linux-gnu/bin

I have error on this step:
checking for forced unwind support... no
configure: error: forced unwind support is required

config.log:
...
configure:27: checking for forced unwind support
configure:56: powerpc-88x-linux-gnu-gcc -o conftest -g -O2 conftest.c >&5
/powerpc/lib/gcc/powerpc-88x-linux-gnu/4.4.0/../../../../powerpc-88x-linux-gnu/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
...


Please tell me what's wrong!!!
glibc developers are very unfriendly regarding bugs in glibc build mechanism.

For example, I managed to build (non-cross) glibc-2.9, but under exactly the same settings I can't build glibc-2.10.1.

While trying to build and test glibc-2.9 I filed a number of bug reports, and dealing with the developers was a disaster.

Read http://blog.aurel32.net/?p=47 and links there to see the whole picture.

Your best hope is to try to find the needed info on the WEB.

Try also this repo:

http://www.eglibc.org/archives/issues/msg00034.html ->
http://toolchain.freesa.org/eglibc-tarballs/

- haven't tried it myself.
 
Old 05-28-2009, 07:20 AM   #3
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
What version of glibc are you trying to build? Did binutils and gcc build okay and are installed and in the path when you try to build glibc?
 
Old 05-28-2009, 08:58 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by gnashley View Post
What version of glibc are you trying to build? Did binutils and gcc build okay and are installed and in the path when you try to build glibc?
I have both gcc-4.3.3 and binutils-2.19.1; everything is built automatically, and overall I have about 300 items built this way - glibc is the nastiest one so far.

If you are interested in the details, read

http://sourceware.org/bugzilla/show_bug.cgi?id=10062
http://sourceware.org/bugzilla/show_bug.cgi?id=10063
.
 
Old 05-28-2009, 09:49 AM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
As you have discovered, there are a lot of details involved with building cross toolchains. May I suggest using a tool that is made for the purpose, such as crosstool, the newer and still supported crosstool-ng, or openembedded? These packages are built to look after all of the details of building cross toolchains, and are able to produce them for a large matrix of compiler versions, glibc versions, and target CPUs. I have successfully built kernels and applications with toolchains I created using both crosstool and crosstool-ng. I am about to explore the openemedded package in the near future. Crosstool-ng has a very active mailing list, although it seems less geared toward helping end users than toward people developing the crosstool-ng package itself.
--- rod.
 
Old 05-29-2009, 07:44 AM   #6
and73y
LQ Newbie
 
Registered: May 2009
Location: Ekb, Russia
Distribution: Slackware 12.2
Posts: 6

Original Poster
Rep: Reputation: 0
2gnashley
I'm trying to build:
1. binutils-2.19
2. glibc-2.9
3. gcc-4.4.0

binutils and simple version of gcc were built and installed sucessfully in prefix path

2theNbomr
I've download crosstool-0.43:
gcc-4.4.0-glibc-2.xx... .dat
contains:

BINUTILS_DIR=binutils-2.19
GCC_DIR=gcc-4.0.0
GLIBC_DIR=glibc-2.3.5
LINUX_DIR=linux-2.6.15.4
LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.5

but I haven't target linux distrib (LINUX_DIR), I have only target sys-includes and device on desktop with BusyBox kernel 2.4.26 (special build)

Last edited by and73y; 05-29-2009 at 07:46 AM.
 
Old 05-29-2009, 08:42 AM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Are you setting your PATH so that your new binutils and gcc are being used instead of the regular ones?
 
Old 05-29-2009, 10:06 AM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Okay, I'm no expert on the subject (which is why I rely on the tool to do the right things), and I don't completely understand your question. To be honest, I've always used the 'demo-XXX.sh' scripts, with my basic target directories specified, and then allowed the tool to do what it needs. My belief is that the tool downloads and builds a 'standard' native compiler (and related components), and then uses that native compiler to build all of the subsequent cross development tools and libraries. The reference to linux-2.6.15.4 is saying that the first-stage native compiler is to be built against linux kernel 2.6.15.4, and the necessary parts from that kernel will be downloaded and used as part of the crosstool first stage process. After creating a cross toolchain, in my crosstool directory tree, I find a collection of directories name 'build-binutils', 'build-gcc', etc. I also find a complete, or near complete, linux source tree, the version of which I have never installed or used, but which agrees with the version specified by the 'LINUX_DIR=' entry in my xxxx.dat file. These seem to be the standard core native components with which all of the actual cross toolchain components are built.
The idea of building everything from a standard base compiler & kernel seems to make sense from the perspective of achieving consistent results. On my installed package, it seems to want to build gcc-3.3.6 as the standard 'core' compiler, and use linux-2.6.15.4 as the basis for the kernel version. This kind of attention to consistency and thoroughness is what I found attractive about using crosstool as opposed to trying to roll my own procedure.
Your requirements, in terms of versions of glibc and gcc don't seem to be a standard combination in the package I presently have installed, but it seems reasonable that you could create an appropriate configuration file, as you have apparently already done, and as long as the versions you specify are realistic, it should be expected to work.
If someone knows more or has knowledge contrary to my understanding, I hope they will please speak up here. Hope this helps.
--- rod.

Last edited by theNbomr; 05-29-2009 at 04:17 PM.
 
Old 06-01-2009, 05:06 AM   #9
and73y
LQ Newbie
 
Registered: May 2009
Location: Ekb, Russia
Distribution: Slackware 12.2
Posts: 6

Original Poster
Rep: Reputation: 0
gnashley:
Yes! After step 2:
export PATH=$PATH:/powerpc:/powerpc/bin

theNbomr:
Thank you. I'll try your way.
 
Old 06-01-2009, 07:29 AM   #10
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
This:
export PATH=$PATH:/powerpc:/powerpc/bin
needs to be this:
export PATH=/powerpc:/powerpc/bin:$PATH
so that your new tools get picked up *before* the ones in the existing PATH

You can check to make sure things are working right like this:
which gcc
export PATH=/powerpc:/powerpc/bin:$PATH
which gcc
 
Old 06-02-2009, 02:01 AM   #11
and73y
LQ Newbie
 
Registered: May 2009
Location: Ekb, Russia
Distribution: Slackware 12.2
Posts: 6

Original Poster
Rep: Reputation: 0
I've change PATH variable, but no effect(
the same error

/powerpc/lib/gcc/powerpc-88x-linux-gnu/4.4.0/../../../../powerpc-88x-linux-gnu/bin/ld: crt1.o: No such file: No such file or directory
 
Old 06-02-2009, 03:46 AM   #12
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Try exporting LD_LIBRARY_PATH so it points to the right libs.
 
Old 06-03-2009, 05:41 AM   #13
and73y
LQ Newbie
 
Registered: May 2009
Location: Ekb, Russia
Distribution: Slackware 12.2
Posts: 6

Original Poster
Rep: Reputation: 0
I have only:
/usr/lib/crt1.o
but this file is intended for my machine (i686-pc-linux-gnu).
I think that glibc needs another crt1.o - for target mashine (powerpc).

the same problem:
http://gcc.gnu.org/ml/gcc-help/2009-04/msg00240.html

solution:
"This is a typical bootstrap problem when building a cross-compiler to
GNU/Linux: crt1.o comes from glibc, but you can't configure glibc
without crt1.o. The solution is to build glibc twice."

How to build crt1.o for powerpc?

Last edited by and73y; 06-03-2009 at 05:46 AM.
 
Old 06-04-2009, 05:55 PM   #14
infobits
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
Hi, I am new to these forums and to Linux and to making and building my own cross compiler environments. In my first days of trying, I too have encountered these problems when trying to configure and make build glibc. It just always errors out with something or other.
I am using Debian Linux Lenny 5.0.1 and kernel 2.6.29.2-686 on a Toshiba Intel Centrino (i686)PC.
I have successfully make, compile and install binutils 2.19.1 and gcc-4.4.0 as a plain vanilla local host compiler and as an arm-linux cross compiler. But am un-able to make build nor install any of these glibc source packages. What the heck? Time consuming searching all over the net for solution(s).
 
Old 06-05-2009, 04:21 AM   #15
and73y
LQ Newbie
 
Registered: May 2009
Location: Ekb, Russia
Distribution: Slackware 12.2
Posts: 6

Original Poster
Rep: Reputation: 0
http://gcc.gnu.org/ml/gcc-help/2007-06/msg00020.html

There are 3 solutions:
1. To take working libc under target machine and then trying to build glibc.
2. To build gcc and glibc in the same tree.
3. To use crosstool.

Now I try to carry out the second way without success((
 
  


Reply

Tags
crosscompile, gcc



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross compiling gcc 4.x mks_jangra Linux - Software 1 05-17-2007 08:32 PM
Cross-Compiling with glibc trek413 Linux - Software 0 08-24-2006 09:34 PM
Problem with gcc powerpc cross compile !! rohya_joshi Linux - Software 2 02-07-2006 12:44 AM
Error cross-compiling glibc, chapter 5 donbellioni Linux From Scratch 2 09-17-2004 02:12 PM
Building cross-compiler gcc for powerpc-linux ccool Linux - General 3 09-17-2004 06:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration