Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 609718 - net-misc/asterisk-13.19.0 pjproject support broken
Summary: net-misc/asterisk-13.19.0 pjproject support broken
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Tony Vroon (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-18 13:21 UTC by Alexander Wetzel
Modified: 2018-05-02 17:26 UTC (History)
6 users (show)

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


Attachments
messages-official (messages-official,11.17 KB, text/plain)
2017-09-20 20:34 UTC, Alexander Wetzel
Details
messages-pjproject-patched (messages-pjproject-patched,11.24 KB, text/plain)
2017-09-20 20:38 UTC, Alexander Wetzel
Details
messages-fully-patched (messages-fully-patched,1.03 KB, text/plain)
2017-09-20 20:38 UTC, Alexander Wetzel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Wetzel 2017-02-18 13:21:15 UTC
net-misc/asterisk-13.13.1 compiled with Use pjproject is generating unusable pj modules.

All res_pjsip* modules will report unresolved symbols and can't be loaded.

This is caused by two bugs:

1) Upstream bug https://issues.asterisk.org/jira/browse/ASTERISK-26518
which should only apply if you have an hardened built. (I can confirm it applies to gentoo-hardened, but have not tested it on normal gentoo.)

2) Broken ssl support in net-libs/pjproject-2.5.1 (see bug 609702)

The first problem is still unresolved upstream as for today, but the patch "restore_multihomed_module.patch" from Alex Hermann from the upstream bug report fixes the issue for me, after fixing the broken ssl support in net-libs/pjproject-2.5.1.


Here an "emerge --info net-misc/asterisk net-libs/pjproject" (after fixing the the two bugs)

# emerge --info net-misc/asterisk net-libs/pjproject
Portage 2.3.3 (python 2.7.12-final-0, hardened/linux/amd64/selinux, gcc-4.9.4, glibc-2.23-r3, 4.8.17-hardened-r2 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.8.17-hardened-r2-x86_64-Intel_Xeon_E3-12xx_v2_-Ivy_Bridge-with-gentoo-2.3
KiB Mem:    10235512 total,   9164012 free
KiB Swap:     389116 total,    389116 free
Timestamp of repository gentoo: Fri, 17 Feb 2017 00:45:01 +0000
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-lang/perl:            5.22.3_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.7.2::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.22.4::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.4::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://owl.mordor/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/fax /var/spool/fax/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.uni-erlangen.de/pub/mirrors/gentoo"
LANG="POSIX"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl alaw amd64 berkdb bzip2 cli cracklib crypt cxx dri gdbm hardened iconv ipv6 justify modules multilib ncurses nls nptl open_perms openmp pam pax_kernel pcre pie readline seccomp selinux session ssl ssp tcpd unconfined unicode urandom xattr xtpax zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

net-misc/asterisk-13.13.1::gentoo was built with the following:
USE="caps iconv ilbc lua pjproject samples (selinux) speex srtp -alsa -bluetooth -calendar -cluster -curl -dahdi -debug -doc -freetds -gtalk -http -ldap -libedit -libressl -mysql -newt -odbc -osplookup -oss -portaudio -postgres -radius -snmp -span -static -syslog -vorbis -xmpp" ABI_X86="64" VOICEMAIL_STORAGE="file -imap -odbc"


net-libs/pjproject-2.5.1::gentoo was built with the following:
USE="ipv6 ssl -alsa -amr -debug -doc -epoll -examples -ffmpeg -g711 -g722 -g7221 -gsm -ilbc -l16 -libyuv -openh264 -opus -oss -portaudio -resample -sdl -silk -speex -static-libs -v4l2 -webrtc" ABI_X86="64"
CFLAGS="-march=native -O2 -pipe -DPJ_HAS_IPV6=1 -DNDEBUG=1"
CXXFLAGS="-march=native -O2 -pipe -DPJ_HAS_IPV6=1 -DNDEBUG=1"
Comment 1 Tony Vroon (RETIRED) gentoo-dev 2017-09-19 09:25:47 UTC
Could you test Asterisk 13.17.0 with PJproject 2.6 please, and see if this is any better for you?
Comment 2 Alexander Wetzel 2017-09-20 20:34:46 UTC
Created attachment 495682 [details]
messages-official

Short version: nothing changed, but it seems related to hardened only...

Here the full report:

I've removed all custom patches and the local overlay and uninstalled my custom asterisk version (14.6.1) and pjproject.
Then I called "emerge -av =net-misc/asterisk-13.17.2", which pulled in net-libs/pjproject-2.6 from the official gentoo repository.

I've attached the log from starting asterisk as "messages-official", and both bugs are still there. (Not unexpected, more below.)
I still get the telltale "undefined symbol: pj_ssl_cipher_name" for the pjproject build bug.
Connecting with "asterisk -r" and looking for any "pjsip" commands shows, that there indeed is no working pjsip module.

I've then added the patch from bug 609702 again and recompiled pjproject (but not asterisk), which fixed the undefined symbol error for pj_ssl_cipher_name, but still throws quite many undefined symbols. I'll also upload the logfile "messages-pjproject-patched"

Finally I enabled the patch from the upstream bug again, which restored the pjsip functionality. I'll also upload the logfile "messages-fully-patched" showing the final start.

But there is something very interesting I found out some months ago:
Pjsip in asterisk is working fine on another gentoo installation with - ignoring selinux - the same use flags.
While it makes same sense that, since the upstream bug clearly specifies, that the bug can be avoided by disabling "_hardened_" build.
Assuming that a normal gentoo is not enabling the _hardened_ build flag for asterisk that seems to be fine.
But I don't get why I can't reproduce bug 609702 on the other system.

This other system where it's working has the following differences:
 - not using the hardened profile
 - it's fully unstable (~amd64)
 - It's using systemd instead of openrc

The last difference is preventing me build binary packages and move them around, I tried that some months ago and finally gave up.
Comment 3 Alexander Wetzel 2017-09-20 20:38:02 UTC
Created attachment 495688 [details]
messages-pjproject-patched
Comment 4 Alexander Wetzel 2017-09-20 20:38:38 UTC
Created attachment 495690 [details]
messages-fully-patched
Comment 5 Tony Vroon (RETIRED) gentoo-dev 2018-01-25 11:01:00 UTC
13.19.0 is an important milestone, as this merges the Asterisk-side circular reference fixes. I can confirm this affects my production system, suggesting that at least the pjproject-side patching is still required.
Could you confirm that for your affected machine please?
Comment 6 Alexander Wetzel 2018-01-27 16:44:27 UTC
Yes, the new version is also working for me. (Only checked if modules can be loaded, not used in production.)

I installed the official net-misc/asterisk-13.19.0-r1 and net-libs/pjproject-2.6. The modules are now loading fine, as long as pjproject-2.6 still got build with the ssl fix. 
Looks like this issue can be closed now :-)

