Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 12th September 2008
moonlightcheese moonlightcheese is offline
New User
Join Date: Sep 2008
Posts: 1
Default 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.
Reply With Quote
  #2   (View Single Post)  
Old 12th September 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589


I don't fully understand what you were doing with ports....
I suggest you install portmaster
install ports using it....
portmaster is very easy to use sh script, which doesn't require any other ports to be installed..
postmaster will make things way more easy

update your ports tree
using csup or portsnap (i suggest 2nd, which is faster)
$ cd /usr/ports/ports-mgmt/portmaster
$ make install clean
and read manual for portmaster

to install gcc
$ portmaster lang/gcc44
for example

Also do you have actual FreeBSD system on real PC?
If so, do you know that you can compile ports for other architectures from different architecture (for example from i386 compile for sparc64)
This can be done on Virtual machine as well (i just don't really know how, but google might help)

Last edited by graudeejs; 12th September 2008 at 03:04 PM.
Reply With Quote
  #3   (View Single Post)  
Old 13th September 2008
hsw hsw is offline
New User
Join Date: May 2008
Posts: 6

Trying to build a cross compiler is quite difficult with gcc you often have to
patch various parts of the gcc build system for it to work.

I have a partial port of gcc for arm, but it was done on 6.2. If you want that I can send it
to you - just let me know.

You do not need to have the compiler produce binary object you leave it to the
linker(ld) - and a particular linker script that matches the memory layout
of your hardware.

You might have more success looking into crosstool - not sure if it will work
on 7 though.


This is a script that can do all the patching. I used it on FreeBSD for ARM cross compiler. Also built a Linux version using a Debian chroot on freeBSD.

Let me know if you want more info.

Last edited by hsw; 13th September 2008 at 02:37 PM. Reason: correct spelling
Reply With Quote

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete compilers to cross compile revzalot OpenBSD Installation and Upgrading 9 28th August 2009 08:06 PM
FreeBSD 7.0 kernel building... daemonFromHeaven FreeBSD Installation and Upgrading 4 3rd September 2008 02:42 PM
java compiler bsdnewbie999 OpenBSD Packages and Ports 8 9th August 2008 12:18 PM
pkg_chk c++ compiler not available fenrisW0lf NetBSD Package System (pkgsrc) 15 30th June 2008 10:48 AM
pcc compiler question ChineseBroccoli FreeBSD General 1 11th June 2008 11:29 PM

All times are GMT. The time now is 10:08 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick