[Interest] Qt6 - Fails to compile when openssl-linked enabled

Mårten Nordheim marten.nordheim at qt.io
Mon Jan 9 12:25:38 CET 2023


As Thiago mentioned, dynamically linking OpenSSL tends to be easier.
From what I can tell, the vcpkg directory should work with the FindOpenssl.cmake module.

You also may have trouble if you are mixing dynamically- and statically linked libraries!
Since they are likely linking the VC runtime in the same manner, they _cannot_ be mixed.
And, if I remember correctly, the default ‘static’ triplets in vcpkg all link the runtime statically.
Which means Qt and all other dependencies must also be built this way (-static-runtime for Qt).

You can also define your own triplet with dynamic lining of the VC runtime, but I’m not familiar with the process.

Mårten

From: Nuno Santos <nuno.santos at imaginando.pt>
Sent: fredag 6. januar 2023 19:04
To: Mårten Nordheim <marten.nordheim at qt.io>
Cc: Qt Interest <interest at qt-project.org>; Macieira, Thiago <thiago.macieira at intel.com>
Subject: Re: [Interest] Qt6 - Fails to compile when openssl-linked enabled

Marten,

I’m now trying to do the same in Windows but having problems.

I’m using vcpkg to build openssl and the only different in the configure line is the path to the installed vcpkgs


..\configure.bat -prefix C:\Qt\6.4.1\msvc2019_static -static -debug-and-release -nomake examples -nomake tests -nomake benchmarks -nomake manual-tests -nomake minimal-static-tests -openssl-linked -qtnamespace com_imaginando_qt_6_4_1 -- -DOPENSSL_ROOT_DIR="C:\vcpkg\installed\x64-windows-static\" -DOPENSSL_USE_STATIC_LIBS=TRUE

Inside C:\vcpkg\installed\x64-windows-static\include there is the openssl folder


And inside the C:\vcpkg\installed\x64-windows-static\lib there is:


libcrypto.lib
libeay32.lib
libssl.lib

However, the result is:

CMake Error at qtbase/cmake/QtBuildInformation.cmake:490 (message):
  Feature "openssl": Forcing to "ON" breaks its condition:      QT_FEATURE_openssl_runtime OR QT_FEATURE_openssl_linked  Condition values dump:      QT_FEATURE_openssl_runtime = "OFF"
      QT_FEATURE_openssl_linked = "OFF"Call Stack (most recent call first):
  qtbase/cmake/QtFeature.cmake:281 (qt_configure_add_report_error)
  qtbase/cmake/QtFeature.cmake:403 (qt_feature_check_and_save_internal_value)
  qtbase/cmake/QtFeature.cmake:155 (qt_evaluate_feature)
  qtbase/cmake/QtFeature.cmake:349 (qt_evaluate_config_expression)
  qtbase/cmake/QtFeature.cmake:606 (qt_evaluate_feature)
  qtbase/cmake/QtFeature.cmake:575 (qt_feature_module_end)
  qtbase/src/CMakeLists.txt:9 (qt_feature_evaluate_features)


Trying to build without this, worked perfectly.

What am I missing here?

Thanks!

Nuno


On 8 Dec 2022, at 15:04, Nuno Santos <nuno.santos at imaginando.pt<mailto:nuno.santos at imaginando.pt>> wrote:

Marten,

I’ve noticed the nuance yesterday and tried but there was an error but I didn’t read the output correctly. I had a typo in a second define, OPENSSL_USE_STATIC_LIBS, which needed to be set to true. The following configure line worked:

./configure -prefix /Users/nsantos/Qt/6.4.1/macos_static -static -debug-and-release -nomake examples -nomake tests -nomake benchmarks -nomake manual-tests -nomake minimal-static-tests -openssl-linked -- -DOPENSSL_ROOT_DIR="/Users/nsantos/Qt-Utils/openssl" -DOPENSSL_USE_STATIC_LIBS=TRUE

