Page 1 of 1

build virtualbox from source on Windows

PostPosted: 30. Nov 2018, 11:13
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!!!

Re: build virtualbox from source on Windows

PostPosted: 30. Nov 2018, 11:33
by socratis
Moving to "OSE" from "Windows Hosts".

Re: build virtualbox from source on Windows

PostPosted: 30. Nov 2018, 20:57
by mhanor

Re: build virtualbox from source on Windows

PostPosted: 17. Jan 2019, 18:50
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/qtproject/archive/qt/5.6/5.6.3/single/qt-everywhere-opensource-src-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   Expand viewCollapse view
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   Expand viewCollapse view
./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   Expand viewCollapse view
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   Expand viewCollapse view
./qt-everywhere-opensource-src-5.6.3/configure.bat -prefix C:\Qt\5.6.3\x64...

8. Delete all sources and build files

Re: build virtualbox from source on Windows

PostPosted: 8. Mar 2019, 16:35
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?

Re: build virtualbox from source on Windows

PostPosted: 8. Mar 2019, 19:16
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.

Re: build virtualbox from source on Windows

PostPosted: 9. Mar 2019, 09:46
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   Expand viewCollapse view
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   Expand viewCollapse view
\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?

Re: build virtualbox from source on Windows

PostPosted: 9. Mar 2019, 10:08
by mhanor
Are you using a self-signed certificate? If this is the case, add it to Certificates - Trusted Root Certification Authorities.

Re: build virtualbox from source on Windows

PostPosted: 9. Mar 2019, 19:46
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

Re: build virtualbox from source on Windows

PostPosted: 9. Mar 2019, 20:54
by mhanor
In Configurations\00-base-templates.conf, search for BASE_Windows section and add /integritycheck to lflags

Re: build virtualbox from source on Windows

PostPosted: 10. Mar 2019, 04:32
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