Bug 230913

Summary: devel/librelp 1.2.17 Undefined symbol "SSL_set_ex_data if linked with openssl
Product: Ports & Packages Reporter: Axel.Rau
Component: Individual Port(s)Assignee: Matthew Seaman <matthew>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
poudriere testport log of librelp-1.2.17
none
patches to devel/librelp and sysutils/rsyslog8 none

Description Axel.Rau 2018-08-26 14:12:36 UTC
Created attachment 196566 [details]
poudriere testport log of librelp-1.2.17

If port option OPENSSL is set, loading librelp at runtime fails:

Installed packages to be UPGRADED:
	rsyslog: 8.36.0 -> 8.37.0
	p11-kit: 0.23.12 -> 0.23.13
	librelp: 1.2.16 -> 1.2.17
	libnghttp2: 1.32.0 -> 1.32.1
	gnutls: 3.5.18 -> 3.5.19


. . .
[krb] [4/5] Upgrading librelp from 1.2.16 to 1.2.17...
[krb] [4/5] Extracting librelp-1.2.17: 100%

. . .
root@krb:/ # service rsyslogd restart
Stopping rsyslogd.
Waiting for PIDS: 12187.
Starting rsyslogd.
rsyslogd: could not load module '/usr/local/lib/rsyslog/omrelp.so', dlopen: /usr/local/lib/librelp.so.0: Undefined symbol "SSL_set_ex_data"  [v8.37.0 try http://www.rsyslog.com/e/2066 ]

No problems with librelp 1.2.16.

root@krb:/ # uname -a
FreeBSD krb 11.2-RELEASE-p2 FreeBSD 11.2-RELEASE-p2 #0: Tue Aug 14 21:45:40 UTC 2018     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
root@krb:/ # openssl version
OpenSSL 1.0.2o-freebsd  27 Mar 2018

testport log attached
Comment 1 Matthew Seaman freebsd_committer freebsd_triage 2018-08-26 15:51:48 UTC
What are the options settings you're using for rsyslog8 please?

Initial assesment: it looks like I need to add an openssl option in rsyslog8 to match the one in librelp, and that you will have to choose matching settings for openssl or gnutls in both rsyslog and librelp.  

It's annoying this doesn't trigger any errors until it fails at run-time.
Comment 2 Matthew Seaman freebsd_committer freebsd_triage 2018-08-26 18:32:17 UTC
Created attachment 196577 [details]
patches to devel/librelp and sysutils/rsyslog8

This should fix linkage of librelp and rsyslog8 when the OPENSSL option is selected in either port.
Comment 3 Matthew Seaman freebsd_committer freebsd_triage 2018-08-26 18:38:20 UTC
Hi,

Can you try the patches I just uploaded, and let me know how you get on please?  The patches add a new radio-button option to rsyslog8 which lets you choose one out of:

   GnuTLS
   OpenSSL
   No ssl support

in rsyslog8.  I haven't confirmed this yet, but if you're enabling RELP support in rsyslog8 I suspect you'll either need to use the same TLS library as for librelp, or turn off both TLS libraries in rsyslog8.  Please let me know how you get on.

Matthew
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-08-27 09:51:02 UTC
A commit references this bug:

Author: matthew
Date: Mon Aug 27 09:50:23 UTC 2018
New revision: 478186
URL: https://svnweb.freebsd.org/changeset/ports/478186

Log:
  Fix linkage against libcrypto.so when the OPENSSL option is selected.
  Previously this compiling successfully but resulting in run-time
  failures in applications (rsyslog essentially) that consumed librelp.

  PR:		230913
  Submitted by:	Axel.Rau@Chaos1.DE

Changes:
  head/devel/librelp/Makefile
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-08-28 06:49:50 UTC
A commit references this bug:

Author: matthew
Date: Tue Aug 28 06:49:05 UTC 2018
New revision: 478287
URL: https://svnweb.freebsd.org/changeset/ports/478287

Log:
  Add a new OPENSSL option as an alternative to GNUTLS.  This parallels
  a simlar fix to librelp, and tracks the upstream project's intention
  to switch from gnutls to openssl over time.  The default remains to
  not compile in any TLS support in rsyslog8.

  PR:		230913

Changes:
  head/sysutils/rsyslog8/Makefile
  head/sysutils/rsyslog8/pkg-plist
Comment 6 Axel.Rau 2018-08-28 13:28:47 UTC
Still does not work as expected:

New packages to be INSTALLED:
	rsyslog: 8.37.0_1 [lrau-repo]
	librelp: 1.2.17_1 [lrau-repo]
rsyslogd: could not load module '/usr/local/lib/rsyslog/omrelp.so', dlopen: /usr/local/lib/librelp.so.0: Undefined symbol "SSL_set_ex_data"  [v8.37.0 try http://www.rsyslog.com/e/2066 ]

# pkg query "%Okv" devel/librelp
GNUTLSv
OPENSSLv
# pkg query "%Ov" devel/librelp
off
on

# pkg query "%Ok" sysutils/rsyslog8
DBI
DOCS
ELASTIC
GCRYPT
GNUTLS
GSSAPI
JSONPARSE
MYSQL
NORMALIZE
OPENSSL
PGSQL
RELP
SNMP
# pkg query "%Ov" sysutils/rsyslog8
off
off
off
off
off
off
off
off
off
on
off
on
off

Interesting side effect:

# poudriere options -j 112amd64 devel/librelp
[00:00:00] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
===> Setting user-specified options for librelp-1.2.17_1 and dependencies
# grep DIALOG make.conf 
# grep DIALOG /etc/make.conf
# [No option dialog displayed]

Question: Does your option combination trigger a bug in dialog4ports-0.1.6 ?
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-09-02 07:01:19 UTC
A commit references this bug:

Author: matthew
Date: Sun Sep  2 07:00:19 UTC 2018
New revision: 478763
URL: https://svnweb.freebsd.org/changeset/ports/478763

Log:
  Second try at fixing the linking problems with librelp when the
  OPENSSL option is selected.  The undefined symbol 'SSL_set_ex_data'
  from the original PR clearly comes from libssl.so.

  PR:		230913
  Submitted by:	Axel.Rau@Chaos1.DE

Changes:
  head/devel/librelp/Makefile
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-09-02 07:03:24 UTC
A commit references this bug:

Author: matthew
Date: Sun Sep  2 07:02:58 UTC 2018
New revision: 478765
URL: https://svnweb.freebsd.org/changeset/ports/478765

Log:
  Second try at fixing linking problems with the OPENSSL option is selected.

  PR:		230913
  Submitted by:	Axel.Rau@Chaos1.DE

Changes:
  head/sysutils/rsyslog8/Makefile
Comment 9 Axel.Rau 2018-09-13 09:58:10 UTC
Works now as expected.
Thanks for the fix!