Forward-declare X509 structure
ClosedPublic

Authored by luc4 on Jul 29 2018, 1:41 PM.

Details

Reviewers
cfeck
dfaure
Group Reviewers
Frameworks
Summary

Forward-declare X509 structure even when Qt ssl support is available but ssl-dev is not available. Without this an error "X509 has not been declared" is reported by the compiler.

Diff Detail

Repository
R239 KDELibs4Support
Lint
Lint Skipped
Unit
Unit Tests Skipped
luc4 created this revision.Jul 29 2018, 1:41 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 29 2018, 1:41 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
luc4 requested review of this revision.Jul 29 2018, 1:41 PM
luc4 retitled this revision from Forward-define X509 structure to Forward-declare X509 structure.Jul 29 2018, 9:23 PM
luc4 edited the summary of this revision. (Show Details)
dfaure requested changes to this revision.Aug 6 2018, 7:45 AM
dfaure added a subscriber: dfaure.

Can you explain why in the commit log, not just what? The diff tells us what already, but why? I assume this fixes a compilation error? Which one, on which platform? Thanks.

This revision now requires changes to proceed.Aug 6 2018, 7:45 AM
luc4 edited the summary of this revision. (Show Details)Aug 9 2018, 10:09 AM
luc4 added a comment.EditedAug 9 2018, 10:16 AM

Unfortunately it would take some time to determine what changed that made this mandatory for me. Maybe some header changed in the hierarchy and the declaration is no more included anymore? Anyway, I cannot build it without declaring it. I'm building in docker using kdeneon/plasma:dev-unstable.

The reason I don't like it, is that X509 isn't a class ;-)

Here in ksslconfig.h (generated file) I have #define KSSL_HAVE_SSL 1. Why is find_package(OpenSSL) failing for you? Any output from cmake?

luc4 added a comment.Aug 9 2018, 11:40 AM

When QT_NO_OPENSSL is defined, I see that X509 was declared as a class, so I used the same instruction.
In ksslconfig.h I have #define KSSL_HAVE_SSL 0. I don't know if I can recovery much more output, the build succeeded days ago.
Unfortunately I'm not an expert of this section, but I see that libssl-dev is not installed. Maybe that made find() fail?
In any case, if that dep is optional, I guess the build is not supposed to fail, is it?

dfaure accepted this revision.Aug 9 2018, 12:20 PM

OK, now we're getting somewhere.
If ssl-dev isn't installed, this code is compiled without SSL support, and fails

ksslcertificate.h:387:18: error: ‘X509’ has not been declared
     void setCert(X509 *c);
                  ^~~~

The implementation uses KSSL_HAVE_SSL around any use of X509, so the forward declaration is just for the headers to compile.

Can you just add a note in the commit log that this is for the case where the openssl headers are missing.

This revision is now accepted and ready to land.Aug 9 2018, 12:20 PM
luc4 edited the summary of this revision. (Show Details)Aug 9 2018, 2:19 PM