Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Other *NIX Forums > *BSD
User Name
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.


  Search this Thread
Old 09-12-2008, 10:35 AM   #1
LQ Newbie
Registered: Feb 2007
Posts: 9

Rep: Reputation: 0
building cross compiler, having issues

this is my first time trying to build a compiler from the gnu compiler collection source so, inevitably, i'm having a few issues. i'm trying to build a cross compiler for arm4 targets on my virtual machine, running FreeBSD 7. I'm doing this for building arm4 code for an arm7tdmi chip in the gameboy advance for an operating system project. i have downloaded libgba and the appropriate headers but i need a compiler that will build raw binaries (not ELF compatible, should be a.out old binaries i think) that i can pull over to my flash cartridge and run on the system. here's what i've done so far:

1. downloaded binutils 2.18: won't compile for arm or i386 targets
2. downloaded binutils 2.9: won't compile for arm or i386 targets
3. downloaded binutils 2.8: won't compile for arm or i386 targets
4. make install gcc41 in /usr/ports: gcc upgraded successfully
5. tried to compile gcc43 from source: no success for i386 target: missing gmp, mpfr
6. make install gmp and mpfr in /usr/ports: successful
7. tried again to compile gcc43: no success, different error:
sed -e 's/@gcc_version@//' < > mkheadersT
Syntax error: redirection unexpected
right now i'd really just like for anything to compile properly. i'm starting to feel a bit overwhelmed. i realized building the compiler would be a huge undertaking but now i'm stuck...

should i even bother compiling from source? it seems impossible. i'm trying to gain a greater understanding of gcc and compilation for BSD systems as i'm hoping to soon make a career out of embedded systems programming... maybe i'm just a noob but i was hoping that it would be possible to download and compile gcc from source for any target OS? maybe not...

Is there some way to build a compiler using ./configure options from the ports tree? I'm thinking since that worked, perhaps there's a way to install with --prefix=/path/to/tools --target=arm4l or something like that... any help would be great.

i'd prefer to build this from the source available from gnu rather than ports just to get the experience and learn more about gcc but if that's not possible or no one has the info, compiling from ports would be sufficient.
Old 09-13-2008, 03:09 AM   #2
Senior Member
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Read the GCC build/install documentation which came with the source very carefully (then read it again a few times over). The GFP and MPFR messages suggest that you are trying to compile FORTRAN. For a first try, only build the C compiler. In the case of building the compiler, the 'BUILD' machine is the machine which the compiler is being built on, the 'HOST' machine is the one which the compiler will run on (usually the same as BUILD), and the 'TARGET' machine is the machine which the compiler will build code for.

When the compiler has been built you will need to start building up the libraries, making sure you're invoking your cross-compiler. You also need to build the build tools (linker/loader, etc). As you build other programs you need to start passing a lot of parameters and setting a lot of environment variables to make sure the correct libs are being linked, correct headers being included, etc. This part is often such a nuisance that people patch the compiler source before building it so that the libs, includes, etc are all set to a location different from your installed system.

For the output, if you really want an old-style a.out (really not recommended), you need to add "-maout" to your CFLAGS environment variable.

I hope that helps get you started - have fun.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Troubles in building cross compiler (error @ binutils) saistain Linux - Software 3 10-15-2007 07:37 AM
Trouble building a Cross Compiler to use to build a x86_64 kernel. nLEyETn Linux - Software 2 05-08-2007 07:35 PM
glib Error: while building Cross-Compiler for PPC Dhana_pal Linux From Scratch 2 12-28-2006 01:57 AM
Building cross-compiler gcc for powerpc-linux ccool Linux - General 3 09-17-2004 07:33 AM
Building an ARM7 cross compiler from gcc Charlie_B Linux - Software 2 08-20-2003 09:59 AM > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 09:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration