ubuntu2404 AMD64 编译并安装virtualbox7.0.18
0、官方参考文档:
https://www.virtualbox.org/wiki/Linux%20build%20instructions
1、下载源码:
$ wget https://download.virtualbox.org/virtualbox/7.0.18/VirtualBox-7.0.18.tar.bz2
2、安装库:
$ sudo apt install acpica-tools chrpath doxygen g++-multilib libasound2-dev libcap-dev libcurl4-openssl-dev libdevmapper-dev libidl-dev libopus-dev libpam0g-dev libpulse-dev libqt5opengl5-dev libqt5x11extras5-dev qttools5-dev
$ sudo apt install libsdl1.2-dev libsdl-ttf2.0-dev libssl-dev libvpx-dev libxcursor-dev libxinerama-dev libxml2-dev libxml2-utils libxmu-dev libxrandr-dev make nasm python3-dev python-dev-is-python3 qttools5-dev-tools
$ sudo apt install texlive texlive-fonts-extra texlive-latex-extra unzip xsltproc default-jdk libstdc++5 libxslt1-dev linux-kernel-headers makeself mesa-common-dev subversion yasm zlib1g-dev lib32z1 libc6-dev-i386 lib32gcc-s1 lib32stdc++6 pylint python3-psycopg2 python3-willow
# sudo apt install python-psycopg2 python-pil
$ sudo apt install libpng-dev
$ sudo apt install glslang-tools
$ sudo apt install docbook-xsl
3、创建软连接
先找到系统自带的64位库文件目录,我的在/usr/lib/x86_64-linux-gnu
$ sudo find /usr -iname "libX11.so.6"
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libX11.so.6 /usr/lib32/libX11.so
# sudo ln -s /usr/lib/x86_64-linux-gnu/libXTrap.so.6 /usr/lib32/libXTrap.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libXt.so.6 /usr/lib32/libXt.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libXtst.so.6 /usr/lib32/libXtst.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libXmu.so.6 /usr/lib32/libXmu.so
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libXext.so.6 /usr/lib32/libXext.so
libXTrap.so.6
ubuntu2404里没有找到这个libXTrap.so.6文件,要去下载并安装
http://mirror.nju.edu.cn/debian-archive/debian/pool/main/libx/libxtrap/
libxtrap6_1.0.0-5_amd64.deb
$ wget http://mirror.nju.edu.cn/debian-archive/debian/pool/main/libx/libxtrap/libxtrap6_1.0.0-5_amd64.deb
$ sudo ln -s /usr/lib/libXTrap.so.6 /usr/lib/x86_64-linux-gnu/libXTrap.so.6
$ sudo ln -s /usr/lib/libXTrap.so.6 /usr/lib32/libXTrap.so
4、配置和编译:
$ ./configure --disable-hardening
$ source ./env.sh
# kmk all会报错没去深究,直接放弃release版本,编译debug版本如下
$ kmk BUILD_TYPE=debug
5、运行virtualbox:
$ ./out/linux.amd64/debug/bin/VirtualBox
参考:
Linux build instructions – Oracle VM VirtualBox
Ubuntu下源码编译VirtualBox三 —— 源码编译(2)_visualbox源码分析-CSDN博客