Cross compiling with the i386-elf toolchain?
I'm trying to learn cross compiling out of curiousity for an idea I'm playing with at work. I have a powerbook G4 (ppc) with the i386-elf port for GCC and binutils installed. I'm trying to compile a simple "hello world" application that just has a single printf. In a terminal I type: i386-elf-gcc-3.4.3 -c main.c and I get the expected main.o now I type i386-elf-gcc-3.4.3 -o hello main.o and I get: /opt/local/lib/gcc/i386-elf/3.4.3/../../../../i386-elf/bin/ld: crt0.o: No such file: No such file or directory So my problem is linking. I've exhausted my google abilities and knowledge. I think I need something like: i386-elf-gcc-3.4.3 -o hello main.o -I/opt/local/i386-elf/include -Wl, -nostdlib but so far I cannot figure it out. If someone will help me figure out a simple "hello world" cross compile recipe for these tools I would be most appreciative. Thanks David
Cross toolchains such as MacPort's i386-elf are target agnostic. They rely on a minimum runtime glue code (in crt0.o file). This library highly depends on the kind of target you are targetting. You can either compile/write one yourself in assembly language (that's the approach for targets with open-source crt0 file) or use one from the SDK of the platform you are targetting. HTH, Paul Le 4 oct. 06 à 22:43, David Smoot a écrit :
I'm trying to learn cross compiling out of curiousity for an idea I'm playing with at work.
I have a powerbook G4 (ppc) with the i386-elf port for GCC and binutils installed. I'm trying to compile a simple "hello world" application that just has a single printf.
In a terminal I type: i386-elf-gcc-3.4.3 -c main.c and I get the expected main.o
now I type i386-elf-gcc-3.4.3 -o hello main.o and I get: /opt/local/lib/gcc/i386-elf/3.4.3/../../../../i386-elf/bin/ld: crt0.o: No such file: No such file or directory
So my problem is linking. I've exhausted my google abilities and knowledge. I think I need something like: i386-elf-gcc-3.4.3 -o hello main.o -I/opt/local/i386-elf/include -Wl, -nostdlib but so far I cannot figure it out.
If someone will help me figure out a simple "hello world" cross compile recipe for these tools I would be most appreciative.
Thanks David _______________________________________________ macports-users mailing list macports-users@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macports-users
-- Ministre ultraplénipotentiaire en disponibilité. Mobile. Sans baignoire fixe. http://www.kallisys.com/ http://www-poleia.lip6.fr/~guyot/
participants (2)
-
David Smoot
-
Paul Guyot