ubuntu源码级安装bochs

来源:互联网 发布:堆排序算法 编辑:程序博客网 时间:2024/05/16 00:45

ubuntu下sudo apt-get install bochs安装的bochs默认是不带调试功能的,所以我们需要手动编译源码加入调试功能!

 

我的步骤如下:

sudo apt-get install vgabios  bochs-x bximage  

sudo aptitude install xorg-dev

sudo apt-get source bochs

或者http://bochs.sourceforge.net/ 下载最新的源码并解压

linux环境下编译安装软件常见的错误是缺少某个库导致的,这里我们先不管bochs安装过程中会需要哪些库,待到编译安装时根据提示各个安装便可。

 

源码下载之后,解压,切换到源码主目录

./configure --with-x11 --with-wx --enable-debugger --enable-disasm --enable-all-optimizations --enable-readline --enable-long-phy-address --enable-debugger-gui


其中--enable-debugger 和 --enable-disasm便是打开调试功能的开关!

如果是64位系统上编译bochs,一定要加上--enable-long-phy-address选项,否则运行中会出现bochs exception(): 3rd (13) exception with no resolution, shutdown status is

 

接下来是编译和安装

sudo make; sudo make install


安装过程中会根据每个人系统环境的不同提示不同的错误,常见的错误以及解决办法如下:

  1. checking for C compiler default output file name… configure: error: C compiler cannot create       executables
    sudo apt-get install  build-essential libc6-dev
  1. ERROR: X windows gui was selected, but X windows libraries were not found.
    sudo apt-get install xorg-dev libgtk2.0-dev
  1. install: cannot stat `./bios/VGABIOS*': 
    在源码的bios目录下(/xxxx/bochs-2.5.1/bios),建立符号链接ln -s /usr/share/vgabios/vgabios.bin VGABIOS-lgpl-latest
  1. undefined reference to 'XStringToKeysym'
    configure时加上--with-x11,--with-x11 --with-wx --enable-debugger --enable-disasm --enable-all-optimizations --enable-readline --enable-long-phy-address --enable-debugger-gui
  1. 如果configure时,提示--with-wx有问题,sudo apt-get install libwxgtk2.8-dev libx11-xcb-dev

 当然,你可能遇到的问题上面没有列出,先判断是系统缺少库还是其他的什么错误,反正针对错误一步一步解决就好!

 

我们这样编译生成的bochs在/usr/local/bin下,如果是通过sudo apt-get install bochs安装的bochs默认放在/usr/bin目录下,那么我们运行bochs时运行的是哪个呢?

看看系统的PATH环境变量:

astrol@astrol:~/bochs-2.4.6$ echo $PATH/opt/skyeye/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games


明显的,/usr/local/bin的优先级比/usr/bin的高,所以运行的是我们编译生成的bochs

我们可以利用这个特性,将/usr/local/bin下的bochs重命名为bochsdbg,那么当我们想debug时就可以用bochsdbg,不想debug时就直接bochs即可,很方便 ^_^

 

参考链接:

http://blog.csdn.net/undeadwraith/article/details/6312456

http://blog.csdn.net/ruyanhai/article/details/7197261

http://www.cnblogs.com/zhy113/archive/2013/04/03/2881162.html

原创粉丝点击