iCoder.ME

C, C++, Emacs lisp and more…

Mac OS X下编译安装带debugger的bochs

bochs支持两种方式的debugger:(1)自带的debugger(internal debugger); (2)使用gdb-stub方式来debug.
但是这两种方式不兼容,编译的时候只能选其一.

下面介绍如何在Mac OS X上编译安装带有debugger的bochs:

直接修改配置文件:.conf.macosx
在CFLAGS、LDFLAGS、CXX里增加”-arch i386 -m32″.
完整写法如下:

set echo
CFLAGS="-arch i386 -m32 -pipe -O3 -I/sw/include -fomit-frame-pointer -finline-functions -falign-loops=16 -falign-jum\
ps=16 -falign-functions=16 -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -fprefetch-loop-arr\
ays $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-gdb-stub”或”–enable-debugger –enable-disasm”.

生成makefile: sh .conf.macosx

编译:make

简单说下,如果不加-arch i386 -m32 在64位Mac下会编译失败,google了下,说的原因是由于虽然系统是64位的,但Carbon库只有3\
2位的因此导致不兼容.

4 responses to “Mac OS X下编译安装带debugger的bochs

  1. alex 2011/02/26 at 01:50

    are you sure the compiled bochs really can work? or only complied

    • wuxicn 2011/02/27 at 22:40

      Yes, it works for me very well.
      Have you “make install”? It will install some needed files in your install-path. Then you can run either “bochs.app” in GUI or “bochs.app/Contents/MacOS/bochs” in Terminal.

  2. freeZn 2011/05/09 at 22:42

    你好 我按照你的方法编译bochs 编译通过了 生成了bochs.app 但是每次运行都报错意外退出 不知道是怎么回事?我记得我好像在一个文档上面看说MAC OSX版本的 bochs需要一些额外的库还是什么 官方文档我也看了 没有找到有用的信息 我这边用make install倒是下载了一个叫dlxlinux4.tar.gz的东西 但是下载完成后的步骤就报错了 请问我在make了以后还需要做什么 编译这个具体过程中还有哪些步骤?多谢~

  3. freeZn 2011/05/09 at 22:51

    实在抱歉 我又仔细的对比了一下.conf.macosx的内容 发现我有几句话遗漏了 现在已经可以运行了 非常感谢你的文章

Leave a comment