# [Solved]Building custom Qt from source

• Can a custom build for Qt (5.6) be done with building SSL without the web engine (formerly web kit)? I did a checkout and called the script from git which pulled all the modules except the webkit. I included in the configure script the locations of the files needed for openssl. I get errors in the build as not being able to find several include files:

c:\qt\qt5\qtbase\include\qtnetwork\5.6.0\qtnetwork\private../../../../../src/network/ssl/qsslcontext_openssl_p.h(53) :
fatal error C1083: Cannot open include file: 'openssl/ssl.h': No such file or directory (access\qhttpnetworkreply.cpp)
qabstractprotocolhandler.cpp
qhttpprotocolhandler.cpp
c:\qt\qt5\qtbase\include\qtnetwork\5.6.0\qtnetwork\private../../../../../src/network/ssl/qsslcontext_openssl_p.h(53) :
fatal error C1083: Cannot open include file: 'openssl/ssl.h': No such file or directory (access\qhttpnetworkconnection.c
pp)
qspdyprotocolhandler.cpp
c:\qt\qt5\qtbase\include\qtnetwork\5.6.0\qtnetwork\private../../../../../src/network/ssl/qsslcontext_openssl_p.h(53) :
fatal error C1083: Cannot open include file: 'openssl/ssl.h': No such file or directory (access\qhttpnetworkconnectionch
annel.cpp)
qnetworkaccessauthenticationmanager.cpp
c:\qt\qt5\qtbase\include\qtnetwork\5.6.0\qtnetwork\private../../../../../src/network/ssl/qsslcontext_openssl_p.h(53) :
fatal error C1083: Cannot open include file: 'openssl/ssl.h': No such file or directory (access\qabstractprotocolhandler
.cpp)
qnetworkaccessmanager.cpp
c:\qt\qt5\qtbase\include\qtnetwork\5.6.0\qtnetwork\private../../../../../src/network/ssl/qsslcontext_openssl_p.h(53) :
fatal error C1083: Cannot open include file: 'openssl/ssl.h': No such file or directory (access\qhttpprotocolhandler.cpp
)
qnetworkaccesscache.cpp
c:\qt\qt5\qtbase\include\qtnetwork\5.6.0\qtnetwork\private../../../../../src/network/ssl/qsslcontext_openssl_p.h(53) :
fatal error C1083: Cannot open include file: 'openssl/ssl.h': No such file or directory (access\qspdyprotocolhandler.cpp
)

Is the build possible? That is, SSL without the web engine? It seems that they are two distinct modules

• Hi,

Yes, it's possible, but first you have to get OpenSSL for windows

• @SGaist

Yes I do have it. In the configure options I point to the include folder for OpenSSL as well as the lib folder

• Just C:\OpenSSL_win32\include or C:\OpenSSL_win32\include\openssl ?

• @SGaist

Not exactly but similar. The include is: C:\openssl-1.0.2d\include\openssl

• Then the path is one level too deep. You need to use C:\openssl-1.0.2d\include\

• @SGaist
Ok, I actually had one level down as you shown and the error persists. That is, ...\include\ and ...\include\openssl. Both were tried and yet had errors:
fatal error C1083: Cannot open include file: 'openssl/ssl.h': No such file or directory (access\qnetworkreplyhttpimpl.cpp)

• Might be a silly question but did you pass the corresponding -I and -L arguments to configure ?

• @SGaist
Yes. A part of the configure options is shown below:
-ssl -openssl -I C:\openssl-1.0.2d\include -L C:\openssl-1.0.2d\lib

• When doing the -I and -L corrections, did you do it from a clean state ?

• @SGaist
Meaning a nmake clean?

• No: confclean.

Better yet: use a shadow build, this way you can keep your sources clean and just nuke the thing if you need to restart.

• C:\Qt\qt5>nmake confclean

Microsoft (R) Program Maintenance Utility Version 12.00.21005.1

NMAKE : fatal error U1073: don't know how to make 'confclean'
Stop.

Perhaps confclean is not a valid target in any of the created Makefiles?

• confclean actually doesn't exist in Qt 5. IIRC, it was hard to make it work with Qt's modular structure. See https://bugreports.qt.io/browse/QTBUG-34304 for a discussion.

Did you get the source code from git? Or did you download the source package?

• @JKSH
code.qt.io/qt using git

