[Interest] Error when configuring Qt 6.X.Y to build from source on Windows with -openssl-linked

Alexandru Croitor alexandru.croitor at qt.io
Thu Jun 27 11:23:34 CEST 2024



> On 27. Jun 2024, at 11:09, Nuno Santos <nuno.santos at imaginando.pt> wrote:
> 
> Alexandru,
> 
>> On 27 Jun 2024, at 09:51, Alexandru Croitor <alexandru.croitor at qt.io> wrote:
>> 
>> Your CMakeCache.txt suggests that openssl was indeed not found.
> 
> Can you please tell me where exactly do you see this?

There was a OPENSSL_INCLUDE_DIR:PATH=OPENSSL_INCLUDE_DIR-NOTFOUND entry in the cache.
That suggests that cmake called find_path to find the ssl include dir and failed.


> 
>> 
>> I see you added --debug-find to the additional cmake options in your screenshot. Why have you not shared the output?
>> It should have added a lot of output for the various find_package / find_path / find_library calls.
>> 
>> Please modify Additional CMake options to contain: --debug-find --trace-redirect=trace.txt --trace-expand
>> 
>> Then click Reconfigure with Initial parameters, share the full cmake stdout output, as well as the contents of the trace.txt file in the build directory.
>> 
>> Also, one thing I would try is to specify the OPENSSL_ROOT_DIR path with forward slashes. So c:/Qt-Utils/openssl
>> 
>> And please share the directory layout of the c:/Qt-Utils/openssl directory.
> 
> Regarding the project configuration I have learned that:
> 
> - deleting the build dir is more effective to reflect changes to cmake configuration

That is of course the safest option, but in my experience pressing Reconfigure with Initial parameters in Creator also does the job.


> - Inside CMakeCache.txt OPENSSL_ROOT_DIR was set to UNINITIALIZED and I have manually set it to PATH

This might tie into the forward slashes i mentioned. I believe CMake does some path transformations when the type of the cache var is PATH.
I suggest you try configuring from scratch again, don't modify the type to PATH but keep it UNINITIALIZED, and try with both forward and backslashes and see if there is a difference.

> - Inside CMakeCache.txt I have defined OPENSSL_INCLUDE_DIR to c:\Qt-Utils\openssl\include

That should not be necessary, setting OPENSSL_ROOT_DIR should be sufficient.

> 
> After this changes, the cmake ran successful and I was able to build and run the example with my custom kit.
> 
> This seems like little quirks but makes me feel that CMake and Qt is still black magic! :)
> 
> Any advice based on this feedback?

I already shared most of my troubleshooting routine for not finding packages, but this is the general flow I go through:
- making sure i have a clean build
- reading the official documentation for FindOpenSSL.cmake to see which variables it considers during lookup
- tinkering with paths and variables like you did
- trying to configure on the command line instead of an IDE
- reading the documentation for find_package / find_path in case I forget something about the search procedure
- using --debug-find to check what paths were considered when looking up things
- using --trace-redirect=log.txt --trace-expand and trying to spot anything wrong in the trace like wrong paths being set
- reading the implementation of FindOpenSSL.cmake to see what it does and which variables it considers
- looking at CMakeFiles/CMakeConfigureLog.cmake (would not help in this case)
- building a debug cmake and stepping through the cmake source code on a small project that tries to find a relevant package and fails
- reaching out to the cmake forums for advice in case if nothing else helps




More information about the Interest mailing list