Reputation: 498
I managed to compile openssl-1.0.2o (using nasm-2.13.03) like shown here: https://wiki.qt.io/Building_Qt_Desktop_for_Windows_with_MSVC
However trying to build the Qt-Source already fails when trying to configure using the following command (it works without ssl/openssl):
C:/qt-everywhere-src-5.11.1/configure -platform win32-msvc2017 -prefix win32-msvc2017 -opensource -confirm-license -debug-and-release -force-debug-info -nomake examples -nomake tests -skip qtwebengine -skip qt3d -I C:\openssl-1.0.2o\out32dll -L C:\openssl-1.0.2o\out32dll -ssl -openssl
with the following Error in command line:
Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
ERROR: Feature 'openssl' was enabled, but the pre-condition '!features.securetransport && (features.openssl-linked || libs.openssl_headers)' failed.
ERROR: Feature 'ssl' was enabled, but the pre-condition 'config.winrt || features.securetransport || features.openssl' failed.
the config.log reveals it fails because of an "alloca.h"
Command line: -platform win32-msvc2017 -prefix win32-msvc -opensource -confirm-license -debug-and-release -force-debug-info -nomake examples -nomake tests -skip qtwebengine -skip qt3d -I C:\openssl-1.0.2o\out32dll -L C:\openssl-1.0.2o\out32dll -ssl -openssl
loaded result for config test config.qtbase.tests.verifyspec
+ cd /d C:\qt_build\config.tests\verifyspec && C:\qt_build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl-1.0.2o\\out32dll" "INCLUDEPATH += C:\\openssl-1.0.2o\\out32dll" C:/Entwicklung/qt-everywhere-src-5.11.1/qtbase/config.tests/verifyspec
+ cd /d C:\qt_build\config.tests\verifyspec && set MAKEFLAGS=& jom clean && set MAKEFLAGS=& jom
> jom 1.1.2 - empower your cores
> del verifyspec.obj
> del verifyspec.exp verifyspec.vc.pdb verifyspec.ilk verifyspec.idb
> C:\qt_build\config.tests\verifyspec\verifyspec.exp konnte nicht gefunden werden
> jom 1.1.2 - empower your cores
> cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W0 -EHsc /Fdverifyspec.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -IC:\qt-everywhere-src-5.11.1\qtbase\config.tests\verifyspec -I. -IC:\openssl-1.0.2o\out32dll -IC:\qt-everywhere-src-5.11.1\qtbase\mkspecs\win32-msvc -Fo @C:\Users\msrei\AppData\Local\Temp\verifyspec.obj.5420.0.jom
> verifyspec.cpp
> link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:verifyspec.exe @C:\Users\msrei\AppData\Local\Temp\verifyspec.exe.5420.328.jom
test config.qtbase.tests.verifyspec succeeded
loaded result for config test config.qtbase.tests.architecture
+ cd /d C:\qt_build\config.tests\arch && C:\qt_build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl-1.0.2o\\out32dll" "INCLUDEPATH += C:\\openssl-1.0.2o\\out32dll" C:/Entwicklung/qt-everywhere-src-5.11.1/qtbase/config.tests/arch
+ cd /d C:\qt_build\config.tests\arch && set MAKEFLAGS=& jom clean && set MAKEFLAGS=& jom
> jom 1.1.2 - empower your cores
> del arch.obj
> del arch.exp arch.vc.pdb arch.ilk arch.idb
> C:\qt_build\config.tests\arch\arch.exp konnte nicht gefunden werden
> jom 1.1.2 - empower your cores
> cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W0 -EHsc /Fdarch.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -IC:\qt-everywhere-src-5.11.1\qtbase\config.tests\arch -I. -IC:\openssl-1.0.2o\out32dll -IC:\qt-everywhere-src-5.11.1\qtbase\mkspecs\win32-msvc -Fo @C:\Users\msrei\AppData\Local\Temp\arch.obj.12860.0.jom
> arch.cpp
> link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:arch.exe @C:\Users\msrei\AppData\Local\Temp\arch.exe.12860.94.jom
Detected architecture: i386 (sse sse2)
test config.qtbase.tests.architecture gave result i386
loaded result for config test config.qtbase.tests.sse2
+ cd /d C:\qt_build\config.tests\x86_simd && C:\qt_build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl-1.0.2o\\out32dll" "INCLUDEPATH += C:\\openssl-1.0.2o\\out32dll" "CONFIG+=add_cflags" "DEFINES+=NO_ATTRIBUTE" "SIMD=sse2" C:/Entwicklung/qt-everywhere-src-5.11.1/qtbase/config.tests/x86_simd
+ cd /d C:\qt_build\config.tests\x86_simd && set MAKEFLAGS=& jom clean && set MAKEFLAGS=& jom
> jom 1.1.2 - empower your cores
> del main.obj
> del x86_simd.exp x86_simd.vc.pdb x86_simd.ilk x86_simd.idb
> C:\qt_build\config.tests\x86_simd\x86_simd.exp konnte nicht gefunden werden
> jom 1.1.2 - empower your cores
> cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -arch:SSE2 -Zi -MDd -W0 -EHsc /Fdx86_simd.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DNO_ATTRIBUTE -DQT_COMPILER_SUPPORTS_SSE2 -IC:\qt-everywhere-src-5.11.1\qtbase\config.tests\x86_simd -I. -IC:\openssl-1.0.2o\out32dll -IC:\qt-everywhere-src-5.11.1\qtbase\mkspecs\win32-msvc -Fo @C:\Users\msrei\AppData\Local\Temp\main.obj.11032.0.jom
> main.cpp
> link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:x86_simd.exe @C:\Users\msrei\AppData\Local\Temp\x86_simd.exe.11032.109.jom
test config.qtbase.tests.sse2 succeeded
loaded result for config test config.qtbase.tests.aesni
+ cd /d C:\qt_build\config.tests\x86_simd && C:\qt_build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl-1.0.2o\\out32dll" "INCLUDEPATH += C:\\openssl-1.0.2o\\out32dll" "CONFIG+=add_cflags" "DEFINES+=NO_ATTRIBUTE" "SIMD=aesni" C:/Entwicklung/qt-everywhere-src-5.11.1/qtbase/config.tests/x86_simd
+ cd /d C:\qt_build\config.tests\x86_simd && set MAKEFLAGS=& jom clean && set MAKEFLAGS=& jom
> jom 1.1.2 - empower your cores
> del main.obj
> del x86_simd.exp x86_simd.vc.pdb x86_simd.ilk x86_simd.idb
> jom 1.1.2 - empower your cores
> cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -arch:SSE2 -Zi -MDd -W0 -EHsc /Fdx86_simd.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -DNO_ATTRIBUTE -DQT_COMPILER_SUPPORTS_AESNI -IC:\qt-everywhere-src-5.11.1\qtbase\config.tests\x86_simd -I. -IC:\openssl-1.0.2o\out32dll -IC:\qt-everywhere-src-5.11.1\qtbase\mkspecs\win32-msvc -Fo @C:\Users\msrei\AppData\Local\Temp\main.obj.16356.0.jom
> main.cpp
> link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:x86_simd.exe @C:\Users\msrei\AppData\Local\Temp\x86_simd.exe.16356.93.jom
test config.qtbase.tests.aesni succeeded
loaded result for config test config.qtbase.tests.alloca_h
+ cd /d C:\qt_build\config.tests\alloca_h && C:\qt_build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl-1.0.2o\\out32dll" "INCLUDEPATH += C:\\openssl-1.0.2o\\out32dll" C:/Entwicklung/qt_build/config.tests/alloca_h
+ cd /d C:\qt_build\config.tests\alloca_h && set MAKEFLAGS=& jom clean && set MAKEFLAGS=& jom
> jom 1.1.2 - empower your cores
> del main.obj
> C:\qt_build\config.tests\alloca_h\main.obj konnte nicht gefunden werden
> del alloca_h.exp alloca_h.vc.pdb alloca_h.ilk alloca_h.idb
> C:\qt_build\config.tests\alloca_h\alloca_h.exp konnte nicht gefunden werden
> jom 1.1.2 - empower your cores
> cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zi -MDd -W0 -EHsc /Fdalloca_h.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl-1.0.2o\out32dll -IC:\qt-everywhere-src-5.11.1\qtbase\mkspecs\win32-msvc -Fo @C:\Users\msrei\AppData\Local\Temp\main.obj.14548.0.jom
> main.cpp
> main.cpp(2): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "alloca.h": No such file or directory
> jom: C:\qt_build\config.tests\alloca_h\Makefile [main.obj] Error 2
test config.qtbase.tests.alloca_h FAILED
Upvotes: 2
Views: 3684
Reputation: 93478
Here's what I've done today to solve this particular problem and build Qt 5.11.1 shared libraries with OpenSSL and MySQL support:
After extracting the OpenSSL package to c:\openssl
, the following commands ran successfully:
set OPENSSL_CONF=C:\openssl\ssl\openssl.cnf
configure -shared -debug-and-release -opensource -confirm-license -sql-mysql -opengl dynamic -platform win32-msvc2017 -prefix C:\Qt\qt5.11.1-msvc2017-shared -nomake tests -nomake examples -I "C:\Program Files (x86)\MySQL\MySQL Connector.C 6.1\include" -L "C:\Program Files (x86)\MySQL\MySQL Connector.C 6.1\lib" -ssl -openssl -I "C:\openssl\include" -L "C:\openssl\lib"
nmake
nmake install
I recommend building Qt sources from the Github repository, simply because if things go wrong and you need to clean the build directory, nmake clean
is super super slow. To properly clean the building directory and do it fast when building from the git repository, you can get rid of all temporary files with:
rm config.cache
git submodule foreach --recursive "git clean -dfx"
And your system should be ready to execute another configure
.
Upvotes: 0
Reputation: 98525
I don't know about Qt 5.10, but for 5.11.1, the following works - open a CMD prompt and run vcvarsall first, of course.
@set SRC=openssl-1.0.2o
@if "%VSCMD_ARG_TGT_ARCH%"=="x86" (
@set BITS=32
@set DST=OpenSSL-Win32
@set CONFIG=VC-WIN32
@set SETUP=ms\do_nasm
) else if "%VSCMD_ARG_TGT_ARCH%"=="x64" (
@set BITS=64
@set DST=OpenSSL-Win64
@set CONFIG=VC-WIN64A
@set SETUP=ms\do_win64a
) else goto no_vscmd
@echo Building %SRC% for %BITS% bits.
@echo - Downloading
@perl ^
-e "use LWP::Simple;" ^
-e "mirror('https://www.openssl.org/source/%SRC%.tar.gz', '%SRC%.tar.gz');"
@echo - Decompressing
@if not exist %SRC%.tar.gz goto no_archive
@rmdir /S /Q %SRC% %DST% 2>NUL
@7z x -bsp2 -y %SRC%.tar.gz >NUL && ^
7z x -bsp2 -y %SRC%.tar >NUL && ^
del %SRC%.tar
@if errorlevel 1 goto unpack_failed
@if not exist %SRC% goto no_source
@echo - Building
@pushd %SRC%
@perl Configure %CONFIG% --prefix=%~dp0..\%DST% && ^
call %SETUP% && ^
nmake -f ms\nt.mak init && ^
jom -f ms\nt.mak "CC=cl /FS" && ^
jom -f ms\nt.mak test && ^
nmake -f ms\nt.mak install || goto build_failed
@popd
@rmdir /S /Q %SRC%
@echo Build has succeeded.
@goto :eof
:no_archive
@echo Error: can't find %SRC%.tar.gz - the download has failed :(
@exit /b 1
:unpack_failed
@echo Error: unpacking has failed.
@exit /b %errorlevel%
:no_source
@echo Error: can't find %SRC%\
@exit /b 1
:build_failed
@echo The build had failed.
@popd
@exit /b 2
:no_vscmd
@echo Use vcvars-32 or vcvars-64 to set up the Visual Studio
@echo build environment first.
@exit /b 100
Then, to build Qt 5.11.1, I use the following configuration:
-opensource
-confirm-license
-force-debug-info
-debug-and-release
-ltcg
-openssl
-qt-zlib
-qt-libpng
-qt-libjpeg
-plugin-sql-sqlite
-mp
OPENSSL_PREFIX="c:\foo\OpenSSL-Win32"
-nomake examples
-make-tool jom
-platform win32-msvc
-opengl dynamic
-no-iconv
-no-dbus
Where foo
is whatever folder you happened to run build-openssl.bat
in.
Ensure that you have jom in the path, otherwise you'll hate the whole process. The latest jom is at: http://download.qt.io/official_releases/jom/jom.zip
The script to add all the tools into your path (so that you don't have to set it globally):
@set V_7ZIP=%ProgramFiles%\7-Zip
@set V_PERL64=C:\Perl64
@set V_PERL32=C:\Perl
@set V_PYTHON27=C:\Python27
@set V_NASM=%ProgramFiles%\NASM
@set V_NASM32=%ProgramFiles(x86)%\NASM
@set V_SMARTGIT32=%ProgramFiles(x86)%\SmartGit
@set V_SMARTGIT=%ProgramFiles%\SmartGit
@set V_CMAKE=%ProgramFiles%\CMake
@set V_CMAKE32=%ProgramFiles(x86)%\CMake
@set V_VS2015=2015
@set V_VS2015COMNTOOLS=%VS140COMNTOOLS%
@set V_VS2017COMNTOOLS=%VS150COMNTOOLS%
@if not exist "%V_7ZIP%\7z.exe" goto no_7zip
@call :append_path "%V_7ZIP%"
@goto has_7zip
:no_7zip
@echo Warning: 7-Zip not installed. OpenSSL will not build.
:has_7zip
@if not exist "%V_PERL64%\bin" goto no_perl64
@if not exist "%V_PERL64%\site\bin" goto no_perl_site64
@call :append_path "%V_PERL64%\site\bin"
:no_perl_site64
@call :append_path "%V_PERL64%\bin"
@goto has_perl
:no_perl64
@if not exist "%V_PERL32%\bin" goto no_perl
@if not exist "%V_PERL32%\site\bin" goto no_perl_site32
@call :append_path "%V_PERL32%\site\bin"
:no_perl_site32
@call :append_path "%V_PERL32%\bin"
@goto has_perl
:no_perl
@echo Warning: Perl not installed. Qt will not build.
:has_perl
@if not exist "%V_PYTHON27%" goto no_python
@call :append_path "%V_PYTHON27%"
@goto has_python
:no_python
@echo Warning: Python 2.7 not installed. Qt will not build.
:has_python
:check_nasm
@if not exist "%V_NASM%\nasm.exe" goto check_nasm32
@call :append_path "%V_NASM%"
@goto has_nasm
:check_nasm32
@if not exist "%V_NASM32%\nasm.exe" goto no_nasm
@call :append_path "%V_NASM32%"
@goto has_nasm
:no_nasm
@echo Warning: NASM not installed. OpenSSL will not build.
:has_nasm
:check_git
@if not exist "%V_SMARTGIT%\git\bin" goto check_git32
@call :append_path "%V_SMARTGIT%\git\bin"
@goto has_git
:check_git32
@if not exist "%V_SMARTGIT32%\git\bin" goto no_git
@call :append_path "%V_SMARTGIT32%\git\bin"
@goto has_git
:no_git
@echo Warning: SmartGit not installed. Qt WebEngine might not build.
:has_git
:check_cmake
@if not exist "%V_CMAKE%\bin\cmake.exe" goto check_cmake32
@call :append_path "%V_CMAKE%\bin"
@goto has_cmake
:check_cmake32
@if not exist "%V_CMAKE32%\bin\cmake.exe" goto no_cmake
@call :append_path "%V_CMAKE32%\bin"
@goto has_cmake
:no_cmake
@echo Info: CMake not installed. This is without consequences.
:has_cmake
:: configure gyp overrides for msvs 2017 express
@if not exist "%VS150COMNTOOLS%\VsDevCmd.bat" goto no_vs2017gyp
@call :set_path V_VS2017 "%VS150COMNTOOLS%\..\.."
@echo Info: Found MSVS 2017 at "%V_VS2017%"
@set GYP_MSVS_VERSION=2017
@set GYP_MSVS_OVERRIDE_PATH=%V_VS2017%
@goto no_vs2015gyp
:no_vs2017gyp
:: configure gyp overrides for msvs 2015 express
@if not exist "%VS140COMNTOOLS%\..\IDE\WDExpress.exe" goto no_vs2015gyp
@call :set_path V_VS2015 "%VS140COMNTOOLS%\..\.."
@echo Info: Found MSVS Express 2015 at "%V_VS2015%"
@set GYP_MSVS_VERSION=2015
@set GYP_MSVS_OVERRIDE_PATH=%V_VS2015%
:no_vs2015gyp
@exit /b
:append_path
@echo %PATH%|find "%~1">nul || PATH %PATH%;%~1
@goto :eof
:set_path
@set %1=%~f2
@goto :eof
Upvotes: 2
Reputation: 498
It worked using openssl 1.0.2 configured like this:
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86
perl Configure VC-WIN32 --prefix=C:/openssl
nmake -f ms/ntdll.mak
nmake -f ms/ntdll.mak install
and this configure:
D:/qt-everywhere-src-5.10.0/configure -platform win32-msvc2017 -prefix win32-msvc2017 -opensource -confirm-license -debug-and-release -force-debug-info -nomake examples -nomake tests -skip qtwebengine -skip qt3d -ssl -openssl-linked OPENSSL_PREFIX=C:\openssl
for using it in a Qt-Project with MSVC2017 add this to your projects .pro file
win32-msvc* {
LIBS += -LC:/openssl/lib/ -llibeay32
LIBS += -LC:/openssl/lib/ -lssleay32
INCLUDEPATH += C:/openssl/include
}
Upvotes: 2