Cross-compiling/porting to Linux

Axel Gonzalez loox at e-shell.net
Tue Mar 29 20:22:42 PST 2005


On Tuesday 29 March 2005 05:32, Michael Hopkins wrote:
> Hi all
>
> I have just installed mingwin32 from the ports and it works beautifully -
> can now port all my Unix command line code (including linking to win32
> libraries) to win32 with the flick of a make switch.  Marvellous!

Glad to know it works now.. I should have checked more often

>
> Now to linux...  I haven't tried any of the linux compatibility stuff yet,
> either for running binaries or cross-compiling.  I thought I would ask here
> first because I have seen quite a few messages suggesting potential issues
> on amd64.
>
> At the moment I am mainly interested in cross-compiling and wanting to
> target 32-bit linux, but obviously 64-bit will be useful in the future.
> Would like to get some advice on what to install and any kernel
> configuration or module loading that I might need to do.

This should be well documented elsewhere, if i remember correctly:

on kernel, add the options:

options         LINPROCFS
options         COMPAT_43
options         COMPAT_LINUX32


Install the emulators/linux_base-8 port

and enable on rc.conf

linux_enable="YES"


After that you should have a running linux enviroment

$ /compat/linux/bin/bash
$ uname -a
Linux moonlight 2.4.2 FreeBSD 5.3-STABLE #0: Thu Feb  3 23:08:02 CST 2005 
amd64 amd64 amd64 GNU/Linux


Then, the real thing, the cross compile

NOTE: At this point I'm guessing, tell us if it works ;)

Get a GCC RPM and install it (check the Makefile on the linux port, to see the 
flags it uses, and see you dont overwrite system GCC)

Maybe some extra RPMs.. make, libtool etc

Run gcc from the linux bash (check the path to be sure its really using 
linux's gcc)

*IF* this work, you should be able to compile and run linux32 programs (you 
using a linux compiler right ?)

For linux64, well first step is to get binaries working



More information about the freebsd-amd64 mailing list