freeswitch
freeswitch copied to clipboard
[mod_unimrcp] Update unimrcp to 1.7.0
Current version is too old, this PR update unimrcp to 1.7.0 fixed #721, #196 in this commit
We don't really do much with mod_unimrcp anymore- so I'll take this if you are willing to help fix anything that pops up as a result of this change.
@crienzo I'll be happy to help.
@andywolk this is OK if it builds
From my point of view, this lib need move to Support Deps
.
And package into rpm
and dep
packages.
I can provide support with rpm packaging.
I think one issue w/ moving this lib out of freeswitch is that both freeswitch and unimrcp use a forked version of APR.
their deps public available here. So we can download these deps during the build.
As I understand unimrcp also statically linked with forked libs. Not see the issue.
If you can make it work, we'll take it.
I have prepared SPEC file for unimrcp.
But need some support with static expat
library linking.
please place into ~/rpmbuild/SPECS/unimrcp.spec
this content
%define deps_version 1.6.0
Summary: The project encapsulates SIP, RTSP, SDP, MRCPv2, and RTP/RTCP stacks and provides integrators with a protocol version consistent interface.
Name: unimrcp
Version: 1.7.0
Release: 0%{?dist}
License: ASL 2.0
URL: https://github.com/unispeech/unimrcp
#%undefine _disable_source_fetch
Source0: https://github.com/unispeech/unimrcp/archive/%{name}-%{version}.tar.gz
# Dependences arhive cannot automatically downloaded
# and required to donwload this using commnad like
# wget -O unimrcp-deps-1.6.0.tar.gz http://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download
# mv unimrcp-deps-1.6.0.tar.gz ../SOURCES/
Source1: unimrcp-deps-%{deps_version}.tar.gz
%description
UniMRCP is an open source project compliant with the IETF RFC6787 (MRCPv2) and RFC4463 (MRCPv1) specifications.
The project encapsulates SIP, RTSP, SDP, MRCPv2, and RTP/RTCP stacks and provides integrators with a protocol version consistent interface.
- Compliance: MRCPv1, MRCPv2 (client and server)
- Resources: Synthesizer (TTS), Recognizer (ASR), Verifier (SVI), Recorder
- License: Apache 2.0
- OS: Cross-platform (Windows, Linux, ...)
- Language: C, C++
%package devel
Summary: Development interfaces for the unimrcp
%description devel
Summary: Development interfaces for the unimrcp
%package plugin
Summary: Plugins for the unimrcp
%description plugin
Summary: Plugins for the unimrcp
%prep
%setup -q -n %{name}-%{name}-%{version}
tar xzf %{SOURCE1}
%build
cd unimrcp-deps-%{deps_version}
./build-dep-libs.sh --silent --apr-install-dir %{_builddir}/%{buildsubdir}/deps/arp --sofia-install-dir %{_builddir}/%{buildsubdir}/deps/sofia
cd %{_builddir}/%{buildsubdir}
libtoolize --force --automake --copy
aclocal -I build/acmacros
automake --foreign --add-missing --copy
autoconf
rm -rf autom4te.cache
echo %configure \
--sysconfdir=%{_sysconfdir}/%{name} \
--datadir=%{_datadir}/%{name} \
--with-apr=%{_builddir}/%{buildsubdir}/deps/arp \
--with-apr-util=%{_builddir}/%{buildsubdir}/deps/arp \
--with-sofia-sip=%{_builddir}/%{buildsubdir}/deps/sofia \
--disable-client-app \
--disable-umc
%make_build
%install
rm -rf $RPM_BUILD_ROOT
%make_install
%files
%{_sysconfdir}/%{name}
%{_bindir}/asrclient
%{_bindir}/unimrcpserver
%{_datadir}/%{name}
%{_libdir}/libasrclient.so*
%{_libdir}/libunimrcpclient.so*
%{_libdir}/libunimrcpserver.so*
%files devel
%{_includedir}/*
%{_libdir}/libasrclient.a*
%{_libdir}/libunimrcpclient.a*
%{_libdir}/libunimrcpserver.a*
%{_libdir}/libasrclient.la*
%{_libdir}/libunimrcpclient.la*
%{_libdir}/libunimrcpserver.la*
%{_libdir}/pkgconfig/unimrcpclient.pc
%{_libdir}/pkgconfig/unimrcpplugin.pc
%{_libdir}/pkgconfig/unimrcpserver.pc
%files plugin
%{_prefix}/plugin/*
then need download deps file
wget -O unimrcp-deps-1.6.0.tar.gz http://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download
move deps file into source dir
mv unimrcp-deps-1.6.0.tar.gz ~/rpmbuild/SOURCES/
and then build
rpmbuild --undefine=_disable_source_fetch -bb ~/rpmbuild/SPECS/unimrcp.spec
now you can install static libs
yum install ~/rpmbuild/RPMS/x86_64/unimrcp-devel-1.7.0-0.fc33.x86_64.rpm
but an error exists when I try to install shared unimrcp libs.
[root@safarov-dell ~]# dnf install ~/rpmbuild/RPMS/x86_64/unimrcp-1.7.0-0.fc33.x86_64.rpm
Last metadata expiration check: 3:46:49 ago on Sun Feb 28 07:16:28 2021.
Error:
Problem: conflicting requests
- nothing provides libexpat.so.0()(64bit) needed by unimrcp-1.7.0-0.fc33.x86_64
(try to add '--skip-broken' to skip uninstallable packages)
This because apr deps dynamically linked expat.
Hi guys Could you help me properly statically link unimrcp.
@s3rj1k @andywolk is there an easy fix to statically link unimrcp?
@sergey-safarov Can you confirm that unimrcp is in fact linked statically to expat, using maybe ldd on produced *.so?
I have checked unimrcp
linked dynamically with expat
.
I have checked build on CentOS 7 and in this case used expat
from unimrcp
dependences sources.
In the current case apr dependency. APR binaries dynamically linked with expat
.
So more correct request.
Please help statically link APR from unimrcp
.
FS also use statically linked APR, so need to do same with APR from unimrcp
deps.
@sergey-safarov I would've started from manual compilation of unimrcp without all of bells and whistles of rpm packaging.
Do you have a list of steps for manual compilation?
manual build sequance
yum -y install wget gcc make sudo libtool
wget https://github.com/unispeech/unimrcp/archive/unimrcp-1.7.0.tar.gz
wget -O unimrcp-deps-1.6.0.tar.gz http://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download
tar xzf unimrcp-1.7.0.tar.gz
cd unimrcp-unimrcp-1.7.0
tar xzf ../unimrcp-deps-1.6.0.tar.gz
cd unimrcp-deps-1.6.0/
./build-dep-libs.sh --silent --apr-install-dir ${PWD}/../deps/arp --sofia-install-dir ${PWD}/../deps/sofia
cd ..
libtoolize --force --automake --copy
aclocal -I build/acmacros
libtoolize --force --automake --copy
aclocal -I build/acmacros
automake --foreign --add-missing --copy
autoconf
rm -rf autom4te.cache
./configure --sysconfdir=/etc/unimrcp --datadir=/var/lib/unimrcp --with-apr=${PWD}/deps/arp --with-apr-util=${PWD}/deps/arp --with-sofia-sip=${PWD}/deps/sofia --disable-client-app --disable-umc
make
make install
ldd output
[root@6ca5dd2d813b lib]# ldd /usr/local/unimrcp/lib/libunimrcpserver.so.0.7.0
linux-vdso.so.1 => (0x00007ffce11f3000)
libaprutil-1.so.0 => /unimrcp-unimrcp-1.7.0/unimrcp-deps-1.6.0/../deps/arp/lib/libaprutil-1.so.0 (0x00007f6252ad1000)
libexpat.so.0 => /unimrcp-unimrcp-1.7.0/unimrcp-deps-1.6.0/../deps/arp/lib/libexpat.so.0 (0x00007f62528a8000)
libapr-1.so.0 => /unimrcp-unimrcp-1.7.0/unimrcp-deps-1.6.0/../deps/arp/lib/libapr-1.so.0 (0x00007f6252675000)
librt.so.1 => /lib64/librt.so.1 (0x00007f625246d000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f6252236000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f6252032000)
libsofia-sip-ua.so.0 => /unimrcp-unimrcp-1.7.0/unimrcp-deps-1.6.0/../deps/sofia/lib/libsofia-sip-ua.so.0 (0x00007f6251ca7000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6251a8b000)
libm.so.6 => /lib64/libm.so.6 (0x00007f6251789000)
libc.so.6 => /lib64/libc.so.6 (0x00007f62513bb000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007f62511b8000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6252f57000)
@sergey-safarov export CPPFLAGS="-DAPR_DECLARE_STATIC -DAPU_DECLARE_STATIC"
produces *.a
files.
Still *.pc.in
does not contain Libs.private
, similar to:
https://sources.debian.org/src/apr/1.5.1-3/apr.pc.in/
https://sources.debian.org/src/apr-util/1.6.1-5/apr-util.pc.in/
I created patch and now proced apr-util.pc
and apr.pc
like Debian version.
diff --git a/unimrcp-deps-1.6.0/libs/apr-util/apr-util.pc.in b/unimrcp-deps-1.6.0/libs/apr-util/apr-util.pc.in
index 5b146af..d36cf66 100644
--- a/unimrcp-deps-1.6.0/libs/apr-util/apr-util.pc.in
+++ b/unimrcp-deps-1.6.0/libs/apr-util/apr-util.pc.in
@@ -8,6 +8,7 @@ Name: APR Utils
Description: Companion library for APR
Version: @APRUTIL_DOTTED_VERSION@
# assume that apr-util requires libapr of same major version
-Requires: apr-@APRUTIL_MAJOR_VERSION@
-Libs: -L${libdir} -l@APRUTIL_LIBNAME@ @LDADD_ldap@ @APRUTIL_EXPORT_LIBS@
+Requires.private: apr-@APRUTIL_MAJOR_VERSION@
+Libs: -L${libdir} -l@APRUTIL_LIBNAME@ @LDADD_ldap@
+Libs.private: @APRUTIL_EXPORT_LIBS@
Cflags: -I${includedir}
diff --git a/unimrcp-deps-1.6.0/libs/apr/apr.pc.in b/unimrcp-deps-1.6.0/libs/apr/apr.pc.in
index 318a81e..5623793 100644
--- a/unimrcp-deps-1.6.0/libs/apr/apr.pc.in
+++ b/unimrcp-deps-1.6.0/libs/apr/apr.pc.in
@@ -7,5 +7,6 @@ includedir=@includedir@
Name: APR
Description: The Apache Portable Runtime library
Version: @APR_DOTTED_VERSION@
-Libs: -L${libdir} -l@APR_LIBNAME@ @EXTRA_LIBS@
-Cflags: @EXTRA_CPPFLAGS@ @EXTRA_CFLAGS@ -I${includedir}
+Libs: -L${libdir} -l@APR_LIBNAME@
+Libs.private: @EXTRA_LIBS@
+Cflags: @EXTRA_CPPFLAGS@ -I${includedir}
--
2.30.2
To compile deps used command like
CPPFLAGS="-DAPR_DECLARE_STATIC -DAPU_DECLARE_STATIC" ./build-dep-libs.sh --silent --apr-install-dir %{_builddir}/%{buildsubdir}/deps/arp --sofia-install-dir %{_builddir}/%{buildsubdir}/deps/sofia
But generated libunimrcpserver.so.0.7.0
still use shared linking for libexpat.
[root@2866e52462fe lib64]# ldd libunimrcpserver.so.0.7.0
linux-vdso.so.1 (0x00007ffce9695000)
libaprutil-1.so.0 => /root/rpmbuild/BUILD/unimrcp-unimrcp-1.7.0/deps/arp/lib/libaprutil-1.so.0 (0x00007f8d92581000)
libexpat.so.0 => /root/rpmbuild/BUILD/unimrcp-unimrcp-1.7.0/deps/arp/lib/libexpat.so.0 (0x00007f8d92554000)
libapr-1.so.0 => /root/rpmbuild/BUILD/unimrcp-unimrcp-1.7.0/deps/arp/lib/libapr-1.so.0 (0x00007f8d9251f000)
librt.so.1 => /lib64/librt.so.1 (0x00007f8d92510000)
libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007f8d924d6000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f8d924cf000)
libsofia-sip-ua.so.0 => /root/rpmbuild/BUILD/unimrcp-unimrcp-1.7.0/deps/sofia/lib/libsofia-sip-ua.so.0 (0x00007f8d9234f000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8d9232d000)
libm.so.6 => /lib64/libm.so.6 (0x00007f8d921e7000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8d9201c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8d92611000)
libexpat used only inside apr
.
@sergey-safarov seems that this needs more patching :(
Also did you try using system libexpat instead of static linking?
https://centos.pkgs.org/7/centos-x86_64/expat-2.1.0-12.el7.i686.rpm.html
Here is the final spec file
%define deps_version 1.6.0
Summary: The project encapsulates SIP, RTSP, SDP, MRCPv2, and RTP/RTCP stacks and provides integrators with a protocol version consistent interface.
Name: unimrcp
Version: 1.7.0
Release: 0%{?dist}
License: ASL 2.0
URL: https://github.com/unispeech/unimrcp
BuildRequires: libtool expat-devel
Source0: https://github.com/unispeech/unimrcp/archive/%{name}-%{version}.tar.gz
# Dependences archive cannot automatically downloaded
# and required to donwload using commnad like
# wget -O ~/rpmbuild/SOURCES/unimrcp-deps-1.6.0.tar.gz http://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download
Source1: unimrcp-deps-%{deps_version}.tar.gz
Patch0: 0001-statically-linking-apr-and-sofia-sip.patch
%description
UniMRCP is an open source project compliant with the IETF RFC6787 (MRCPv2) and RFC4463 (MRCPv1) specifications.
The project encapsulates SIP, RTSP, SDP, MRCPv2, and RTP/RTCP stacks and provides integrators with a protocol version consistent interface.
- Compliance: MRCPv1, MRCPv2 (client and server)
- Resources: Synthesizer (TTS), Recognizer (ASR), Verifier (SVI), Recorder
- License: Apache 2.0
- OS: Cross-platform (Windows, Linux, ...)
- Language: C, C++
%package devel
Summary: Development interfaces for the unimrcp
%description devel
Summary: Development interfaces for the unimrcp
%package plugin
Summary: Plugins for the unimrcp
%description plugin
Summary: Plugins for the unimrcp
%prep
%setup -q -n %{name}-%{name}-%{version}
tar xzf %{SOURCE1}
%patch0 -p1
%build
cd unimrcp-deps-%{deps_version}
CPPFLAGS="-fPIC -DAPR_DECLARE_STATIC -DAPU_DECLARE_STATIC" ./build-dep-libs.sh --silent --apr-install-dir %{_builddir}/%{buildsubdir}/deps/arp --sofia-install-dir %{_builddir}/%{buildsubdir}/deps/sofia
cd %{_builddir}/%{buildsubdir}
libtoolize --force --automake --copy
aclocal -I build/acmacros
automake --foreign --add-missing --copy
autoconf
rm -rf autom4te.cache
%configure \
--sysconfdir=%{_sysconfdir}/%{name} \
--datadir=%{_datadir}/%{name} \
--with-apr=%{_builddir}/%{buildsubdir}/deps/arp \
--with-apr-util=%{_builddir}/%{buildsubdir}/deps/arp \
--with-sofia-sip=%{_builddir}/%{buildsubdir}/deps/sofia \
--disable-client-app \
--disable-umc
%make_build
%install
rm -rf $RPM_BUILD_ROOT
%make_install
%files
%{_sysconfdir}/%{name}
%{_bindir}/asrclient
%{_bindir}/unimrcpserver
%{_datadir}/%{name}
%{_libdir}/libasrclient.so*
%{_libdir}/libunimrcpclient.so*
%{_libdir}/libunimrcpserver.so*
%files devel
%{_includedir}/*
%{_libdir}/libasrclient.a*
%{_libdir}/libunimrcpclient.a*
%{_libdir}/libunimrcpserver.a*
%{_libdir}/libasrclient.la*
%{_libdir}/libunimrcpclient.la*
%{_libdir}/libunimrcpserver.la*
%{_libdir}/pkgconfig/unimrcpclient.pc
%{_libdir}/pkgconfig/unimrcpplugin.pc
%{_libdir}/pkgconfig/unimrcpserver.pc
%files plugin
%{_prefix}/plugin/*
Also required 0001-statically-linking-apr-and-sofia-sip.patch
file
From 196e7dcda27c633682dee1e65e3052488a0615da Mon Sep 17 00:00:00 2001
From: Sergey Safarov <[email protected]>
Date: Tue, 4 May 2021 07:43:35 +0000
Subject: [PATCH] statically linking apr and sofia-sip
---
unimrcp-deps-1.6.0/build-dep-libs.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/unimrcp-deps-1.6.0/build-dep-libs.sh b/unimrcp-deps-1.6.0/build-dep-libs.sh
index cd70115..67a5e0d 100755
--- a/unimrcp-deps-1.6.0/build-dep-libs.sh
+++ b/unimrcp-deps-1.6.0/build-dep-libs.sh
@@ -35,7 +35,7 @@ build_apr()
echo ======================================================================
echo Building APR library
cd ${APR_SRCDIR}
- ./configure --prefix=${APR_INSTALLDIR}
+ ./configure --prefix=${APR_INSTALLDIR} --enable-shared=no
make
if [ $MAKEINSTALL = "yes" ] ; then
sudo make install
@@ -65,7 +65,7 @@ build_sofia()
echo ======================================================================
echo Building Sofia-SIP library
cd ${SOFIA_SRCDIR}
- ./configure --with-glib=no --without-doxygen --prefix=${SOFIA_INSTALLDIR}
+ ./configure --with-glib=no --without-doxygen --prefix=${SOFIA_INSTALLDIR} --enable-shared=no
make
if [ $MAKEINSTALL = "yes" ] ; then
sudo make install
--
2.30.2
To build
- place spec file into
~/rpmbuild/SPECS/unimrcp.spec
- place patch file to
~/rpmbuild/SOURCES/0001-statically-linking-apr-and-sofia-sip.patch
- download deps archive
wget -O ~/rpmbuild/SOURCES/unimrcp-deps-1.6.0.tar.gz http://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download
- build rpm file
rpmbuild --undefine=_disable_source_fetch -bb ~/rpmbuild/SPECS/unimrcp.spec
I can create PR for this, just need to know where is located support deps
repo for unimrcp.
@andywolk Please take a look at https://github.com/signalwire/freeswitch/pull/1071#issuecomment-831866728
code moved to https://github.com/freeswitch/mod_unimrcp , @hateeyan can you check if it works with 1.7.0 ?