从Windows转至Ubuntu 16.04 LTS x64,编译Bochs 2.6.9无法安装调试器求助
Hey there! I totally get how frustrating it is when you build a tool you need but end up missing a critical feature like the debugger—especially when you're still getting used to Ubuntu after coming from Windows. Let's walk through exactly how to compile Bochs with its debugger enabled, step by step.
Step 1: Install Required Dependencies
First, you'll need to install the build tools and libraries Bochs needs to compile the debugger (and GUI support, if you want it). Open a terminal and run:
sudo apt-get update && sudo apt-get install build-essential libgtk2.0-dev libncurses5-dev
build-essentialgives you gcc, make, and other basic compiling tools.libgtk2.0-devenables the GUI debugger interface.libncurses5-devsupports the terminal-based debugger if you prefer that.
Step 2: Clean Up Previous Builds (If Needed)
If you've already tried compiling Bochs without the debugger, make sure to wipe the old build files first to avoid leftover configuration issues:
cd bochs-2.6.9 # Navigate to your Bochs source directory make clean rm -rf config.log config.status Makefile
Step 3: Configure Bochs with Debugger Enabled
This is the most important part—you must pass specific flags to ./configure to enable the debugger. Run this command in your Bochs source directory:
./configure --enable-debugger --enable-disasm --with-x11 --with-gtk
Let's break down these flags:
--enable-debugger: Turns on Bochs' built-in debugger (this is the flag you were missing!).--enable-disasm: Adds disassembly support, which is essential for debugging assembly code.--with-x11 --with-gtk: Enables the GUI debugger interface. If you only want a terminal-based debugger, replace these with--with-ncurses.
Step 4: Compile and Install
Now compile Bochs (using multiple cores to speed things up):
make -j$(nproc)
Once compiling finishes, install it:
sudo make install
Step 5: Verify the Debugger Works
Open a terminal and run bochs. You should see a menu that includes a "debug" option. Select it, and you'll enter the Bochs debugger where you can use commands like s (step), c (continue), info registers, and more to debug your code.
If you want to skip the menu and jump straight to the debugger, run:
bochs -q
内容的提问来源于stack exchange,提问作者Frank

