Bug 199134 - [PATCH] devel/qca patch to compile with libressl
Summary: [PATCH] devel/qca patch to compile with libressl
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-kde (group)
URL:
Keywords: patch
Depends on: 201584
Blocks:
  Show dependency treegraph
 
Reported: 2015-04-03 02:41 UTC by Adam McDougall
Modified: 2015-11-07 10:33 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (kde)


Attachments
patch to compile with libressl (1.02 KB, patch)
2015-04-03 02:41 UTC, Adam McDougall
no flags Details | Diff
poudriere log with patch applied (147.01 KB, text/x-log)
2015-04-03 02:42 UTC, Adam McDougall
no flags Details
conditional patch to compile with libressl (1.22 KB, patch)
2015-04-03 17:04 UTC, Adam McDougall
no flags Details | Diff
poudriere build log of updated patch (167.78 KB, text/x-log)
2015-04-03 17:05 UTC, Adam McDougall
no flags Details
Poudriere build log on 9.3-REL (129.44 KB, text/plain)
2015-07-15 15:59 UTC, Bengt Ahlgren
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam McDougall 2015-04-03 02:41:32 UTC
Created attachment 155143 [details]
patch to compile with libressl

devel/qca fails to compile with libressl:

[100%] Building CXX object plugins/qca-gnupg/CMakeFiles/qca-gnupg.dir/moc_gpgaction.cxx.o
cd /wrkdirs/usr/ports/devel/qca/work/.build/plugins/qca-gnupg && /usr/bin/c++   -DQCA_SYSTEMSTORE_PATH=\"/usr/local/share/certs/ca-root-nss.crt\" -DQT_CORE_LIB -DQT_NO_DEBUG -Dqca_gnupg_EXPORTS -O2 -pipe -fstack-protector -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -fPIC -I/wrkdirs/usr/ports/devel/qca/work/.build/plugins/qca-gnupg -I/wrkdirs/usr/ports/devel/qca/work/qca-2.1.0/plugins/qca-gnupg -I/wrkdirs/usr/ports/devel/qca/work/qca-2.1.0/include/QtCrypto -I/wrkdirs/usr/ports/devel/qca/work/.build -I/wrkdirs/usr/ports/devel/qca/work/qca-2.1.0/plugins/qca-gnupg/gpgproc -isystem /usr/local/include/qt4 -isystem /usr/local/include/qt4/QtCore -isystem /usr/local/share/qt4/mkspecs/default -o CMakeFiles/qca-gnupg.dir/moc_gpgaction.cxx.o -c /wrkdirs/usr/ports/devel/qca/work/.build/plugins/qca-gnupg/moc_gpgaction.cxx
--- plugins/qca-ossl/CMakeFiles/qca-ossl.dir/all ---
/wrkdirs/usr/ports/devel/qca/work/qca-2.1.0/plugins/qca-ossl/qca-ossl.cpp:5804:47: error: no member named 'compress_meth' in 'ssl_session_st'
                sessInfo.isCompressed = (0 != ssl->session->compress_meth);
                                              ~~~~~~~~~~~~  ^
1 error generated.
*** [plugins/qca-ossl/CMakeFiles/qca-ossl.dir/qca-ossl.cpp.o] Error code 1

audio/clementine depends on devel/qca.  I am attaching a patch and poudriere build log.
Comment 1 Adam McDougall 2015-04-03 02:42:19 UTC
Created attachment 155144 [details]
poudriere log with patch applied
Comment 2 Bernard Spil freebsd_committer freebsd_triage 2015-04-03 16:02:12 UTC
Probably best to find somewhere where it imports ssl and then a try-fail block?
as in https://github.com/Sp1l/ports/blob/master/lang/python27/files/patch-Lib_ssl.py

Alternatively this I found in tests
https://github.com/Sp1l/ports/blob/master/lang/python27/files/patch-Lib_test_test__ssl.py

Busy weekend, could perhaps give it a go Sunday or Monday...

Thanks for the heads-up, was in my GitHub ports tree yet not in https://wiki.freebsd.org/LibreSSL
Comment 3 Bernard Spil freebsd_committer freebsd_triage 2015-04-03 16:43:54 UTC
Try this...

