4

I'm compiling VirtualBox Guest Additions according to official documentation. Building separately 64- and 32-bit additions and trying to pack it into iso image.

Target system is Windows 7 x64. All software requirements as per documentation, including exact versions. Only additions should be built (VBOX_ONLY_ADDITIONS := 1 in LocalConfig.kmk)

32-bit compilation without setting a target is normal

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-bit compilation without setting a target as well

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

Trying to build x86 additions (according to comments in Makefile.kmk, must be built before x64)

kmk additions-build-win.x86

...and getting the error

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)

Same error appears trying to build x64 version: kmk additions-build-win.amd64

My 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 Answers2

0

The only error in the log that I see is:

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

You should look into that script to see where it has choked. Note that it is a Unix shell script, so it must be interpreted by a shell coming presumably with MinGW.

As one last note, there is a guide (in Russian) on how to build Virtualbox and its components on Windows. I never tried to follow it, but what I learned from it is that it is not an easy task to build VirtualBox from scratch. It looks like it is not very nicely supported by Oracle these days. It might well be that there is a bug in wither their build instructions or scripts.

Grigory Rechistov
  • 2,104
  • 16
  • 25
  • For sure I read this article :) It's a great commitment, but the author DO NOT compile Guest Additions, he downloads the iso image from Oracle server. I tried to catch this file creation, bit all temporary files are cleaned up immediately after the build system fails –  Apr 23 '18 at 04:53
  • "I tried to catch this file creation" — yes, it is an interesting question how to catch contents of such ephemeral files. You can try looking through the sources, starting from the makefile, to find the script that generates that temporary file, and analyze what it does. Alternatively, you can find the file removal stage and comment it out so that files do not get deleted. – Grigory Rechistov Apr 23 '18 at 05:03
  • See solution if interested –  Aug 18 '18 at 13:25
0

Actually, I solved a question a couple of month ago, but decided to post a solution "if any". I had to set a hook on a Temp directory to catch that elusive *.sh script, which also had a new name every compilation.

The part of error Syntax error: "(" unexpected appeared to be a path to Program Files (x86). Morale: try not to install dependencies in Program Files of any other directories with spaces, especially in cross-platform solution, use portable versions instead of installers