Thiago, using openssl linked on Mac was a decision I have made a many years ago and I can’t remember the reason. Maybe it is not a good decision anymore. I know Apple has its SecureTransport framework. I might need to evaluate it again.

Thanks!

Regards,

Nuno


On 8 Dec 2022, at 08:49, Mårten Nordheim <marten.nordheim at qt.io<mailto:marten.nordheim at qt.io>> wrote:

The parameters to cmake (-D*) must be passed after a separating double dash (--).
 So, this:
-openssl-linked -DOPENSSL_ROOT_DIR="…"
 Should be like:
-openssl-linked -- -DOPENSSL_ROOT_DIR="…"
 Mårten
 From: Nuno Santos <nuno.santos at imaginando.pt<mailto:nuno.santos at imaginando.pt>>
Sent: onsdag 7. desember 2022 17:40
To: Mårten Nordheim <marten.nordheim at qt.io<mailto:marten.nordheim at qt.io>>
Cc: Qt Interest <interest at qt-project.org<mailto:interest at qt-project.org>>
Subject: Re: [Interest] Qt6 - Fails to compile when openssl-linked enabled
 Marten,
 Tried again without success. Maybe it's the directory layout. I don’t know I’m in the dark since the the CMakeOutput.log and CMakeError.log do not even mention ssl anywhere. Below is the new configure call:
 ./configure -prefix /Users/nsantos/Qt/6.4.2/macos -static -debug-and-release -nomake examples -nomake tests -nomake benchmarks -nomake manual-tests -nomake minimal-static-tests -openssl-linked -DOPENSSL_ROOT_DIR="/Users/nsantos/Qt-Utils/openssl" -DOPENSSL_USE_STATIC_LIBS
 Where:
 > find /Users/nsantos/Qt-Utils/openssl


gives:
 /Users/nsantos/Qt-Utils/openssl
/Users/nsantos/Qt-Utils/openssl/include
/Users/nsantos/Qt-Utils/openssl/include/crypto
/Users/nsantos/Qt-Utils/openssl/include/crypto/md32_common.h
…
/Users/nsantos/Qt-Utils/openssl/lib
/Users/nsantos/Qt-Utils/openssl/lib/libcrypto.a
/Users/nsantos/Qt-Utils/openssl/lib/libssl.a
 Where can I find more information?
 Thank you!
 Best regards,
 Nuno


On 7 Dec 2022, at 13:50, Mårten Nordheim <marten.nordheim at qt.io<mailto:marten.nordheim at qt.io>> wrote:
 Ah, I don’t think OPENSSL_LIBS is in use anymore!
I think it was still left printed at the end of configure, I’m not sure the change removing it was merged into 6.4.
Please use the FindOpenSSL cmake find-module variables: https://cmake.org/cmake/help/latest/module/FindOpenSSL.html
In your case, passing -DOPENSSL_ROOT_DIR="/Users/nsantos/Qt-Utils/openssl"
at the end of your configure line, something like this:
 ./configure -prefix …. -openssl-linked -- -DOPENSSL_ROOT_DIR="…"
 Mårten
 From: Nuno Santos <nuno.santos at imaginando.pt<mailto:nuno.santos at imaginando.pt>>
Sent: onsdag 7. desember 2022 14:01
To: Mårten Nordheim <marten.nordheim at qt.io<mailto:marten.nordheim at qt.io>>
Cc: Qt Interest <interest at qt-project.org<mailto:interest at qt-project.org>>
Subject: Re: [Interest] Qt6 - Fails to compile when openssl-linked enabled
 Marten,
 Thank you for your reply.
 Yes the patch required? My configure line was:
 ./configure -prefix /Users/nsantos/Qt/6.4.2/macos -static -debug-and-release -nomake examples -nomake tests -nomake benchmarks -nomake manual-tests -nomake minimal-static-tests -openssl-linked -I/Users/nsantos/Qt-Utils/openssl/include OPENSSL_LIBS="/Users/nsantos/Qt-Utils/openssl/lib/libssl.a /Users/nsantos/Qt-Utils/openssl/lib/libcrypto.a”
 Best,
 Nuno



