views:

864

answers:

3

Hi there, Was someone able to compile the Bochs simulator under Snow Leopard. Leopard worked fine for me but under Snow Leopard I get alot of problems related to the Carbon library...

Ok, some more information was request.

  • I compile with make on the shell; stanard build process coming with the bochs sources
  • I was successfully able to compile against the 10.5 SDK. Unfortunatley, it was not running under Snow Leopard... always crashed
  • then I installed the latest XCode from the SnowLeopard CD and compiled against the 10.6 SDK; withot changing nothing but the isysroot flag to point to the 10.6 instead of 10.5 now the compiler has problems to find some carbon headers... (-framework Carbon is included as a parameter to g++)

Here the error... it fails when it comes to compiling the carbon-based gui for bochs:

g++ -c  -I.. -I./.. -I../iodev -I./../iodev -I../instrument/stubs -I./../instrument/stubs -pipe -O3 -isysroot /Developer/SDKs/MacOSX10.6.sdk -framework Carbon -fomit-frame-pointer -finline-functions -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -fprefetch-loop-arrays  -fpascal-strings -fno-common -Wno-four-char-constants -Wno-unknown-pragmas -Dmacintosh -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES    carbon.cc -o carbon.o
carbon.cc:154: warning: non-local variable ‘<anonymous enum> last_screen_state’ uses anonymous type
carbon.cc:154: warning: non-local variable ‘<anonymous enum> screen_state’ uses anonymous type
carbon.cc:163: error: ‘CIconHandle’ does not name a type
carbon.cc: In function ‘OSStatus CEvtHandleWindowBackdropUpdate(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*)’:
carbon.cc:278: error: ‘GetWindowPortBounds’ was not declared in this scope
carbon.cc:279: error: ‘BackColor’ was not declared in this scope
carbon.cc:280: error: ‘EraseRect’ was not declared in this scope

... many more undeclared xxx errors

thanks in advance Mac

+1  A: 

Snow Leopard compiles 64-bit by default, but GUI Carbon apps have to be 32-bit.

Chuck
+2  A: 

First, you'll have to run "make dist-clean" to get rid of some of the library code which will have compiled successfully in 64-bit mode - this isn't deleted by a regular "make clean", only the more radical dist-clean. Otherwise, your build will try to mix 32 and 64 bit code, which doesn't work.

Now set CFLAGS and CXXFLAGS to contain the -m32 switch to force 32 bit mode. Re-run ./configure, then make, and you should get a working 'bochs' binary.

Having got past the build problems, though, you'll probably find the Carbon version no longer runs; the X11 version seems to be a better bet. (At least, on my Snow Leopard system, the Carbon build fails early with an assertion failure; X11 works as expected.) You may be able to get a 64 bit X11 build running, without the Carbon dependency, but I haven't tried this yet, only 32 bit.

Are you sure it's `dist-clean` and not `distclean`?
Peter Hosey
Peter: Oddly, yes, it is indeed "dist-clean" with the hyphen; like you, I was expecting it to be distclean, which is what I've seen in other projects, but that didn't exist.
+2  A: 

In addition to James said (adding the -m32 switch), you may need to add "-arch i386" too.

Here's a modified conf file that I used to build:

set echo
CFLAGS="-arch i386 -m32 -pipe -O3 -I/sw/include -fomit-frame-pointer -finline-functions -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -fprefetch-loop-arrays $CFLAGS"
CPATH="/sw/include"
CPPFLAGS=""
CXXFLAGS="$CFLAGS"
LDFLAGS="-arch i386 -m32 -L/sw/lib"
CXX="g++ -arch i386 -m32"

export CFLAGS
export CPATH
export CPPFLAGS
export CXXFLAGS
export LDFLAGS
export CXX

./configure --enable-sb16 \
     --enable-ne2000 \
     --enable-all-optimizations \
            --enable-cpu-level=6 \
            --enable-x86-64 \
            --enable-sse=2 \
            --enable-pci \
            --enable-acpi \
            --enable-debugger \
            --enable-clgd54xx \
            --enable-usb \
     --enable-plugins \
     ${CONFIGURE_ARGS}
lallous