Side note:
Something seems to be broken now with dependencies, I had to manually install  media-libs/speexdsp for pjproject to compile with use flag speex set.
Comment 7 Tony Vroon (RETIRED) gentoo-dev 2018-02-06 14:12:09 UTC
Thank you, with the pjproject side fix now in the tree (as 2.7.1) this should be fully addressed.
Comment 8 Attila Tóth 2018-02-09 20:37:20 UTC
(In reply to Tony Vroon from comment #7)
> Thank you, with the pjproject side fix now in the tree (as 2.7.1) this
> should be fully addressed.

pjproject-2.7.1 fails to compile with:
-shared -Wl,-soname,libwebrtc.so.2
output/libwebrtc-x86_64-pc-linux-gnu/common_audio/signal_processing/complex_fft.o: In function `WebRtcSpl_ComplexFFT':
complex_fft.c:(.text+0x0): multiple definition of `WebRtcSpl_ComplexFFT'
output/libwebrtc-x86_64-pc-linux-gnu/common_audio/signal_processing/complex_fft.o:complex_fft.c:(.text+0x0): first defined here
output/libwebrtc-x86_64-pc-linux-gnu/common_audio/signal_processing/complex_fft.o: In function `WebRtcSpl_ComplexIFFT':
complex_fft.c:(.text+0x330): multiple definition of `WebRtcSpl_ComplexIFFT'
output/libwebrtc-x86_64-pc-linux-gnu/common_audio/signal_processing/complex_fft.o:complex_fft.c:(.text+0x330): first defined here
collect2: error: ld returned 1 exit status

As it turns out, this is because output/libwebrtc-x86_64-pc-linux-gnu/common_audio/signal_processing/complex_fft.o has been added twice for linking. However correcting this will result in a further error:
/var/tmp/portage/net-libs/pjproject-2.7.1/work/pjproject-2.7.1/third_party/lib/libwebrtc.so: undefined reference to `WebRtc_GetCPUInfo'
/var/tmp/portage/net-libs/pjproject-2.7.1/work/pjproject-2.7.1/third_party/lib/libwebrtc.so: undefined reference to `WebRtcAec_InitAec_SSE2'
/var/tmp/portage/net-libs/pjproject-2.7.1/work/pjproject-2.7.1/third_party/lib/libwebrtc.so: undefined reference to `aec_rdft_init_sse2'

Which drove me to the crucial problem:
third_party/build/os-auto.mak.in has a section which will compile different sources for sse2, neon, etc. The sse2 section didn't get activated.

My two dimes workaround works as a user patch:
diff -urNp pjproject-2.7.1-orig/third_party/build/os-auto.mak.in pjproject-2.7.1-dwok/third_party/build/os-auto.mak.in
--- pjproject-2.7.1-orig/third_party/build/os-auto.mak.in       2017-09-22 04:42:22.000000000 +0200
+++ pjproject-2.7.1-dwok/third_party/build/os-auto.mak.in       2018-02-09 21:19:50.113584227 +0100
@@ -79,7 +79,7 @@ ifeq (@ac_external_webrtc@,1)
 else
 DIRS += webrtc
 WEBRTC_OTHER_CFLAGS = -fexceptions -DWEBRTC_POSIX=1 @ac_webrtc_cflags@
-ifneq ($(findstring sse2,@ac_webrtc_instset@),)
+ifeq ($(findstring sse2,@ac_webrtc_instset@),)
     WEBRTC_SRC = \
              modules/audio_processing/aec/aec_core_sse2.o               \
              modules/audio_processing/aec/aec_rdft_sse2.o               \

At it compiles fine.

Other remarks on the ebuild: it fails to remove .a files. Although it is at the end of the install, but somehow the ebuild tries to run it before the files get there...
Comment 9 Attila Tóth 2018-02-09 21:07:36 UTC
(In reply to Tony Vroon from comment #7)
> Thank you, with the pjproject side fix now in the tree (as 2.7.1) this
> should be fully addressed.

And it won't compile against mediastreamer-bcg729, but against media-libs/bcg729 only.
Comment 10 grsch-gentoobug 2018-03-01 19:49:42 UTC
Note: I'm inputting my findings to this bug, because I suspect my problems to be closely related and - it seems to me - systemic and therefore likely recurring, unless gentoo packaging/ebuild procedure change.

Configuration is: asterisk-13.19.0-r1 with pjproject-2.7.1
missing symbols when configuring pjsip tls transport: pjsip_tls_transport_start2 and pj_ssl_cipher_get_availables

Problems persisted when upgrading to asterisk-13.19.2 (LTS version) when using ebuild in /usr/local/portage.
Problems persisted when manually building asterisk-13.19.2 in /usr/src.
Problems disappeared when configuring asterisk with --with-pjproject-bundled .

When I checked what this option changed, I noticed that asterisk-13.19.2 was indeed downloading pjproject-2.7.1 (Note: the same version installed previously via emerge), but was additionally patching it with patches under ${AST_SRC}/third-party/pjproject/patches (!)

Alarmed, I inquired in freenode #asterisk on the rationale for bundling pjproject patches with asterisk. The answer I got is... understandable, but troublesome for distributions like Gentoo.
Summarizing what I understood:
 - pjsip was always designed as integral - embedded part of asterisk, but was split apart as dynamic library because there was interest for shared pjsip libraries
 - pjsip releases versions much slower than asterisk would need updates - so patches are included in asterisk (I guess, because packaging them with pjproject would entail issues for other projects using the libraries)
 - upstream suspected my troubles more likely to be connected to bad building parameters for pjproject, as asterisk supposedly requires a very specific configuration
=> Gentoo would either need to tweak their pjproject default build to asterisk's requirements (I guess: with unforseen consequences to other projects) - possibly needing to extract and apply patches from the corresponding asterisk tarball
or Gentoo would need to build asterisk with the bundled pjproject (and I guess: should delete the dependency to the pjproject package)

Either way, I understand, the problems are and will likely be recurring, unless Gentoo's packaging is changed, as asterisk effectively (my view) uses a different version of pjproject with a specific configuration under the same pjproject version number.
Comment 11 grsch-gentoobug 2018-03-01 22:09:16 UTC
Update: adding --with-pjproject-bundled to econf of my asterisk-13.19.2.ebuild (copied from the official one) results in an installation where loading pjsip with a defined tls transport works. 

Possibly, one will need to do more, as I noticed a --disable-gsm I won't like scrolling by in the pjproject configuration - but the missing symbols are no issue anymore.
Comment 12 Dan 2018-05-02 17:26:25 UTC
I have same issue. If i will compile asterisk with --with-pjproject-bundled, then i didn't have any issue.

Maybe someone will edit ebuild file ?