在 Mac os x Snow Leopard 上编译 Bochs

发布于 2024-08-10 06:21:10 字数 1603 浏览 16 评论 0原文

有人能够在 Snow Leopard 下编译 Bochs 模拟器吗? Leopard 对我来说工作得很好,但在 Snow Leopard 下我遇到了很多与 Carbon 库相关的问题......

好吧,需要更多信息。

  • 我在 shell 上使用 make 进行编译; bochs 源附带的标准构建过程
  • 我能够成功地针对 10.5 SDK 进行编译。不幸的是,它没有在 Snow Leopard 下运行...总是崩溃,
  • 然后我从 SnowLeopard CD 安装了最新的 XCode 并针对 10.6 SDK 进行了编译;除了 isysroot 标志指向 10.6 而不是 10.5 之外什么都不改变,现在编译器在查找一些碳标头时遇到问题...(-framework Carbon 作为 g++ 的参数包含在内)

这里错误...它失败为 bochs 编译基于碳的 GUI:

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

...还有更多未声明的 xxx 错误,

提前致谢 苹果

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

静谧 2024-08-17 06:21:10

我终于能够自己完成这个任务,但是比我预想的要多花一些功夫。 Bochs 的安装可能有点不稳定,即使在 Linux 上也是如此。

注意

忘记尝试使用 Carbon 进行编译。 Apple 正在弃用它,您将无法使用它编译 64 位应用程序(Mac OS X 的默认设置)。 http://appleinsider.com/articles/12/02/18/mountain_lion_focuses_on_cocoa_drops_x11_and_deprecates_carbon

顺便说一句,Bochs 团队不使用 Mac OS X,可能不会解决这个问题。这可能是您帮助开源项目的机会:http://sourceforge.net/p/ bochs/bugs/1204/

也就是说,您应该能够通过一些调整来使用 SDL 支持进行编译。

安装 SDL 1.2 库

我永远无法从 http://www.libsdl.org 获取 SDL 库以正常工作,所以我使用 Homebrew -- http://brew.sh -- 来安装它:

brew install sdl

配置 Bochs

我喜欢配置 Bochs使用调试器(用于操作系统开发),我喜欢将其安装到我的主目录中(以防我想删除它)。以下是我使用的配置命令:

./configure --enable-ne2000 \
            --enable-all-optimizations \
            --enable-cpu-level=6 \
            --enable-x86-64 \
            --enable-vmx=2 \
            --enable-pci \
            --enable-usb \
            --enable-usb-ohci \
            --enable-e1000 \
            --enable-debugger \
            --enable-disasm \
            --disable-debugger-gui \
            --with-sdl \
            --prefix=$HOME/opt/bochs

请注意,我添加了 --disable-debugger-gui,因为如果您选择启用调试器,它会默认启用。然而,由于调试器 GUI 依赖于 GTK+,并且默认情况下 Mac OS X 上并未安装 GTK+,因此您需要禁用它(GTK+ 是您不想处理的另一种蠕虫)。

构建和安装 Bochs

接下来,构建和安装

make
make install

最后,只需设置 BXSHARE 环境变量并更新路径:

export BXSHARE="$HOME/opt/bochs/share/bochs"
export PATH="$PATH:$HOME/opt/bochs/bin"

I was finally able to accomplish this myself, but it took a little more work than I expected. Bochs can be a little temperamental to install, even on Linux.

Note

Forget about attempting to compile with Carbon. Apple is deprecating it and you won't be able to compile applications in 64-bit with it (the default for Mac OS X). http://appleinsider.com/articles/12/02/18/mountain_lion_focuses_on_cocoa_drops_x11_and_deprecates_carbon

BTW, the Bochs team doesn't use Mac OS X and probably won't be fixing this issue. This could be your chance to help an open source project: http://sourceforge.net/p/bochs/bugs/1204/

That said, you should be able to compile with SDL support with a little tweaking.

Install the SDL 1.2 Library

I could never get the SDL library from http://www.libsdl.org to work correctly, so I used Homebrew -- http://brew.sh -- to install it:

brew install sdl

Configure Bochs

I like to configure Bochs with the debugger (for OS development) and I like to install it into my home directory (in case I want to delete it). Here is the configure command I use:

./configure --enable-ne2000 \
            --enable-all-optimizations \
            --enable-cpu-level=6 \
            --enable-x86-64 \
            --enable-vmx=2 \
            --enable-pci \
            --enable-usb \
            --enable-usb-ohci \
            --enable-e1000 \
            --enable-debugger \
            --enable-disasm \
            --disable-debugger-gui \
            --with-sdl \
            --prefix=$HOME/opt/bochs

