Succes using crosstool on Mac OS X

Martin Schaffner schaffner@gmx.li
Thu Feb 26 14:29:00 GMT 2004


Dave wrote:
>
> Martin> First I used fink to install cvs, rsync, libtool14, fileutils,
> Martin> gawk, sed, and wget.
>
> On my OS X 10.3, I already have cvs, rsync, libtool, awk, and sed.
> Was there a specific incompatibility that motivated you to install
> these using fink?  Or did you just not have them on your system?

cvs and rsync probably weren't necessary.
Apple's libtool serves a completely different purpose from GNU libtool. 
Although probably GNU libtool isn't necessary either.
I installed fileutils, gawk, and sed because there are features in the 
GNU versions of these programs which are missing in the BSD versions. I 
especially like the fact that you can do "ls * -al" in addition to "ls 
-al *" with GNU ls. If I remember correctly, linux fails to compile 
with the "sed" (or "awk"?) that comes with OS X.

> Martin> Finally, when crosstool wants to install the glibc headers, it
> Martin> unfortunately tries to compile glibc with the platform's
> Martin> native toolchain. Glibc's configure script does "as
> Martin> --version", which is not understood by Apple's assembler,
> Martin> which then waits for a file to compile on standard input,
> Martin> which stalls everything.
>
> I got past this by just removing the "as --version" check from the
> configure.in file and running autoconf.

Is that the only problem with the glibc header installation?

> Martin> I solved that problem by first creating a cross-compiler
> Martin> called "/tools/bin/powerpc-750-linux-gnu-gcc", and changing
> Martin> crosstool.sh like this: Where ${GLIBC_DIR}/configure is
> Martin> invoked, I removed CC=gcc, and appended
> Martin> --with-binutils=/tools/bin.
>
> I don't understand how this solves the problem.

This uses GNU as, which understands "--version" very well :)

>   Doesn't "as" have to
> be a native as?

binutils doesn't compile with --target=powerpc-apple-darwin7.2.0

>   How would using a powerpc assembler allow you to
> build a cross compiler that actually runs on the Mac?

The "as" I used to make the glibc headers was compiled on OS X, runs on 
OS X, but targets powerpc-750-linux-gnu. Its output files are never run 
on OS X, but some of them are #included when cross-compiling on OS X.

This whole business about compiling gcc and binutils twice is not 
optimal. Maybe someone will come up with an actual solution.


Ken wrote:

> > I don't understand how this solves the problem.  Doesn't "as" have to
> > be a native as?  How would using a powerpc assembler allow you to
> > build a cross compiler that actually runs on the Mac?
> >
> Isn't the MAC based on a Power PC chip

Both powerpc-750-linux-gnu and powerpc-apple-darwin7.2.0 run on 
powerpc, but they link against completely different c libraries, and 
(more important) they use different object file formats: GNU uses ELF, 
OS X uses Mach-O.

Martin


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



More information about the crossgcc mailing list