LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   compiling cross gcc for powerpc, glibc trouble (http://www.linuxquestions.org/questions/programming-9/compiling-cross-gcc-for-powerpc-glibc-trouble-729027/)

and73y 05-28-2009 03:10 AM

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!!!

Sergei Steshenko 05-28-2009 03:30 AM

Quote:

Originally Posted by and73y (Post 3555138)
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.

gnashley 05-28-2009 08:20 AM

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?

Sergei Steshenko 05-28-2009 09:58 AM

Quote:

Originally Posted by gnashley (Post 3555331)
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
.

theNbomr 05-28-2009 10:49 AM

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.

and73y 05-29-2009 08:44 AM

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)

gnashley 05-29-2009 09:42 AM

Are you setting your PATH so that your new binutils and gcc are being used instead of the regular ones?

theNbomr 05-29-2009 11:06 AM

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.

and73y 06-01-2009 06:06 AM

gnashley:
Yes! After step 2:
export PATH=$PATH:/powerpc:/powerpc/bin

theNbomr:
Thank you. I'll try your way.

gnashley 06-01-2009 08:29 AM

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

and73y 06-02-2009 03:01 AM

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

gnashley 06-02-2009 04:46 AM

Try exporting LD_LIBRARY_PATH so it points to the right libs.

and73y 06-03-2009 06:41 AM

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?

infobits 06-04-2009 06:55 PM

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).

and73y 06-05-2009 05:21 AM

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((


All times are GMT -5. The time now is 05:22 AM.