Bug 216898 - net/pjsip Doesn't compile with libressl and libressl-devel
Summary: net/pjsip Doesn't compile with libressl and libressl-devel
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-08 00:07 UTC by OlivierW
Modified: 2018-11-06 21:31 UTC (History)
1 user (show)

See Also:
madpilot: maintainer-feedback+


Attachments
Fix build errors with LIbreSSL (1.77 KB, patch)
2017-02-08 00:07 UTC, OlivierW
no flags Details | Diff
New patch to fix building PJSip 2.7 with LibreSSL (4.39 KB, patch)
2017-10-10 09:56 UTC, OlivierW
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description OlivierW 2017-02-08 00:07:51 UTC
Created attachment 179732 [details]
Fix build errors with LIbreSSL

Hello,

I(ve been using pjsip with libressl-devel for months. Unfortunately, the update to pjsip 2.6 break the compilation with libressl and libressl-devel (compile fine with openssl and openssl-devel).

The error was:
"../src/pj/ssl_sock_ossl.c:463:16: error: use of undeclared identifier 'TLSEXT_nid_unknown'
            if (nid & TLSEXT_nid_unknown) {
                      ^"

So I first tried to define it like it's done in OpenSSL, with:
#define TLSEXT_nid_unknown 0x1000000
It solved this problem, but the compilation broke even more with this messages:
"/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6/pjlib/lib/libpj.so: undefined reference to `SSL_set1_sigalgs_list'
/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6/pjlib/lib/libpj.so: undefined reference to `SSL_set1_client_sigalgs_list'
/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6/pjlib/lib/libpj.so: undefined reference to `SSL_is_server'
/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6/pjlib/lib/libpj.so: undefined reference to `SSL_get_shared_curve'
/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6/pjlib/lib/libpj.so: undefined reference to `ASN1_STRING_get0_data'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6/build/rules.mak:125: ../bin/pjlib-test-amd64-portbld-freebsd11.0] Error 1
gmake[3]: Leaving directory '/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6/pjlib/build'
gmake[2]: *** [Makefile:112: pjlib-test-amd64-portbld-freebsd11.0] Error 2
gmake[2]: Leaving directory '/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6/pjlib/build'
gmake[1]: *** [Makefile:14: all] Error 1
gmake[1]: Leaving directory '/wrkdirs/usr/ports/net/pjsip/work/pjproject-2.6'
*** Error code 1"



So, I've added conditional directives to check for LibreSSL and now it compiles fine with both libressl and libressl-devel.
Please find a patch attached.
Comment 1 OlivierW 2017-02-08 00:37:53 UTC
I've tried to propose the patch to upstream, but I don't know how... I can't find how to register to their bugtracker: https://trac.pjsip.org/repos/report
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2017-02-08 07:35:04 UTC
Hi,

Thanks for reporting this, I'll be testing your patch and committing it shortly.

Regarding upstreaming it, the pjsip guys have very strict rules for contribution, you are required to sign a legal document and send it back before they accept any contribution.

I also have patches I'd like to upstream but I still have to go through those hoops.

Also, I don't know if they will let me send these patches on your behalf, they usually require the original author of the patch to contribute it directly.

Anyway I'm going to follow their procedure but I need a little time, since I'm also busy with other daily life matters.

Will keep you informed.
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-02-08 15:42:49 UTC
A commit references this bug:

Author: madpilot
Date: Wed Feb  8 15:42:18 UTC 2017
New revision: 433654
URL: https://svnweb.freebsd.org/changeset/ports/433654

Log:
  Fix net/pjsip build with libressl.

  PR:		216898
  Submitted by:	OlivierW <olivierw1+bugzilla-freebsd@hotmail.com>

Changes:
  head/net/pjsip/files/patch-pjlib_src_pj_ssl__sock__ossl.c
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2017-02-08 15:43:44 UTC
Committed, Thanks.

I'm leaving the bug report open as a reminder to myself to upstream the patch.
Comment 5 OlivierW 2017-02-09 11:41:36 UTC
Hello Guido,

Thanks for the commit!

I'll try to contact the PJSIP team on their mailing list to see if they could include this simple patch. I'm not even touching their code, just changing a bit their "#if".
If it's really needed, I'll check more about their legal document.

Best Regards.
Comment 6 OlivierW 2017-10-10 09:56:42 UTC
Created attachment 187045 [details]
New patch to fix building PJSip 2.7 with LibreSSL

PJSip 2.7 have new tests on OPENSSL_VERSION_NUMBER and I needed to fix them for building with LibreSSL.
This patch replaces completely the previous "patch-pjlib_src_pj_ssl__sock__ossl.c".
Comment 7 OlivierW 2017-10-10 09:58:47 UTC
Hello,

I'm sorry I still haven't found the time to check PJSip's legal document and try to upstream the previous patch :-(
I'll try my best to check it in a few days.

Best Regards,
Olivier
Comment 8 Guido Falsi freebsd_committer freebsd_triage 2017-10-10 11:31:24 UTC
(In reply to OlivierW from comment #6)
> Created attachment 187045 [details]
> New patch to fix building PJSip 2.7 with LibreSSL
> 
> PJSip 2.7 have new tests on OPENSSL_VERSION_NUMBER and I needed to fix them
> for building with LibreSSL.
> This patch replaces completely the previous
> "patch-pjlib_src_pj_ssl__sock__ossl.c".

Thanks for the patch.

I need a little time to test it before committing.
Comment 9 OlivierW 2017-10-10 11:58:15 UTC
(In reply to Guido Falsi from comment #8)
No problem :-)

On my side, I'm currently using it with pjsip-extsrtp 2.7, asterisk13 13.17.2_1 and libressl-devel 2.6.2. It works as well as with pjsip 2.6 (SIP with TLS & SRTP).
Comment 10 commit-hook freebsd_committer freebsd_triage 2017-10-11 07:17:48 UTC
A commit references this bug:

Author: madpilot
Date: Wed Oct 11 07:17:15 UTC 2017
New revision: 451734
URL: https://svnweb.freebsd.org/changeset/ports/451734

Log:
  Update pjsip patch to work with libressl after the latest update
  to 2.7, which broke it.

  PR:		216898
  Submitted by:	OlivierW <olivierw1+bugzilla-freebsd@hotmail.com>

Changes:
  head/net/pjsip/files/patch-pjlib_src_pj_ssl__sock__ossl.c
Comment 11 commit-hook freebsd_committer freebsd_triage 2017-11-18 20:56:22 UTC
A commit references this bug:

Author: madpilot
Date: Sat Nov 18 20:56:01 UTC 2017
New revision: 454459
URL: https://svnweb.freebsd.org/changeset/ports/454459

Log:
  MFH: r451278 r451306 r451358 r451461 r451734 r454258

  Register conflict with libsrtp.

  Reported by:	rodrigo

  - Update net/pjsip to 2.7
  - Bump PORTVERSION on asterisk13 port to avoid ABI problems
  - While here, sort the plist

  Fix CONFLICTS to not overwrite slave port setting.

  PR:		222804
  Submitted by:	vvd@unislabs.com

  Correctly handle option caused conflict.

  PR:		222845
  Submitted by:	O. Hartmann <ohartmann@walstatt.org>

  Update pjsip patch to work with libressl after the latest update
  to 2.7, which broke it.

  PR:		216898
  Submitted by:	OlivierW <olivierw1+bugzilla-freebsd@hotmail.com>

  - Update pjsip to 2.7.1
  - Import patches from the asterisk project
  - Regenrate patches

  Security:	19b052c9-c533-11e7-8da5-001999f8d30b

  Approved by:	ports-secteam (swills)

Changes:
_U  branches/2017Q4/
  branches/2017Q4/net/asterisk13/Makefile
  branches/2017Q4/net/pjsip/Makefile
  branches/2017Q4/net/pjsip/distinfo
  branches/2017Q4/net/pjsip/files/patch-aconfigure
  branches/2017Q4/net/pjsip/files/patch-pjlib_src_pj_ssl__sock__ossl.c
  branches/2017Q4/net/pjsip/files/patch-pjmedia_build_os-auto.mak.in
  branches/2017Q4/net/pjsip/files/patch-pjsip_src_pjsip_sip__multipart.c
  branches/2017Q4/net/pjsip/files/patch-pjsip_src_pjsip_sip__parser.c
  branches/2017Q4/net/pjsip/files/patch-pjsip_src_pjsip_sip__transaction.c
  branches/2017Q4/net/pjsip/files/patch-pjsip_src_pjsip_sip__transport.c
  branches/2017Q4/net/pjsip/files/patch-third__party_build_os-auto.mak.in
  branches/2017Q4/net/pjsip/pkg-plist
Comment 12 Walter Schwarzenfeld freebsd_triage 2018-02-03 04:09:17 UTC
Forgotten to close or is it not solved?
Comment 13 OlivierW 2018-02-03 11:49:29 UTC
(In reply to w.schwarzenfeld from comment #12)
Hello,
The problem is solved in FreeBSD's port but isn't upstreamed yet, so it isn't closed at the moment (see comment #4).

I haven't forgotten about it and still plan to contact PJSip's team to upstream the patch but I haven't managed to find the time to do it (they have some legal documents to fill before being allowed to commit code).
Yes, I know it's already been waiting for a year :-/

Best Regards,
Olivier
Comment 14 Walter Schwarzenfeld freebsd_triage 2018-02-03 11:51:51 UTC
Thanks for reply!
Comment 15 Guido Falsi freebsd_committer freebsd_triage 2018-11-06 21:31:02 UTC
PJSIP 2.8 is out and it includes changes to the effect of these patches, so I'm closing this.

I'm holding back on updating the pjsip ports since asterisk (the only port depending on it) at present fails at runtime with the new pjsip version.

I'm monitoring the situation.