Bug#912173: ring FTCBFS: multiple reasons

Helmut Grohne helmut at subdivi.de
Sun Oct 28 19:45:37 GMT 2018


Source: ring
Version: 20180816.2.e26b79f~ds1-3
User: helmutg at debian.org
Usertags: rebootstrap

ring fails to cross build from source. Actually it simply performs a
native build and breaks when expected dependencies are unavailable. The
attached patch fixes quite a bit of that:

 * daemon/contrib/bootstrap recognizes the standard flags --build and
   --host. However debian/rules does not yet pass them.

 * The Makefile in daemon/contrib somehow insists that pkg-config cannot
   be used during cross building and considers all dependencies as
   needed. That's stupid.

 * The Makefile in daemon/contrib somehow thinks that the
   $(CROSS_COMPILE) prefix only applies to pkg-config when building for
   windows. The prefix is generally useful however. It also insists that
   cross building requires static linking, which is similarly stupid.

 * debian/rules runs cmake and configure manually. Those manual
   invocations lack any cross parameters. Using dh_auto_configure
   simplifies them and makes cross compilation just work.

After applying it, ring still fails to cross build, because it fails
finding symbols from pjproject while linking. The relevant libraries
show up on the linker invocation. I have no clue how to fix that:

| ../doltlibtool  --tag=CXX   --mode=link mips-linux-gnu-g++ -I../src -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/dbus-c++-1 -I/usr/include/dbus-1.0 -I/usr/lib/mips-linux-gnu/dbus-1.0/include -I../src/dring -DTOP_BUILDDIR=\"$(cd ".."; pwd)\" -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -DPJ_AUTOCONF=1  -I/<<PKGBUILDDIR>>/daemon/contrib/mips-linux-gnu/include -DNDEBUG=1  -Wl,-z,relro -Wl,-z,now -Wl,-Bsymbolic -ldl -L/<<PKGBUILDDIR>>/daemon/contrib/mips-linux-gnu/lib -L/usr/lib/mips-linux-gnu -ljsoncpp -o dring dring-main.o dbus/libclient_dbus.la -L/usr/lib/mips-linux-gnu -ldbus-c++-1 -ldbus-1 ../src/libring.la -ldl -lnatpmp -lrestbed  -lssl -lcrypto
| libtool: link: mips-linux-gnu-g++ -I../src -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/dbus-c++-1 -I/usr/include/dbus-1.0 -I/usr/lib/mips-linux-gnu/dbus-1.0/include -I../src/dring "-DTOP_BUILDDIR=\"/<<PKGBUILDDIR>>/daemon\"" -g -O2 "-fdebug-prefix-map=/<<PKGBUILDDIR>>=." -fstack-protector-strong -Wformat -Werror=format-security -DPJ_AUTOCONF=1 "-I/<<PKGBUILDDIR>>/daemon/contrib/mips-linux-gnu/include" -DNDEBUG=1 -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-Bsymbolic -o dring dring-main.o  -L/<<PKGBUILDDIR>>/daemon/contrib/mips-linux-gnu/lib -L/usr/lib/mips-linux-gnu dbus/.libs/libclient_dbus.a -ldbus-c++-1 -ldbus-1 ../src/.libs/libring.a -lpjsua2-mips-unknown-linux-gnu -lpjsua-mips-unknown-linux-gnu -lpjsip-ua-mips-unknown-linux-gnu -lpjsip-simple-mips-unknown-linux-gnu -lpjsip-mips-unknown-linux-gnu -lpjmedia-codec-mips-unknown-linux-gnu -lpjmedia-videodev-mips-unknown-linux-gnu -lpjmedia-audiodev-mips-unknown-linux-gnu -lpjmedia-mips-unknown-linux-gnu -lpjnath-mips-unknown-linux-gnu -lpjlib-util-mips-unknown-linux-gnu -lsrtp-mips-unknown-linux-gnu -lpj-mips-unknown-linux-gnu -lopus -luuid -lrt -lpthread -lasound -lpulse -lyaml-cpp -lupnp -lthreadutil -lixml -lopendht -lnettle -lgnutls -largon2 -lsecp256k1 -lz -lpcre -lavfilter -lswresample -lspeexdsp -ljsoncpp -lavcodec -lavformat -lavdevice -lswscale -lavutil -ludev -lX11 -lvdpau -lva-drm -lva-x11 -lva -ldl -lnatpmp -lrestbed -lssl -lcrypto -pthread
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ../src/.libs/libring.a(libsiplink_la-sipcall.o): in function `ring::SIPCall::getDetails[abi:cxx11]() const':
| ./daemon/src/sip/sipcall.cpp:1125: undefined reference to `pj_ssl_cipher_name'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ./daemon/src/sip/sipcall.cpp:1127: undefined reference to `pj_ssl_cipher_name'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ../src/.libs/libring.a(libsiplink_la-sipaccount.o): in function `ring::SIPAccount::trimCiphers()':
| ./daemon/src/sip/sipaccount.cpp:1154: undefined reference to `pj_ssl_cipher_name'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ./daemon/src/sip/sipaccount.cpp:1154: undefined reference to `pj_ssl_cipher_name'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ../src/.libs/libring.a(libsiplink_la-sipaccount.o): in function `ring::SIPAccount::initTlsConfiguration()':
| ./daemon/src/sip/sipaccount.cpp:1170: undefined reference to `pj_ssl_cipher_get_availables'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ./daemon/src/sip/sipaccount.cpp:1170: undefined reference to `pj_ssl_cipher_get_availables'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ./daemon/src/sip/sipaccount.cpp:1181: undefined reference to `pj_ssl_cipher_id'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ./daemon/src/sip/sipaccount.cpp:1181: undefined reference to `pj_ssl_cipher_id'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ../src/.libs/libring.a(libsiplink_la-sipaccount.o): in function `ring::SIPAccount::getSupportedTlsCiphers[abi:cxx11]()':
| ./daemon/src/sip/sipaccount.cpp:1506: undefined reference to `pj_ssl_cipher_get_availables'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ./daemon/src/sip/sipaccount.cpp:1512: undefined reference to `pj_ssl_cipher_name'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ../src/.libs/libring.a(libsiplink_la-sipaccount.o): in function `ring::SIPAccount::getSupportedTlsCiphers[abi:cxx11]()':
| /usr/mips-linux-gnu/include/c++/8/bits/stl_algobase.h:741: undefined reference to `pj_ssl_cipher_get_availables'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ../src/.libs/libring.a(libsiplink_la-sipaccount.o): in function `ring::SIPAccount::getSupportedTlsCiphers[abi:cxx11]()':
| ./daemon/src/sip/sipaccount.cpp:1511: undefined reference to `pj_ssl_cipher_name'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ../src/.libs/libring.a(libsiplink_la-sipaccount.o): in function `ring::SIPAccount::getVolatileAccountDetails[abi:cxx11]() const':
| ./daemon/src/sip/sipaccount.cpp:649: undefined reference to `pj_ssl_cipher_name'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ./daemon/src/sip/sipaccount.cpp:651: undefined reference to `pj_ssl_cipher_name'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ../src/.libs/libring.a(libsiplink_la-siptransport.o): in function `ring::SipTransportBroker::getTlsListener(ring::SipTransportDescr const&, pjsip_tls_setting const*)':
| ./daemon/src/sip/siptransport.cpp:389: undefined reference to `pjsip_tls_transport_start2'
| /usr/lib/gcc-cross/mips-linux-gnu/8/../../../../mips-linux-gnu/bin/ld: ./daemon/src/sip/siptransport.cpp:389: undefined reference to `pjsip_tls_transport_start2'
| collect2: error: ld returned 1 exit status
| make[5]: *** [Makefile:634: dring] Error 1
| make[5]: Leaving directory '/<<PKGBUILDDIR>>/daemon/bin'
| make[4]: *** [Makefile:754: all-recursive] Error 1
| make[4]: Leaving directory '/<<PKGBUILDDIR>>/daemon/bin'
| make[3]: *** [Makefile:543: all-recursive] Error 1
| make[3]: Leaving directory '/<<PKGBUILDDIR>>/daemon'
| make[2]: *** [Makefile:474: all] Error 2
| make[2]: Leaving directory '/<<PKGBUILDDIR>>/daemon'
| make[1]: *** [debian/rules:89: override_dh_auto_build] Error 2
| make[1]: Leaving directory '/<<PKGBUILDDIR>>'
| make: *** [debian/rules:17: build-arch] Error 2
| dpkg-buildpackage: error: debian/rules build-arch subprocess returned exit status 2