On 7 Dec 2022, at 11:59, Mårten Nordheim <marten.nordheim at qt.io<mailto:marten.nordheim at qt.io>> wrote:
 [Reply is inline]



-----Original Message-----
From: Nuno Santos <nuno.santos at imaginando.pt<mailto:nuno.santos at imaginando.pt>>
Sent: onsdag 7. desember 2022 11:50
To: Mårten Nordheim <marten.nordheim at qt.io<mailto:marten.nordheim at qt.io>>
Cc: Qt Interest <interest at qt-project.org<mailto:interest at qt-project.org>>
Subject: Re: [Interest] Qt6 - Fails to compile when openssl-linked enabled

Marten,

Thanks for your reply.

I’m on branch 6.4.2 and before any configure I always call:

git submodule foreach --recursive "git clean -dfx" && git clean -dfx

Should I try with another branch?

No, it shouldn't be needed. I just configured 6.4 branch locally and it
works fine. With only
https://codereview.qt-project.org/c/qt/qtbase/+/446542
as the extra patch.
I think this might indicate that the openssl compile test fails, which
could disable the feature. But just to make sure; do you call configure
like `../qt5/configure ... -openssl-linked` ?




Regards,

Nuno



On 7 Dec 2022, at 09:45, Mårten Nordheim <marten.nordheim at qt.io<mailto:marten.nordheim at qt.io>>
wrote:



Hey,

If this is a clean build I need to know which branch you are building.
If not then you could try deleting CMakeCache.txt and reconfiguring,
there were some changes around configuration of openssl recently
which may be conflicting with values in the cache.

Mårten



-----Original Message-----
From: Interest <interest-bounces at qt-project.org<mailto:interest-bounces at qt-project.org>> On Behalf Of Nuno
Santos
Sent: onsdag 7. desember 2022 10:28
To: Qt Interest <interest at qt-project.org<mailto:interest at qt-project.org>>
Subject: [Interest] Qt6 - Fails to compile when openssl-linked enabled

Hi,

I’m trying to compile Qt 6 with openssl-linked but I’m having this error and
I’m not being able to interpret it.

What is failing? Can you please help me here?

Thanks in advance!

Regards,

Nuno


Configuring submodule 'qtbase'
CMake Error at qtbase/cmake/QtBuildInformation.cmake:490 (message):
Feature "openssl": Forcing to "ON" breaks its condition:

    QT_FEATURE_openssl_runtime OR QT_FEATURE_openssl_linked

Condition values dump:

    QT_FEATURE_openssl_runtime = "OFF"
    QT_FEATURE_openssl_linked = "OFF"

Call Stack (most recent call first):
qtbase/cmake/QtFeature.cmake:281 (qt_configure_add_report_error)
qtbase/cmake/QtFeature.cmake:403
(qt_feature_check_and_save_internal_value)
qtbase/cmake/QtFeature.cmake:155 (qt_evaluate_feature)
qtbase/cmake/QtFeature.cmake:349 (qt_evaluate_config_expression)
qtbase/cmake/QtFeature.cmake:606 (qt_evaluate_feature)
qtbase/cmake/QtFeature.cmake:575 (qt_feature_module_end)
qtbase/src/CMakeLists.txt:9 (qt_feature_evaluate_features)


-- Could NOT find md4c (missing: md4c_DIR)
-- Could NOT find md4c (missing: md4c_DIR)
CMake Error at qtbase/cmake/QtTargetHelpers.cmake:832 (message):
WrapOpenSSLHeaders::WrapOpenSSLHeaders is not a valid target.
Call Stack (most recent call first):
qtbase/src/plugins/tls/openssl/CMakeLists.txt:54
(qt_internal_add_target_include_dirs)


-- Configuring incomplete, errors occurred!
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
https://lists.qt-project.org/listinfo/interest


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230109/0f100c36/attachment.htm>


More information about the Interest mailing list