Oct 142005
Cross compiling on AMD64 – the teaser
Cross compiling is the act of compiling for one platform (e.g. i386) when on another (e.g. AMD 64). Why is this interesting to me? I have an AMD 64 3000+ with 1GB of RAM running on an ASUS A8V Deluxe1. It’s acting as my gateway right now. Needless to say, it is very under utilized. Recently, I’ve been consolidating my machine room and getting rid of older, slower machines. As a result, the services provided by these boxes have been moved onto faster boxes. One of these services is building world. I don’t like building world on my laptop. It’s slow and too much wear and tear on a laptop drive can’t be good for it. 😉 The solution, Build world on your fast box, install on your slow box I’ve been doing that since early 2001, nearly 6 years. However, that was when everything I owned ran the same version of FreeBSD. But now I have FreeBSD 4.11 and FreeBSD 6.0-RC1 running here. I might also have FreeBSD 5.4 running soon (as a testing platform for the best backup solution. I want my AMD 64 to run in amd64 mode, not i386. And I want it to build for all those targets.1 – I erroneously reported my mainboard as an ASUS ASUS A8V-E Deluxe when I first published this article. And, for what it’s worth, this machine is no longer my gateway. – 29 December 2005
Solutions I thought about and discarded
When I first thought about this, I had a few bright ideas, all discarded.- multiple machines
- Nope. I didn’t like this one. Too much to look after and I’d like to do this all on one machine
- multi-boot
- I thought about multi-booting the system. Each time I wanted to build for 5.x, I’d boot the system into 5.x, build, and then install. That would work. But it’s ugly. I could only install for one version at a time, and builds would happen serially instead of in parallel. It would also prevent me from running other services on the box, such as a database server. I can’t be developing FreshPorts with a database server that’s not up all the time.
- jails
- I could install a jail under 6.0 and run 4.x or 5.x in that jail. That would work. But there are overheads associated with a jail. It’s like having another machine to look after.
I use ccache and distcc successfully. Just add -m32 to cflags when I need to compile i386 code on amd64.
[%sig%]