Michael Grigoriev contributed the following guide to cross compiling. This is useful if you want to develop at home, e.g. using Bochs.
I spent some time getting cs452 stuff compiling and running under bochs on my Linux/x86 laptop. If you want to use C++ in your project (as opposed to sticking to plain C), looks like you have to build a cross compiler to get a version of libstdc++ for i586-elf (thanks to Stefanus for suggesting this). It is also useful to have a cross compiler because i686-pc-linux-gnu (which is what my native gcc is compiled for) appears to be sufficiently different from i586-elf that the supplied ld scripts don't work with it.
Anyway, here is what I did. It worked for me, but your mileage may vary.
tar jxvf binutils-2.14.90.0.8.tar.bz2 tar zxvf newlib-1.12.0.tar.gz tar jxvf gcc-3.3.4.tar.bz2 mkdir binutils-build cd binutils-build ../binutils-2.14.90.0.8/configure --prefix=$HOME/i586-elf \ --target=i586-elf --disable-nls make make install mkdir gcc-build cd gcc-build/ export PATH=$PATH:$HOME/i586-elf/bin/ ../gcc-3.3.4/configure --prefix=$HOME/i586-elf --target=i586-elf \ --enable-languages=c,c++ --with-gnu-ld --with-gnu-as --disable-nls \ --with-newlib --disable-shared --enable-multilib=no \ --with-headers=../newlib-1.12.0/newlib/libc/include/ make make install mkdir newlib-build cd newlib-build ../newlib-1.12.0/configure --prefix=$HOME/i586-elf/ --target=i586-elf \ --enable-newlib-hw-fp make all make install scp -r uw:/u3/cs452/i586-3.3.3/include/cs452 $HOME/i586-elf/include/
Then adjusted your Makefile to include something along the lines of:
ifeq ($(shell uname), Linux) CS452DIR=/home/mag/i586-elf CCVER=3.3.4 else CS452DIR=/u3/cs452/i586-3.3.3 CCVER=3.3.3 endif CFLAGS = -nostdinc -nostdinc++ -nodefaultlibs -nostdlib CFLAGS += -O6 -Wall -I. -I$(CS452DIR)/include \ -I$(CS452DIR)/i586-elf/include -I$(CS452DIR)/include/cs452 \ -I$(CS452DIR)/lib/gcc-lib/i586-elf/$(CCVER)/include/ LDFLAGS = -L$(CS452DIR)/lib -lstdc++ -lc -lgcc
Now remember to add $HOME/i586-elf/bin/ to your path, and you should be able to compile, link and run Hello World on your own box!
Note: My a1 does not seem to work in bochs. I suspect this is probably because it is trying to initialize com2 which does not exist in bochs, but I haven't spent too much time trying to figure it out.