how to make 64bit cross compiler work

Peter Bergner bergner at brule.borg.umn.edu
Thu Aug 1 23:28:48 EST 2002


Rita Chiu wrote:
: I am using a 43p150 machine (32bit machine, uname -m == ppc), and I am
: trying to build a gcc compiler that can produce 64bit application.

To build 64-bit applications, you will need to config, build and
install binutils, gcc and glibc.  Note that you will not be able
to execute 64-bit applications on your 32-bit 43p150 machine.
You'll need a 64-bit machine running a ppc64 kernel to do that.
In addition, the kernel that is installed on the SuSE SLES7 distro
does _not_ have the capability to execute 64-bit dynamically linked
applications...it will execute 64-bit statically linked applications
though (powerpc64-linux-gcc -static hello.c).



: I follow the instruction on http://www.penguinppc64.org/toolchain.shtml
: and used binutils-2.12.1-ppc64.diff to build the binutils and
: gcc-20020730-ppc64.diff.gz to build the gcc compiler.  Binutils and gcc
: built and installed successfully.

The toolchain you have built is only useful for compiling the Linux kernel
which does not require or use glibc.  To build 64-bit applications, you will
also need to build the 64-bit glibc.  There are some directions for building
binutils/gcc/glibc at:

    http://www.penguinppc64.org/glibc-alpha.shtml

I'm currently trying to update the directions.  If you run into trouble,
post here or jump onto #ppc64 (irc.openprojects.net).



: However, everytime I tried to run this compiler (powerpc64-linux-gcc),
: no matter what I tried to compile, it gave me /lib/libc.so.6 error all
: the time. ("/lib/libc.so.6: could not read symbols: Invalid operation").

You're trying to link against the 32-bit glibc.  That is wrong, you need
to link against the 64-bit glibc.


: What do I need to make this compiler work on my ppc machine (not
: ppc64)?  Or this compiler can only run in a 64bit environment (64bit
: kernel? or 64bit glibc?)?  I am confused on what I have just built, and
: how to use it.  Please give me some advice.  Thank you very much.

The binutils/gcc used to produce 64-bit applications are actually 32-bit
applications so they should run fine on your system, but the 64-bit
application they produce will never run on your 32-bit box.  The only
thing you are missing is the 64-bit glibc.



: Here is how I invoke the gcc:
: /build/usr/local/bin/powerpc64-linux-gcc -v -I/usr/include -B/usr/lib
: -L/usr/lib v.c

Until a properly installed 64-bit toolchain is installed (eg, via a rpm
from a distro), never, ever use any of the include files from /usr/include.
And even if you have a properly installed toolchain, never ever link against
any of the libs in /usr/lib or /lib.

Until you have a properly installed toolchain, all the *.h files in /usr/include
are for your 32-bit ppc system.  Eventually, those header files will be bi-arch
and support both ppc32 and ppc64, but until then don't use them.

The libs in /lib and /usr/lib will always be 32-bit libs so don't ever use them.
The 64-bit libs will eventually be located in /lib64 and /usr/lib64.


Peter

--
Peter Bergner Ph.D.
Linux PPC64 Kernel & GLIBC Development
IBM Rochester, MN
bergner at vnet.ibm.com


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list