VirtualBox Guest Additions编译和iso打包

时间:2018-04-22 10:09:52

标签: c++ virtualbox kbuild

我正在根据官方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:\WinDDK\7600.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\5.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:\WinDDK\7600.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\5.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\8.1\bin\x64
VBOX_PATH_SELFSIGN := C:\WinDDK\7600.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:\WinDDK\7600.16385.1\redist\DIFx\DIFxAPI\amd64
VBOX_PATH_NSIS := C:\Program Files (x86)\NSIS

2 个答案:

答案 0 :(得分:1)

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

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

您应该查看该脚本以查看它被阻塞的位置。请注意,它是一个Unix shell脚本,所以它必须由一个可能与MinGW一起发布的shell解释。

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

答案 1 :(得分:0)

实际上,我在两个月前解决了一个问题,但是决定发布一个“如果有的话”的解决方案。我必须在Temp目录上设置一个钩子,以捕获难以捉摸的* .sh脚本,该脚本在每次编译时也都有一个新名称。

错误Syntax error: "(" unexpected的一部分似乎是Program Files (x86)的路径。士气:不要在任何其他带有空格的目录的程序文件中安装依赖项,尤其是在跨平台解决方案中,请使用便携式版本而不是安装程序