Nevertheless, the attached patch makes the build go a lot further.
Please consider applying as much of it as is sensible. Please discuss
the portions you disagree with and please close this bug if you apply
substantial aspects of it (even though ring continues to fail to cross
build).

Helmut
-------------- next part --------------
diff --minimal -Nru ring-20180816.2.e26b79f~ds1/debian/changelog ring-20180816.2.e26b79f~ds1/debian/changelog
--- ring-20180816.2.e26b79f~ds1/debian/changelog	2018-08-24 01:43:53.000000000 +0200
+++ ring-20180816.2.e26b79f~ds1/debian/changelog	2018-10-28 19:06:03.000000000 +0100
@@ -1,3 +1,14 @@
+ring (20180816.2.e26b79f~ds1-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building. (Closes: #-1)
+    + cross.patch: Use the host pkg-config.
+    + cross.patch: Trust pkg-config even when cross compiling.
+    + Tell daemon/contrib/bootstrap that we cross.
+    + Let dh_auto_configure pass cross tools to configure and cmake.
+
+ -- Helmut Grohne <helmut at subdivi.de>  Sun, 28 Oct 2018 19:06:03 +0100
+
 ring (20180816.2.e26b79f~ds1-3) unstable; urgency=medium
 
   * New upstream version.
diff --minimal -Nru ring-20180816.2.e26b79f~ds1/debian/patches/cross.patch ring-20180816.2.e26b79f~ds1/debian/patches/cross.patch
--- ring-20180816.2.e26b79f~ds1/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ ring-20180816.2.e26b79f~ds1/debian/patches/cross.patch	2018-10-28 19:06:03.000000000 +0100
@@ -0,0 +1,23 @@
+--- ring-20180816.2.e26b79f~ds1.orig/daemon/contrib/src/main.mak
++++ ring-20180816.2.e26b79f~ds1/daemon/contrib/src/main.mak
+@@ -62,7 +62,7 @@
+ ifdef HAVE_WIN32
+ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config --static
+ else
+-PKG_CONFIG ?= pkg-config --static
++PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
+ endif
+ PKG_CONFIG_PATH_CUSTOM = $(PREFIX)/lib/pkgconfig
+ export PKG_CONFIG_PATH_CUSTOM
+@@ -73,11 +73,7 @@
+ PKG_CONFIG_PATH := $(PREFIX)/lib/pkgconfig:$(PREFIX)/lib/$(HOST)/pkgconfig:$(PKG_CONFIG_PATH)
+ export PKG_CONFIG_PATH
+ 
+-ifdef HAVE_CROSS_COMPILE
+-need_pkg = 1
+-else
+ need_pkg = $(shell $(PKG_CONFIG) $(1) || echo 1)
+-endif
+ #
+ # Default values for tools
+ #
diff --minimal -Nru ring-20180816.2.e26b79f~ds1/debian/patches/series ring-20180816.2.e26b79f~ds1/debian/patches/series
--- ring-20180816.2.e26b79f~ds1/debian/patches/series	2018-08-24 01:43:53.000000000 +0200
+++ ring-20180816.2.e26b79f~ds1/debian/patches/series	2018-10-28 19:06:03.000000000 +0100
@@ -1,3 +1,4 @@
 dont-build-gnutls.patch
 namedirectory-old-restbed.patch
 jsoncpp-rename.patch
+cross.patch
diff --minimal -Nru ring-20180816.2.e26b79f~ds1/debian/rules ring-20180816.2.e26b79f~ds1/debian/rules
--- ring-20180816.2.e26b79f~ds1/debian/rules	2018-08-24 01:43:53.000000000 +0200
+++ ring-20180816.2.e26b79f~ds1/debian/rules	2018-10-28 19:06:03.000000000 +0100
@@ -4,6 +4,7 @@
 # Hardening
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/buildflags.mk
 
 # Number of CPUS
@@ -34,6 +35,7 @@
 	mkdir -p daemon/contrib/native
 	cd daemon/contrib/native && \
         ../bootstrap \
+				$(if $(filter $(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)),,--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)) \
 				--disable-downloads \
 				--no-checksums \
 				--disable-ogg \
@@ -61,35 +63,22 @@
 				--disable-natpmp && \
 		make list && \
 		make -j$(NO_CPUS) V=1
-	cd daemon && \
-		./autogen.sh && \
-		./configure \
-				--prefix=/usr \
-				--disable-shared
+	cd daemon && ./autogen.sh
+	dh_auto_configure --sourcedirectory=daemon -- --disable-shared
 
 	#############################
 	## libringclient configure ##
 	#############################
-	cd lrc && \
-		mkdir build && \
-		cd build && \
-		cmake  \
+	dh_auto_configure --sourcedirectory=lrc --builddirectory=lrc/build -- \
 			-DRING_BUILD_DIR=$(CURDIR)/daemon/src \
-			-DCMAKE_INSTALL_PREFIX=/usr \
-			-DCMAKE_BUILD_TYPE=Debug \
-			..
+			-DCMAKE_BUILD_TYPE=Debug
 
 	############################
 	## gnome client configure ##
 	############################
-	cd client-gnome && \
-		mkdir build && \
-		cd build && \
-		cmake \
-			-DCMAKE_INSTALL_PREFIX=/usr \
+	dh_auto_configure --sourcedirectory=client-gnome --builddirectory=client-gnome/build -- \
 			-DLibRingClient_PROJECT_DIR=/$(CURDIR)/lrc \
-			-DGSETTINGS_LOCALCOMPILE=OFF \
-			..
+			-DGSETTINGS_LOCALCOMPILE=OFF
 
 	dh_auto_configure
 


More information about the Pkg-voip-maintainers mailing list