This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: crosstool for native compiler on new system.


Guten Tag Clemens, 

I recently went through something similar, cross-building for ARM on
i386. One thing I found is that if you use the crosstool scripts without
change to produce a native compiler, the native compiler believes it is
a cross-compiler. This causes it to behave slightly differently than you
might expect when running it natively. Also I think there are parts of
glibc (i.e. ldd) that build only when they believe they are for a native
compiler.

I ended up patching the crosstool-0.28-rc37 source to allow
cross-building of a "true" native compiler. The native cross-build mode
is triggered by GCC_HOST = TARGET. Then, TARGET_ROOT specifies the root
of your native system as mounted on your build system (i.e. the
so-called DESTDIR).

Some things to note:

* The patch updates all.sh and crosstool.sh. It does not update
crosstool-cygwin.sh.

* The changes to crosstool.sh may be a little more than you need. I also
changed the "sysroot"ing from ${PREFIX}/${TARGET}/sys-root to just
$PREFIX when building a cross-compiler (as opposed to cross-building a
native compiler). Rather than try to back that part of it out and hand
you something less stable, I left it in.

* I added a "--nopurge" option to all.sh that prevents it from deleting
previous results. I find this helpful when cross-building a native root
filesystem - if I regenerate the toolchain, I don't want to lose the
rest of my cross-userland doing it.

* crosstool.sh puts results of a native compiler build beneath
TARGET_ROOT. The all.sh script doesn't know whether the build is for a
cross compiler or a native compiler; it assumes that the build results
are in $PREFIX. Until this discrepancy is reconciled you should probably
always specify --nopurge when calling all.sh.

* I disabled mkoverride.sh, since I didn't need it for what I was doing
and didn't have time to dig into it. Looking at it this morning, I think
it might have a bug when crosstool is run with USE_SYSROOT - the paths
coded into mkoverride are the "plain old way" not the "spiffy new
sysroot way".

Attached are 4 files - the patch to crosstool-0.28-rc37, the script I
use for building the cross-compiler, the script I use to build the
native compiler, and the .dat file I use.

Hope these help. Feedback is most welcome - these are works in progress.

Regards,
Steve Magnani
www.digidescorp.com


-----Original Message-----
From: Clemens Koller [mailto:clemens.koller@anagramm.de] 
Sent: Wednesday, February 02, 2005 8:39 AM
To: crossgcc@sources.redhat.com
Subject: crosstool for native compiler on new system.


Hello,

Well, some days ago, I was successfully running crossgcc on MPC8540 
(e500, SPE) (no changes were necessary within crosstool, to answer your
last question, Steve.)

Now I want to use or re-use the binaries for a new Linux From Scratch 
root on a harddisk in i.e. /mnt.

So, my question is: what things do I need to take care about to get my
new compiler+binutils+? as my (one and only) native compiler in /usr/bin
on the host system as well as in the new root of /mnt/usr/bin. Is it
okay to set the TARGET_DIR to put the compiler to i.e. 
/mnt/usr/bin (which might be dangerous)?

It is possible to relocate the whole (crossgcc-) build, copy the libs,
edit the specs file and move (or put symlinks)
powerpc-linux-gnuspe-* to /usr/bin/*
(I would prefer not to use any powerpc-linux-sth-prefixes anymore).

Is the specs file the one and only place for gcc+friends which needs to
fit the environment?

Well, I've read several howtos as well as the LFS docu...
but I still feel unsafe in what I am doing. Can you please point me to
some more installation FAQs or examples or give me a short sketch of the
things I need to take care?

Is it possible to get out a tar.gz'ed file out of crosstool with only
the binaries which are needed in a plain, native Linux? (like a
--buildnativetar)

Thank you!

-- 
Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany

http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19

Attachment: crosstool.patch
Description: Binary data

Attachment: armv4tb-softfloat-cross.sh
Description: Binary data

Attachment: armv4tb-softfloat-native.sh
Description: Binary data

Attachment: armv4tb-softfloat.dat
Description: Binary data

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]