Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 652586 - net-im/coturn - add libressl support
Summary: net-im/coturn - add libressl support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Andreas Schürch
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: libressl-support
  Show dependency tree
 
Reported: 2018-04-05 12:36 UTC by Daniel Kenzelmann
Modified: 2018-09-18 17:44 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Kenzelmann 2018-04-05 12:36:21 UTC
net-im/coturn currently does not support libressl

When adding libressl use flag to the ebuild as per https://wiki.gentoo.org/wiki/Project:LibreSSL
the compile fails due to undefined reference to `BIO_...


The compile error has been reported upstream in https://github.com/coturn/coturn/issues/232


cc  -march=x86-64 -O2 -pipe -mtune=generic -g  -Wall -Wno-deprecated-declarations -Wextra -Wformat-security -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Wcast-qual -I/usr/include -I/usr/include/ -I/usr/local/include -march=x86-64 -O2 -pipe -mtune=generic -DTURN_HAS_DAEMON       -DINSTALL_PREFIX=/usr -DTURNDB=/var/lib/db/turndb -Isrc -Isrc/apps/common -Isrc/server -Isrc/client -Isrc/client++ -I/usr/include/ -I/usr/local/include/  -DTURN_NO_PQ -DTURN_NO_MYSQL -DTURN_NO_SQLITE -DTURN_NO_MONGO -DTURN_NO_HIREDIS src/apps/relay/ns_ioalib_engine_impl.c src/apps/relay/turn_ports.c src/apps/relay/http_server.c -Ilib src/apps/relay/mainrelay.c src/apps/relay/netengine.c src/apps/relay/libtelnet.c src/apps/relay/turn_admin_server.c src/apps/relay/userdb.c src/apps/relay/tls_listener.c src/apps/relay/dtls_listener.c src/apps/common/hiredis_libevent2.c src/apps/relay/dbdrivers/dbdriver.c src/apps/relay/dbdrivers/dbd_sqlite.c src/apps/relay/dbdrivers/dbd_pgsql.c src/apps/relay/dbdrivers/dbd_mysql.c src/apps/relay/dbdrivers/dbd_mongo.c src/apps/relay/dbdrivers/dbd_redis.c src/apps/common/apputils.c src/apps/common/ns_turn_utils.c src/apps/common/stun_buffer.c src/client/ns_turn_ioaddr.c src/client/ns_turn_msg_addr.c src/client/ns_turn_msg.c  src/server/ns_turn_allocation.c src/server/ns_turn_maps_rtcp.c src/server/ns_turn_maps.c src/server/ns_turn_server.c -o bin/turnserver  -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed -L/usr/lib/ -L/usr/local/lib/ -L/usr/lib64/ -L/usr/local/lib64/ -lrt -lnsl -lresolv -pthread -lcrypto -lssl -levent_core -levent_extra -levent_openssl -levent_pthreads  -Wl,-rpath,/usr/lib/ -Wl,-rpath,/usr/local/lib/ -Wl,-rpath,/usr/lib64/ -Wl,-rpath,/usr/local/lib64/ -Wl,-rpath,/usr/local/lib 
src/apps/relay/turn_admin_server.c: In function ‘https_print_top_page_header’:
src/apps/relay/turn_admin_server.c:1416:64: warning: ‘</i></b><br>
   ’ directive output may be truncated writing 14 bytes into a region of size between 13 and 45 [-Wformat-truncation=]
     snprintf(dst,ADMIN_USER_MAX_LENGTH*2," admin user: <b><i>%s</i></b><br>\r\n",as->as_login);
                                                                ^~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from src/apps/relay/turn_admin_server.c:32:
/usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 34 and 66 bytes into a destination of size 64
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/server/ns_turn_server.c: In function ‘handle_turn_allocate’:
src/server/ns_turn_server.c:1144:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if(even_port>0) {
       ^
src/server/ns_turn_server.c:1149:4: note: here
    case STUN_ATTRIBUTE_REQUESTED_ADDRESS_FAMILY: {
    ^~~~
/usr/lib//libevent_openssl.so: undefined reference to `BIO_set_data'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_set_shutdown'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_meth_set_read'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_meth_set_puts'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_set_init'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_meth_set_destroy'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_meth_new'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_meth_set_write'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_get_init'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_get_shutdown'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_get_data'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_meth_set_ctrl'
/usr/lib//libevent_openssl.so: undefined reference to `BIO_meth_set_create'
collect2: error: ld returned 1 exit status
make: *** [Makefile:134: bin/turnserver] Error 1
 * ERROR: net-im/coturn-9999::localrepo failed (compile phase):
 *   emake failed