Please note that I added --disable-debugger-gui because it is enabled by default if you choose to enable the debugger. However, since the debugger GUI relies on GTK+, and that isn't installed by default on Mac OS X, you want to disable it (GTK+ is another can of worms you don't want to deal with).

Building and Installing Bochs

Next, build and install

make
make install

Finally, just set your BXSHARE environment variable and update your path:

export BXSHARE="$HOME/opt/bochs/share/bochs"
export PATH="$PATH:$HOME/opt/bochs/bin"
放飞的风筝 2024-08-17 06:21:10

除了 James 所说的(添加 -m32 开关)之外,您可能还需要添加“-arch i386”。

这是我用来构建的修改后的conf文件:

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}

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}
因为看清所以看轻 2024-08-17 06:21:10

首先,您必须运行“make dist-clean”来删除一些在 64 位模式下成功编译的库代码 - 这不会被常规的“make clean”删除,只会删除更多彻底的分布式清理。否则,您的构建将尝试混合 32 位和 64 位代码,这是行不通的。

现在设置 CFLAGS 和 CXXFLAGS 以包含 -m32 开关以强制使用 32 位模式。重新运行 ./configure,然后 make,您应该会得到一个工作的“bochs”二进制文件。

不过,解决了构建问题后,您可能会发现 Carbon 版本不再运行; X11版本似乎是更好的选择。 (至少,在我的 Snow Leopard 系统上,Carbon 构建会因断言失败而提前失败;X11 按预期工作。)您也许能够在没有 Carbon 依赖的情况下运行 64 位 X11 构建,但我还没有尝试过这还只是 32 位。

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.

没有心的人 2024-08-17 06:21:10

Snow Leopard 默认编译 64 位,但 GUI Carbon 应用程序必须是 32 位。

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

何时共饮酒 2024-08-17 06:21:10

mac最简单的方法是..

brew install home/x11/bochs

我尝试了其他方法很长时间..并且失败了..
MacOS X 10.11 下

Easiest way for mac is ....

brew install home/x11/bochs

I Tried other way for long times..And Failed..
Under MacOS X 10.11

昵称有卵用 2024-08-17 06:21:10

如果您想在 64 位 Mac 上运行 Bochs,则需要使用不同的 GUI 库。我建议使用 X 或 SDL。

雪迪龙:
为此,首先从 http://www.libsdl.org/download 下载并安装 LibSDL -1.2.php,您将需要二进制文件和开发库。

提取 Bochs 源文件后,运行 ./configure --with-sdl=path-to-libsdl-dev-files

X11:
它应该开箱即用: ./configure --with-x11 &&制作

If you want to run Bochs on a 64-bit Mac, you will need to use a different GUI library. I recommend using X or SDL.

SDL:
To do so, first download and install the LibSDL from http://www.libsdl.org/download-1.2.php, you will need the binaries and development libraries.

After extracting the Bochs source files, run ./configure --with-sdl=path-to-libsdl-dev-files.

X11:
It should build out of the box: ./configure --with-x11 && make

请爱~陌生人 2024-08-17 06:21:10

@user6779

确保您不使用创建的平面unix二进制文件,而是使用Mac OS捆绑包(称为bochs.app)。

例如,从终端:

./bochs.app/Contents/MacOS/bochs

您将不再收到该断言。

@user6779

Make sure you do not use the flat unix binary that is created, but rather the Mac OS bundle (called bochs.app).

Eg from the terminal:

./bochs.app/Contents/MacOS/bochs

And you will no longer receive that assertation.

眼眸印温柔 2024-08-17 06:21:10

这就是我在 MacOS X 10.10 下使用 Xcode7 开发工具和 XQuarz 2.7.7 的工作方式

export CFLAGS=-I/opt/X11/include
export CXXFLAGS=-I/opt/X11/include
export LDFLAGS=-L/opt/X11/lib -lX11
./configure   --enable-debugger --enable-debugger-gui   --enable-all-optimizations    --enable-x86-debugger   --enable-ne2000   --enable-e1000  --enable-pnic   --with-x11  --without-carbon
make
sudo make install

This how it worked for me under MacOS X 10.10 with Xcode7 developer tools and XQuarz 2.7.7

export CFLAGS=-I/opt/X11/include
export CXXFLAGS=-I/opt/X11/include
export LDFLAGS=-L/opt/X11/lib -lX11
./configure   --enable-debugger --enable-debugger-gui   --enable-all-optimizations    --enable-x86-debugger   --enable-ne2000   --enable-e1000  --enable-pnic   --with-x11  --without-carbon
make
sudo make install
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文