Bug 199134

Summary: [PATCH] devel/qca patch to compile with libressl
Product: Ports & Packages Reporter: Adam McDougall <ebay>
Component: Individual Port(s)Assignee: freebsd-kde (group) <kde>
Status: Closed FIXED    
Severity: Affects Some People CC: bahlgren, brnrd, makc
Priority: --- Keywords: patch
Version: LatestFlags: bugzilla: maintainer-feedback? (kde)
Hardware: amd64   
OS: Any   
Bug Depends on: 201584    
Bug Blocks:    
Attachments:
Description Flags
patch to compile with libressl
none
poudriere log with patch applied
none
conditional patch to compile with libressl
none
poudriere build log of updated patch
none
Poudriere build log on 9.3-REL none

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!