==============
emerge --info

Portage 2.3.28 (python 3.5.5-final-0, default/linux/amd64/17.0/no-multilib/hardened, gcc-7.3.0, glibc-2.26-r6, 4.15.10-gentoo x86_64)
=================================================================
System uname: Linux-4.15.10-gentoo-x86_64-QEMU_Virtual_CPU_version_2.5+-with-gentoo-2.4.1
KiB Mem:     1013380 total,    515964 free
KiB Swap:    1046504 total,   1046504 free
Timestamp of repository gentoo: Thu, 05 Apr 2018 10:00:01 +0000
Head commit of repository gentoo: 52371857a104510b70bd1a1e6412b2f4ab3a2381
sh bash 4.4_p19
ld GNU ld (Gentoo 2.30 p1) 2.30.0
app-shells/bash:          4.4_p19::gentoo
dev-lang/perl:            5.26.1-r2::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.5::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.35.5::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.30::gentoo
sys-devel/gcc:            7.3.0::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.15::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r6::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: no
    sync-rsync-extra-opts: 

localrepo
    location: /usr/local/portage
    masters: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=x86-64 -O2 -pipe -mtune=generic"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=x86-64 -O2 -pipe -mtune=generic"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox 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="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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 amd64 bzip2 crypt cxx hardened iconv idn ipv6 libressl maildir ncurses nls nptl openmp pam pcre pie readline seccomp ssl ssp syslog unicode 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 sse sse2" 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" 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 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22 ruby23" 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"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, ENV_UNSET, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Reproducible: Always
Comment 1 Andreas Schürch gentoo-dev 2018-07-10 19:01:51 UTC
libevent should not be built with USE=ssl in that case!
I will do these changes with a version bump in a few days.
Comment 2 Andreas Schürch gentoo-dev 2018-07-11 10:08:12 UTC
This is done now in coturn-4.5.0.7 and coturn-9999.
Thanks for reporting!
Comment 3 Daniel Kenzelmann 2018-07-11 11:53:31 UTC
Do you know if that is a generic issue with libevent?
I.e. is that a problem with libevent including something when having both ssl and libressl keywords enabled?

If yes, maybe libevent should be reworked to maybe internally configure things correctly when the libressl use flag is in use?

At the moment the default would be to have libressl and ssl enabled at the same time, if I understand it correctly this should enable ssl with libressl instead of openssl.

Disabling the ssl use flag is basically telling libevent configure to use "--disable-openssl" which I think might be disabling SSL support completely?
(i.e. also not using libressl?)

Any ideas on this?

(also it seems the coturn ebuild does not force it either way, if both ssl and libressl are enabled it simply accepts that because of the [ssl] condition which does not specify any use of the libressl flag.
so maybe better to use something like 
|| ( dev-libs/libevent[-ssl,libressl] dev-libs/libevent[ssl,-libressl] )
Comment 4 Andreas Schürch gentoo-dev 2018-07-11 12:45:00 UTC
You are so right!!
coturn used to fail to build if libevent didn't had ssl support. Thats why the dep was there in the first place. That seems to no longer be the case. And libevent really doesn't seem to build ssl support with -ssl, even with libressl enabled.

I stumbled over the commit message from libevent [1] that says that those BIO_.. APIS are implemented in libressl-2.7.4, expect for BIO_get_init!

I now upgraded my chroot to libressl-2.7.4, rebuilt libevent with USE="ssl libressl" and tried to build coturn against it... I guess you know what happened! ;-)

/usr/lib//libevent_openssl.so: undefined reference to `BIO_get_init'

The good news is that the other errors are gone! ;-)

[1] https://github.com/libevent/libevent/commit/28b8075400c70b2d2da2ce07e590c2ec6d11783d
Comment 5 Andreas Schürch gentoo-dev 2018-07-11 13:14:06 UTC
One more thing...
It compiles against dev-libs/libenevt-9999 with USE="ssl libressl"! 
I haven't tested that with the older libressl package...
Comment 6 Andreas Schürch gentoo-dev 2018-09-18 17:44:02 UTC
Unfortunately there is still no newer libevent release.
I made it now like that...
|| ( dev-libs/libevent[-ssl,libressl] dev-libs/libevent[ssl,-libressl] >dev-libs/libevent-2.1.8[ssl,libressl] )


Thanks!