Ubuntu下安装Bochs各种奇怪错误汇总

(1) 出现

1 “ERROR: X windows gui was selected, but X windows libraries were not found.

解决办法:

1 sudo apt-get install libx11-dev xserver-xorg-dev xorg-dev

如果还不能解决,请尝试重新安装为2.4.5版本,我在2.3.5版本下尝试了好久,最终换为2.4.5版本一下就成功了。

 

(2) 出现

1 “ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package. Install pkg-config and the gtk+ development package, or disable the gui debugger, or the wxWidgets display library (whichever is being used).”

2 ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package.Install pkg-config and the gtk+ development package,or disable the gui debugger, or the wxWidgets display library (whichever is being used)

解决办法:

1 sudo apt-get install libgtk2.0-dev

(3)

1 checking for C compiler default output file name… configure: error: C compiler cannot create executables

解决方法:

1 apt-get install libc6-dev

(4)

1 configure: error: C++ preprocessor "/lib/cpp" fails sanity check

解决方法:

1 apt-get install build-essential

(5)

1 X windows gui was selected, but X windows libraries were not found.

解决方法:参照04年课程论坛上的解决方法,配置的时候加上–with-nogui


Bochs启动程序

1安装过程:

        

tar xzvf bochs-2.3.5.tar.gz

cd bochs-2.3.5

./configure --enable-debugger --enable--disasm 

make
出现问题:
symbols.cc: At global scope:
      symbols.cc:137: error: ISO C++ forbids declaration of ‘hash_map’ with no type

symbols.cc:137: error: expected ‘;’ before ‘<’ token

symbols.cc:145: error: expected constructor, destructor, or type conversion before ‘<’ token
      symbols.cc: In constructor ‘context_t::context_t(Bit32u)’:
      symbols.cc:152: error: ‘map’ was not declared in this scope
      symbols.cc: In static member function ‘static context_t* context_t::get_context(Bit32u)’:
      symbols.cc:173: error: ‘map’ was not declared in this scope 
      make[1]: *** [symbols.o] Error 1  
     make: *** [bx_debug/libdebug.a] Error 2
解决方法:    
在做make 之前, 需要在bx_debug/symbols.cc 的97『具体版本可能不一样』 行之后加上一些代码,加后如下所示:

using namespace std;

#ifdef __GNUC__  ( 新加的,注意前后都是两个下划线 )

using namespace __gnu_cxx; ( 新加的,注意前面是两个下划线 )

#endif  ( 新加的)

struct symbol_entry_t;


当启用bochs 的debugger时,配置./configure --enable-debugger后make就出现下面的错误:

gui/libgui.a(gtk_enh_dbg_osdep.o): In function `MakeGTKthreads()':
/home/bcos/Desktop/bochs-test/bochs-2.4.pre1/gui/gtk_enh_dbg_osdep.cc:2120: undefined reference to `pthread_create'
collect2: ld returned 1 exit status
make: *** [bochs] Error 1

解决方法1:修改"Makefile.in" 92 和 93行 为 "CC = @CC@ -pthread" and "CXX = @CXX@ -pthread"

解决方法2:在Makefile.in中183行

bochs@EXE@: @IODEV_LIB_VAR@ @DEBUGGER_VAR@ \
cpu/libcpu.a memory/libmemory.a gui/libgui.a \
@DISASM_VAR@ @INSTRUMENT_VAR@ $(BX_OBJS) \
$(SIMX86_OBJS) @FPU_VAR@ @GDBSTUB_VAR@ @PLUGIN_VAR@
@LINK@ @EXPORT_DYNAMIC@ $(BX_OBJS) $(SIMX86_OBJS) \
@IODEV_LIB_VAR@ @DEBUGGER_VAR@ cpu/libcpu.a memory/libmemory.a gui/libgui.a \
@DISASM_VAR@ @INSTRUMENT_VAR@ @PLUGIN_VAR@ \
@GDBSTUB_VAR@ @FPU_VAR@ \
@NONPLUGIN_GUI_LINK_OPTS@ \
$(MCH_LINK_FLAGS) \
$(SIMX86_LINK_FLAGS) \
$(READLINE_LIB) \
$(EXTRA_LINK_OPTS) \
$(LIBS)

在最后$(LIBS)后面加上 \ -lpthread如下:

bochs@EXE@: @IODEV_LIB_VAR@ @DEBUGGER_VAR@ \
cpu/libcpu.a memory/libmemory.a gui/libgui.a \
@DISASM_VAR@ @INSTRUMENT_VAR@ $(BX_OBJS) \
.
.
.
$(LIBS)\
-lpthread

即可编译通过。

 

注意:Makefile.in就是用于configure来生成Makefile的,所以修改这个文件后,

需要重新执行:./configure --enable-debugger 来生成Makefile,

如果是在configure后修改Makefile.in,然后执行make,这个时候的Makefile还是编译出错。


# how much memory the emulated machine will have
megs: 32
# filename of ROM images
romimage:file=$BXSHARE/BIOS-bochs-latest
#注意上面这一行,2.3.5以后的后面不能加,address=0xf0000  否则会出现
#Message: ROM: System BIOS must end at 0xfffff 错误的  这个后面会解释
#romimage: file=mybios.bin, address=0xfff80000 # 512k at memory top
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
                                                                               
# what disk images will be used
floppya: 1_44=a.img, status=inserted
#ata0-master: type=disk, mode=flat, path="30M.sample"
# hard disk
#ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
#ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
#ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
#ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
boot: floppy
log: bochsout.txt
mouse: enabled=0
floppya: 1_44=a.img, status=inserted
keyboard_mapping: enabled=1, map=/usr/local/share/bochs/keymaps/x11-pc-us.map

  • 6
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是在Ubuntu安装Bochs的步骤: 1. 打开终端,输入以下命令以安装Bochs: ``` sudo apt-get install bochs bochs-x bochs-sdl ``` 2. 安装完成后,可以通过以下命令检查Bochs是否已经成功安装: ``` bochs -help ``` 如果出现了Bochs的帮助信息,则说明Bochs已经成功安装。 3. 接下来,可以通过以下命令启动Bochs: ``` bochs ``` 这将启动Bochs模拟器,并进入Bochs的命令行界面。 4. 如果需要使用Bochs来运行操作系统,则需要为Bochs配置一个虚拟机。可以通过创建一个Bochsrc文件来配置虚拟机。以下是一个简单的Bochsrc文件示例: ``` # configuration file generated by Bochs # http://bochs.sourceforge.net/ # how much memory the emulated machine will have megabytes: 32 # filename of ROM image romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000 # boot from floppy disk image boot: floppy # filename of floppy disk image floppy: 1_44=a.img, status=inserted # enable VGA graphics card vga: extension=vbe, update_freq=5 # enable sound card sb16: enabled=1, irq=7, dma=1, hdma=5, sbtype=sb16, sbbase=0x220, midi=none # enable network card ne2k: ioaddr=0x300, irq=9, mac=fe:fd:00:00:00:01, ethmod=linux # enable serial port com1: enabled=1, mode=term # enable parallel port lpt1: enabled=1 # enable keyboard keyboard: type=mf # enable mouse mouse: enabled=1 ``` 在这个示例中,Bochs将会模拟一台拥有32MB内存、启动盘为a.img、使用VGA显卡、SB16声卡、NE2000网卡、COM1串口、LPT1并口、MF键盘和鼠标的虚拟机。 5. 将Bochsrc文件保存到任意位置,并在启动Bochs时指定该文件的路径: ``` bochs -f /path/to/bochsrc ``` 这将启动Bochs,并使用指定的Bochsrc文件来配置虚拟机。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值