• @SGaist said:

No: confclean.

Reason for using clean instead of confclean referenced here thanks to @JKSH

• Assuming that you checked out the code to C:\Qt\git, use the following commands to clean your source tree:

> cd C:\Qt\git\
> git clean -dfx
> git submodule foreach "git clean -dfx"


• @JKSH said:

Assuming that you checked out the code to C:\Qt\git, use the following commands to clean your source tree:

> cd C:\Qt\git\
> git clean -dfx
> git submodule foreach "git clean -dfx"


So this is in regards to making a correction and perform a re-build? I didn't do that for the initial build.

From memory, I do a checkout, init-repository --no-webkit, and then perform the configure step and finally the call to nmake.

• My bad, old reflex from Qt 4. However, I'd recommend an out of source build, so you don't have to clean anything, just nuke the current build folder content and restart

• @SGaist said:

I'd recommend an out of source build, so you don't have to clean anything

Hi,

Not sure I understand what "out of source" means. I get the part about nuke the current folder. If what you mean is just delete the build folder and start again, then I must ask, does not doing a clean solve that?

• It literally means build from another folder outside of Qt's source tree so basically:

cd qt_build
C:\Path\to\Qt\configure


Indeed, the result is pretty much the same however It's generally faster (at least for me until now) to delete a folder than to recursively go through all Qt's modules and clean one after the other.

• @SGaist
Understood. Issue still dogging me though as to why it can't find the include files for openssl

• @astodolski said:

So this is in regards to making a correction and perform a re-build?

Yes.

I didn't do that for the initial build.

@SGaist said:

I'd recommend an out of source build, so you don't have to clean anything, just nuke the current build folder content and restart

Yes, that sounds very useful and it works for both git and non-git sources, I'll need to try this the next time I build!

• @astodolski
Can you share the full configure line you are using and the build setup summary ?

@JKSH
Out of source is just so great, you should ;)

• @SGaist said:

@astodolski
Can you share the full configure line you are using and the build setup summary ?

@JKSH
Out of source is just so great, you should ;)

-debug-and-release
-opensource
-shared
-opengl
desktop
-nomake
examples
-nomake
tests
-no-icu
-no-angle
-no-style-windowsce
-no-style-windowsmobile
-mp
-platform
win32-msvc2013
-openssl
-I
C:\openssl-1.0.2d\include
-L
C:\openssl-1.0.2d\lib
-prefix
c:\qt\5.6\msvc2013
-saveconfig
light_cfg

• @JKSH said:

Assuming that you checked out the code to C:\Qt\git, use the following commands to clean your source tree:

> cd C:\Qt\git\
> git clean -dfx
> git submodule foreach "git clean -dfx"


WOW! That is amazingly faster than nmake clean. Thanks for that.

• @SGaist said:

It literally means build from another folder outside of Qt's source tree so basically:

cd qt_build
C:\Path\to\Qt\configure


Indeed, the result is pretty much the same however It's generally faster (at least for me until now) to delete a folder than to recursively go through all Qt's modules and clean one after the other.

Looking at the batch file in the root folder, it looks as if that file does essentially the same thing. i.e configure.bat cd's to qtbase\configure

• Yes but it also triggers the build of the other modules, otherwise you will only build qtbase.

Can you try again with -openssl-linked ?

• @SGaist said:

Yes but it also triggers the build of the other modules, otherwise you will only build qtbase.

Can you try again with -openssl-linked ?

OK. So on my checked out build I have:
c:\Qt\qt5

You're suggesting:
cd c:\Qt\qt5
qtbase\configure

Is that correct?

There exists a configure script in both the root and the qtbase folder

• No, I'm suggesting:

cd C:\Qt\MyQt5Build
C:\Qt\qt5\configure.bat


• @SGaist said:

No, I'm suggesting:

cd C:\Qt\MyQt5Build
C:\Qt\qt5\configure.bat


So MyQt5Build is initially empty and is a target folder for the build correct? That's what you meant by shadow build?

• Yes, the same thing happening by default when you build a project with Qt Creator

• @astodolski said:

There exists a configure script in both the root and the qtbase folder

Do not use the script in qtbase directly. Only use the root script.

• Sweet success!. Cleaning the source tree using the git commands suggested as well as the proper level of path for the include folder for openssl worked. Thanks to ALL!