ssl.h -> opensslconf.h -> opensslfeatures.h defines OPENSSL_NO_COMP

--- plugins/qca-ossl/qca-ossl.cpp.orig  2014-11-06 09:15:45.000000000 +0100
+++ plugins/qca-ossl/qca-ossl.cpp       2015-04-03 18:39:25.001532367 +0200
@@ -5801,7 +5801,11 @@
        {
                SessionInfo sessInfo;

+#ifndef OPENSSL_NO_COMP
                sessInfo.isCompressed = (0 != ssl->session->compress_meth);
+#else
+               sessInfo.isCompressed = 0;
+#fi

                if (ssl->version == TLS1_VERSION)
                        sessInfo.version = TLS::TLS_v1;
Comment 4 Adam McDougall 2015-04-03 17:04:22 UTC
Created attachment 155163 [details]
conditional patch to compile with libressl

Thanks Bernard!  I tweaked the #fi and made a new patch.  I will also attach the successful build log.
Comment 5 Adam McDougall 2015-04-03 17:05:51 UTC
Created attachment 155164 [details]
poudriere build log of updated patch
Comment 6 Raphael Kubo da Costa freebsd_committer freebsd_triage 2015-07-12 19:17:04 UTC
It looks like this was fixed upstream with a slightly different patch: http://quickgit.kde.org/?p=qca.git&a=commit&h=593de6855a4f4dc26cface3e96de8889f90cb4bb

alonso@ is going to land this version soon.
Comment 7 commit-hook freebsd_committer freebsd_triage 2015-07-14 19:18:11 UTC
A commit references this bug:

Author: alonso
Date: Tue Jul 14 19:17:40 UTC 2015
New revision: 392050
URL: https://svnweb.freebsd.org/changeset/ports/392050

Log:
  Fix build with libressl

  Add an upstream patch to address OpenSSL compression handling.

  PR:		199134
  Approved by:	rakuco (mentor)
  Obtained from:	qca upstream

Changes:
  head/devel/qca/Makefile
  head/devel/qca/files/patch-git_593de685
Comment 8 Bengt Ahlgren 2015-07-15 15:59:11 UTC
Created attachment 158803 [details]
Poudriere build log on 9.3-REL

It unfortunately does not build on 9.3-REL - see attached poudriere log.
Comment 9 commit-hook freebsd_committer freebsd_triage 2015-07-16 05:30:22 UTC
A commit references this bug:

Author: alonso
Date: Thu Jul 16 05:29:23 UTC 2015
New revision: 392272
URL: https://svnweb.freebsd.org/changeset/ports/392272

Log:
  Revert 392050

  While 392050 fixed the libressl build, it broke compilation against FreeBSD-8
  and FreeBSD-9's base openssl.

  PR:		199134
  PR:		201584

Changes:
  head/devel/qca/Makefile
  head/devel/qca/files/patch-git_593de685
Comment 10 Bernard Spil freebsd_committer freebsd_triage 2015-07-20 09:33:29 UTC
Can't tell if that patch from upstream works but seems that SSL_SESSION_get_compress_id is not defined in older OpenSSL versions (< 1.0.1?)
The original patch using OPENSSL_NO_COMP should work just fine for LibreSSL with the original 
   sessInfo.isCompressed = (0 != ssl->session->compress_meth);
construct
Comment 11 commit-hook freebsd_committer freebsd_triage 2015-11-07 10:26:18 UTC
A commit references this bug:

Author: makc
Date: Sat Nov  7 10:26:09 UTC 2015
New revision: 400975
URL: https://svnweb.freebsd.org/changeset/ports/400975

Log:
  devel/qca:
  - Fix build with LibreSSL and with old OpenSSL (FreeBSD 9.x)

  PR:		199134
  PR:		204305

Changes:
  head/devel/qca/files/
  head/devel/qca/files/patch-libressl
Comment 12 Max Brazhnikov freebsd_committer freebsd_triage 2015-11-07 10:33:08 UTC
Committed, thanks!