在ubuntu 18.04上编译VirtualBox

源码下载地址:

https://download.virtualbox.org/virtualbox/

当然这个也可以

https://www.virtualbox.org/wiki/Download_Old_Builds

我下载了这个5.2.18

https://download.virtualbox.org/virtualbox/5.2.18/VirtualBox-5.2.18.tar.bz2

linux下的编译文档

https://www.virtualbox.org/wiki/Linux%20build%20instructions

libhal-dev和python-central没找到,就先不安装了

1
2
3
4
5
6
7
8
9
10
11
sudo apt-get install gcc g++ bcc iasl xsltproc uuid-dev zlib1g-dev libidl-dev \
libsdl1.2-dev libxcursor-dev libasound2-dev libstdc++5 \
libpulse-dev libxml2-dev libxslt1-dev \
python-dev libqt4-dev qt4-dev-tools libcap-dev \
libxmu-dev mesa-common-dev libglu1-mesa-dev \
linux-kernel-headers libcurl4-openssl-dev libpam0g-dev \
libxrandr-dev libxinerama-dev libqt4-opengl-dev makeself \
libdevmapper-dev default-jdk \
texlive-latex-base \
texlive-latex-extra texlive-latex-recommended \
texlive-fonts-extra texlive-fonts-recommended

64位系统还要装一下

1
2
sudo apt-get install lib32z1 libc6-dev-i386 lib32gcc1 gcc-multilib \
lib32stdc++6 g++-multilib

链接共享库

1
2
3
4
5
6
sudo ln -s libX11.so.6    /usr/lib32/libX11.so 
sudo ln -s libXTrap.so.6 /usr/lib32/libXTrap.so
sudo ln -s libXt.so.6 /usr/lib32/libXt.so
sudo ln -s libXtst.so.6 /usr/lib32/libXtst.so
sudo ln -s libXmu.so.6 /usr/lib32/libXmu.so
sudo ln -s libXext.so.6 /usr/lib32/libXext.so

./configure来发现还有东西没装

1
sudo apt-get install libssl-dev libvpx-dev libopus-dev

之后就是qt5 not found,上面的qt4费了

1
2
Checking for Qt5: 
** qt5 not found!

安装qt5

1
sudo apt-get install build-essential qtcreator qt5-default libqt5*

编译的时候有错误

我就发现kmk可以-i忽略错误

1
kmk BUILD_TYPE=debug -i

之后就ko了

直接启动即可

自愿打赏专区