build virtualbox from source on Windows

Discussions related to using the OSE version of VirtualBox.
Post Reply
jhon rosy
Posts: 2
Joined: 30. Nov 2018, 10:43

build virtualbox from source on Windows

Post by jhon rosy »

I want to build virtualbox from source. But it requires installing Qt 5.6.x for visual studio 2010 sp1. But vs 2010 is too old to install Qt 5.6.x or later. So can I use the newer version visual studio to build virtualbox?
Thank you very much!!!
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: build virtualbox from source on Windows

Post by socratis »

Moving to "OSE" from "Windows Hosts".
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mhanor
Volunteer
Posts: 321
Joined: 7. Oct 2009, 12:40
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: various

Re: build virtualbox from source on Windows

Post by mhanor »

Yurii.Ch
Posts: 31
Joined: 16. Oct 2018, 08:47
Primary OS: Mac OS X other
VBox Version: OSE self-compiled
Guest OSses: Windows 7-10, Linux

Re: build virtualbox from source on Windows

Post by Yurii.Ch »

For those who struggle with Qt build.
Starting from Qt 5.7 lowest supported Visual Studio version is 2012.
You should download last Qt 5.6 sources available, which is 5.6.3 here:
http://iso.mirrors.ustc.edu.cn/qtprojec ... -5.6.3.zip
You don't need to build the whole Qt, only GUI libraries. In fact, it significantly speeds up the process.

Steps to build Qt 5.6.3:
1. Unpack Qt sources to your project directory, for example C:/Users/YourUsername/Projects/Qt/5.6.3
2. Execute the following Windows CMD script for x86 build

Code: Select all

SET QTDIR=C:\Qt\5.6.3\x86
cd /d C:\Users\YourUsername\Projects\Qt\5.6.3
mkdir build-x86
cd build-x86
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 /win7
SET PATH=%QTDIR%/bin;%PATH%
SET QMAKESPEC=win32-msvc2010
3. Run configure.bat. As I mentioned above, you can turn off compilation of the the most of dynamic libraries

Code: Select all

./qt-everywhere-opensource-src-5.6.3/configure.bat -prefix C:\Qt\5.6.3\x86 -mp -opensource -confirm-license -nomake tests -nomake examples -no-compile-examples -release -shared -pch -no-ltcg -accessibility -no-sql-sqlite -opengl desktop -no-openvg -no-nis -no-iconv -no-evdev -no-mtdev -no-inotify -no-eventfd -largefile -no-system-proxies -qt-zlib -qt-pcre -no-icu -qt-libpng -qt-libjpeg -qt-freetype -no-fontconfig -qt-harfbuzz -no-angle -incredibuild-xge -no-plugin-manifests -qmake -qreal double -rtti -strip -no-ssl -no-openssl -no-libproxy -no-dbus -no-audio-backend -no-wmf-backend -no-qml-debug -no-direct2d -directwrite -no-style-fusion -native-gestures -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtconnectivity -skip qtdeclarative -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns
4. Run command nmake
5. Run command nmake install
6. For Qt x64 version run the following CMD script

Code: Select all

SET QTDIR=C:\Qt\5.6.3\x64
cd /d C:\Users\YourUsername\Projects\Qt\5.6.3
mkdir build-x64
cd build-x64
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /win7
SET PATH=%QTDIR%/bin;%PATH%
SET QMAKESPEC=win32-msvc2010
7. Repeat steps same as for x86, configure, nmake, nmake install, but in configure command beginning should look like

Code: Select all

./qt-everywhere-opensource-src-5.6.3/configure.bat -prefix C:\Qt\5.6.3\x64...
8. Delete all sources and build files
white hat
Posts: 5
Joined: 6. Mar 2019, 10:52

Re: build virtualbox from source on Windows

Post by white hat »

Superfluous quote of the entire text of the immediately preceding post - deleted by mod.

hello
I want to add "/INTEGRITYCHECK" option to qt when I build it. How can I do this?
Last edited by mpack on 8. Mar 2019, 16:44, edited 1 time in total.
Reason: See edit.
mhanor
Volunteer
Posts: 321
Joined: 7. Oct 2009, 12:40
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: various

Re: build virtualbox from source on Windows

Post by mhanor »

You edit the qmakespec configuration file (e.g. in qtbase\mkspecs\common\msvc-desktop.conf for 5.6.x or the corresponding configuration file for your environment version, on older Qt versions, such as 4.8.x - e.g. mkspecs\win32-msvc2010\qmake.conf), adding /integritycheck to QMAKE_LDFLAGS. Also, the building process will stop from time to time because you'll need to manually sign some Qt tools and the libraries, after they are built, to continue the build process. At the end of the build process, don't forget to sign your dlls. I haven't really looked for a solution to make the build automatically sign the binaries.
white hat
Posts: 5
Joined: 6. Mar 2019, 10:52

Re: build virtualbox from source on Windows

Post by white hat »

I have modified flag "QMAKE_LFLAGS_DLL" in file msvc-desktop.conf to "/DLL /integritycheck" and get the error:

Code: Select all

call C:\Qt\5.6.3\qtbase\src\widgets\uic_wrapper.bat dialogs\qfiledialog.ui -o .uic\ui_qfiledialog.h
NMAKE : fatal error U1077: 'call' : return code '0xc0000428'

It stopped when call file uic_wrapper.bat. So I open this file and receive popup error message

Code: Select all

\qtbase\lib\Qt5Core.dll is either not designed to run on windows or it contains an error. Try installing the program again using original installation media or contact your system asministrator or the sofware vendor for support
What should I do?
mhanor
Volunteer
Posts: 321
Joined: 7. Oct 2009, 12:40
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: various

Re: build virtualbox from source on Windows

Post by mhanor »

Are you using a self-signed certificate? If this is the case, add it to Certificates - Trusted Root Certification Authorities.
white hat
Posts: 5
Joined: 6. Mar 2019, 10:52

Re: build virtualbox from source on Windows

Post by white hat »

mhanor wrote:Are you using a self-signed certificate? If this is the case, add it to Certificates - Trusted Root Certification Authorities.
I signed and added the "/ INTEGRITYCHECK" option to almost all necessary dlls. But I failed at openssl 1.1.0 after many attempts. Can you tell me how to add "/ INTEGRITYCHECK" option to dll openssl 1.1.0 ? Thank you so much
mhanor
Volunteer
Posts: 321
Joined: 7. Oct 2009, 12:40
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: various

Re: build virtualbox from source on Windows

Post by mhanor »

In Configurations\00-base-templates.conf, search for BASE_Windows section and add /integritycheck to lflags
white hat
Posts: 5
Joined: 6. Mar 2019, 10:52

Re: build virtualbox from source on Windows

Post by white hat »

mhanor wrote:In Configurations\00-base-templates.conf, search for BASE_Windows section and add /integritycheck to lflags
Although I ran "nmake test" that reported a lot of errors but the dll still builds successfully. Thank you
Post Reply