VirtualBox Guest Additions 编译和 iso 打包

VirtualBox Guest Additions compilation and iso packing

我正在根据官方 documentation 编译 VirtualBox Guest Additions。分别构建 64 位和 32 位添加并尝试将其打包到 iso 映像中。

目标系统是 Windows 7 x64。根据文档的所有软件要求,包括确切的版本。只应构建添加项(LocalConfig.kmk 中的VBOX_ONLY_ADDITIONS := 1

32位编译不设置目标正常

call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 /win7
set BUILD_TARGET_ARCH=x86
set PATH=%PATH%;%~dp0kBuild\bin\win.x86
cscript configure.vbs --with-DDK=C:\WinDDK00.16385.1 --with-MinGW-w64=C:\mingw\mingw64 --with-MinGW32=C:\mingw\mingw32 --with-libSDL=C:\SDL\x86\SDL-1.2.15 --with-openssl=C:\OpenSSL\x32 --with-libcurl=C:\curl\x86 --with-Qt5=C:\Qt.6.3\x86\msvc2010 --with-python=C:/Python27
call env.bat
kmk

64位编译也没有设置目标

call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /win7
set BUILD_TARGET_ARCH=amd64
set PATH=%PATH%;%~dp0kBuild\bin\win.amd64
cscript configure.vbs --with-DDK=C:\WinDDK00.16385.1 --with-MinGW-w64=C:\mingw\mingw64 --with-MinGW32=C:\mingw\mingw32 --with-libSDL=C:\SDL\x64\SDL-1.2.15 --with-openssl=C:\OpenSSL\x64 --with-openssl32=C:\OpenSSL\x32 --with-libcurl=C:\curl\x64 --with-libcurl32=C:\curl\x86 --with-Qt5=C:\Qt.6.3\x64\msvc2010 --with-python=C:/Python27
call env.bat
kmk

尝试构建 x86 添加项(根据 Makefile.kmk 中的评论,必须在 x64 之前构建)

kmk additions-build-win.x86

...出现错误

kBuild: Creating C:/Users/atatat/Projects/virtualbox/VirtualBox-5.2.2/out/win.x86/release/bin/additions/VBoxWHQLFake.exe
C:/Users/atatat/AppData/Local/Temp/make3416-1.sh: 1: Syntax error: "(" unexpected
kmk.exe[1]: *** [C:/Users/atatat/Projects/virtualbox/VirtualBox-5.2.2/out/win.x86/release/bin/additions/VBoxWHQLFake.exe] Error 2 (0x2)
kmk.exe[1]: Leaving directory `C:/Users/atatat/Projects/virtualbox/VirtualBox-5.2.2'
kmk_time: 0m2.823600s - exit code: 2
kmk: *** [additions-build-win.x86] Error 2 (0x2)

尝试构建 x64 版本时出现同样的错误:kmk additions-build-win.amd64

我的LocalConfig.kmk

VBOX_WITH_HARDENING :=
VBOX_PATH_WIX := C:\wix
VBOX_GSOAP_INSTALLED := 1
VBOX_PATH_GSOAP := C:\gsoap\gsoap-2.8\gsoap
VBOX_WITH_COMBINED_PACKAGE := 1
VBOX_WITH_QT_PAYLOAD := 1
VBOX_WITH_QTGUI_V5 := 1
VBOX_SIGNING_MODE := release
VBOX_TSA_URL := http://timestamp.digicert.com
VBOX_TSA_SHA2_URL := http://timestamp.digicert.com
VBOX_TSA_URL_ARGS := /t "$(VBOX_TSA_URL)"
VBOX_TSA_SHA2_URL_ARGS := /tr "$(VBOX_TSA_SHA2_URL)" /td sha256
VBOX_PATH_SIGN_TOOLS := C:\Program Files (x86)\Windows Kits.1\bin\x64
VBOX_PATH_SELFSIGN := C:\WinDDK00.16385.1\bin\selfsign
VBOX_PATH_WISUMINFO := "C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\sysmgmt\msi\scripts\WiSumInf.vbs"
VBOX_PATH_WISUBSTG  := "C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\sysmgmt\msi\scripts\WiSubStg.vbs"
VBOX_WITH_DOCS := 1
VBOX_WITH_DOCS_CHM := 1
VBOX_WITH_DOCS_PACKING := 1
VBOX_HAVE_XMLLINT := C:\xmllint\bin\xmllint.exe
VBOX_PATH_DOCBOOK        := C:/DocBook/xsl/
VBOX_PATH_DOCBOOK_DTD    := C:/DocBook/xml/
VBOX_XML_CATALOG         := $(PATH_TARGET)/manual/catalog
VBOX_XML_CATALOG_DOCBOOK := $(PATH_TARGET)/manual/docbook
VBOX_PATH_HTML_HELP_WORKSHOP := "C:\Program Files (x86)\HTML Help Workshop"
VBOX_PDFLATEX := "C:\Program Files\MikTeX\texmfs\install\miktex\bin\pdflatex.exe"
VBOX_PDFLATEX_CMD := $(VBOX_PDFLATEX) -halt-on-error -interaction batchmode
TOOL_CURL_FETCH := C:\curl\x64\curl.exe
PATH_TOOL_NASM := "C:\Program Files\NASM"
VBOX_INSTALLER_LANGUAGES := en_US
VBOX_WITH_TESTCASES :=
VBOX_WITH_VALIDATIONKIT :=
VBOX_WITH_VBOX_IMG := 1
VBOX_BUILD_PUBLISHER := 
VBOX_WITH_R0_LOGGING := 1
VBOX_PATH_DIFX := C:\WinDDK00.16385.1\redist\DIFx\DIFxAPI\amd64
VBOX_PATH_NSIS := C:\Program Files (x86)\NSIS

我在日志中看到的唯一错误是:

 C:/Users/atatat/AppData/Local/Temp/make3416-1.sh: 1: Syntax error: "(" unexpected

您应该查看该脚本,看看它在哪里被阻塞了。请注意,它是一个 Unix shell 脚本,因此它必须由可能与 MinGW 一起提供的 shell 来解释。

最后一点,guide(俄语)介绍了如何在 Windows 上构建 Virtualbox 及其组件。我从未尝试遵循它,但我从中学到的是,从头开始构建 VirtualBox 并不是一件容易的事。看起来现在 Oracle 对它的支持不是很好。很可能是他们的构建指令或脚本中存在错误。

实际上,我在几个月前解决了一个问题,但决定 post 解决方案 "if any"。我必须在 Temp 目录上设置一个钩子来捕捉那个难以捉摸的 *.sh 脚本,它在每次编译时都有一个新名称。

错误 Syntax error: "(" unexpected 的部分似乎是通往 Program Files (x86) 的路径。士气:尽量不要在任何其他带空格的目录的Program Files中安装依赖项,尤其是在跨平台解决方案中,使用可移植版本而不是安装程序