Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 576272 - mail-mta/postfix-3.1.0 "error: ‘OPENSSL_VERSION’ undeclared" with dev-libs/libressl
Summary: mail-mta/postfix-3.1.0 "error: ‘OPENSSL_VERSION’ undeclared" with dev-libs/li...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: libressl-support
  Show dependency tree
 
Reported: 2016-03-02 17:54 UTC by Nick Wallingford
Modified: 2016-06-14 14:14 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
postfix-3.1.0_build.log (build.log,201.89 KB, text/x-log)
2016-03-02 17:54 UTC, Nick Wallingford
Details
emerge --info (emerge_info,5.04 KB, text/plain)
2016-03-02 18:16 UTC, Nick Wallingford
Details
Patch to postfix-3.1.0 to compile with libressl (postfix-3.1.0-libressl.patch,377 bytes, patch)
2016-03-07 02:05 UTC, maurerpe
Details | Diff
Patch to ebuilds to apply libressl patch (postfix.diff,974 bytes, patch)
2016-03-07 02:08 UTC, maurerpe
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Wallingford 2016-03-02 17:54:49 UTC
Created attachment 427232 [details]
postfix-3.1.0_build.log

When attempting to upgrade to postfix-3.1.0, it fails to compile with:

tls_misc.c: In function ‘tls_check_version’:
tls_misc.c:962:23: warning: implicit declaration of function ‘OpenSSL_version_num’ [-Wimplicit-function-declaration]
     tls_version_split(OpenSSL_version_num(), &lib_info);
                       ^
tls_misc.c: In function ‘tls_run_version’:
tls_misc.c:984:13: warning: implicit declaration of function ‘OpenSSL_version’ [-Wimplicit-function-declaration]
     return (OpenSSL_version(OPENSSL_VERSION));
             ^
tls_misc.c:984:29: error: ‘OPENSSL_VERSION’ undeclared (first use in this function)
     return (OpenSSL_version(OPENSSL_VERSION));
                             ^
tls_misc.c:984:29: note: each undeclared identifier is reported only once for each function it appears in
Makefile:83: recipe for target 'tls_misc.o' failed

Note that I am using libressl. It is quite possible this is a libressl related bug.
Comment 1 Nick Wallingford 2016-03-02 18:16:23 UTC
Created attachment 427236 [details]
emerge --info
Comment 2 timofonic 2016-03-03 18:43:33 UTC
Any news?
Comment 3 Nick Wallingford 2016-03-05 19:13:46 UTC
In dev-libs/openssl-1.0.2g-r2, /usr/include/openssl/opensslv.h does #define OPENSSL_VERSION_NUMBER 0x1000207fL

In dev-libs/libressl-2.2.6, /usr/include/openssl/opensslv.h does #define OPENSSL_VERSION_NUMBER 0x20000000L

In mail-mta/postfix-3.1.0, OPENSSL_VERSION is defined in src/tls/tls.h via the following:

 /* Backwards compatibility with OpenSSL < 1.1.0 */
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define OpenSSL_version_num SSLeay
#define OpenSSL_version SSLeay_version
#define OPENSSL_VERSION SSLEAY_VERSION
#define X509_up_ref(x) CRYPTO_add(&((x)->references), 1, CRYPTO_LOCK_X509)
#endif

So that doesn't trigger with libressl. Munging libressl-provided opensslv.h to fudge OPENSSL_VERSION_NUMBER to match the string provided by openssl allows postfix to compile successfully.
Comment 4 maurerpe 2016-03-07 02:05:39 UTC
Created attachment 427646 [details, diff]
Patch to postfix-3.1.0 to compile with libressl
Comment 5 maurerpe 2016-03-07 02:08:13 UTC
Created attachment 427648 [details, diff]
Patch to ebuilds to apply libressl patch

These fix the issue.  I will add them to the libressl overlay as well.
Comment 6 Nick Wallingford 2016-06-03 21:30:11 UTC
This bug still exists in postfix-3.1.1. Unfortunately, the linked patch fails to fix the issue.
Comment 7 Reuben Farrelly 2016-06-04 10:47:22 UTC
I am experiencing this problem as well.

This very simple patch, from the OpenBSD tree, fixed the libressl build problem for me with Postfix snapshots:

http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/mail/postfix/snapshot/patches/patch-src_tls_tls_h

OpenBSD apply this to the release versions of Postfix as well as snapshots.

I have been running this on 4 systems for the past 3 days without any problems so far.
Comment 8 Eray Aslan gentoo-dev 2016-06-05 13:40:37 UTC
OpenBSD patch added for postfix-3.2_pre20160604.  Please test and let me know as I do not have access to a libressl system.  Thanks.
Comment 9 Reuben Farrelly 2016-06-06 09:28:56 UTC
Thanks Eray -I can confirm the libressl patch works well for me.
Comment 10 Eray Aslan gentoo-dev 2016-06-14 08:31:31 UTC
Should be fixed in mail-mta/postfix-3.1.1-r1.