From owner-freebsd-hackers Wed Jul 30 08:52:01 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id IAA10682 for hackers-outgoing; Wed, 30 Jul 1997 08:52:01 -0700 (PDT) Received: from iworks.InterWorks.org (deischen@iworks.interworks.org [128.255.18.10]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id IAA10669 for ; Wed, 30 Jul 1997 08:51:50 -0700 (PDT) Received: (from deischen@localhost) by iworks.InterWorks.org (8.7.5/) id KAA18490; Wed, 30 Jul 1997 10:55:35 -0500 (CDT) Message-Id: <199707301555.KAA18490@iworks.InterWorks.org> Date: Wed, 30 Jul 1997 10:55:35 -0500 (CDT) From: "Daniel M. Eischen" To: A.J.Smith@nortel.co.uk, freebsd-hackers@FreeBSD.ORG Subject: Re: Cross compiling for FreeBSD 3.0 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > I have several linux boxes (2.0.30 kernel) and I want to install GCC as a > cross-compiler so I can produce FreeBSD binaries. Can anyone help me out > and give me some info as to home I might do this? > > I have limited access to a FreeBSD 3.0 sytem, so if I need libraries, > header files and includes I could get them that way, but it is a real > hassle so I'm hoping I don't need too much. I've built FreeBSD binaries on a Sparc-Sun-Solaris system. In lieu of FreeBSD emulation in Linux, your best bet will be to build ELF binaries for FreeBSD (3.0-current will support native ELF binaries). The binutils 2.7 (and greater) has support for FreeBSD ELF builtin - you just need a couple of minor patches to get it to work properly. If you wanted to make a.out binaries you'd have to port FreeBSDs ld to Linux. I tried doing this for Solaris, but gave up because I didn't understand it well enough (and ELF was much easier :). Start with getting the Elfkit from: ftp://ftp.polstra.com/pub/FreeBSD/elfkit-1.2.1.tar.gz ftp://ftp.polstra.com/pub/FreeBSD/elfkit-1.2.1.patch1 You'll need elfkit-1.2.1.patch1 and binutils-2.6.0.12.patch (the latter patch coming from the elfkit tarball). Apply these patches to binutils-2.7 (or 2.8). Read the READMEs in John Polstras elfkit if you are unsure how to build a cross compiler - you don't need the elfkit for anything other than the READMEs and patch. Pick a directory in which to want your cross-compilation system to be installed (/usr/local/freebsdelf?) and build the patched binutils with this prefix. Get the include files from a 3.0 FreeBSd system and install them in /i386-unknown-freebsdelf/include. Grab the necessary libraries from a 3.0 FreeBSD system and place them in /i386-unknown-freebsdelf/lib. (I am assuming you're configuring binutils/gcc for i386-unknown-freebsdelf). Configure gcc-2.7.2 for i386-unknown-freebsdelf and your chosen prefix. Build and install gcc. You're now ready to start cross compiling. I know I left out some of the details - I have more precise notes at home if you need them. Dan Eischen deischen@iworks.InterWorks.org