#912173 ring FTCBFS: multiple reasons

#912173#5
Date:
2018-10-28 19:45:37 UTC
From:
To:
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

#912173#10
Date:
2018-12-11 01:20:30 UTC
From:
To:
Hello,

I wouldn't mind merging the d/rules part of these patches if the rest is
submitted and merged upstream.

Someone should submit the relevant parts upstream first so that we have
to maintain less in Debian.

Upstream is usually responsive for patches like this.

#912173#15
Date:
2020-12-30 16:30:48 UTC
From:
To:
I'm inclined to close this since Jami builds fine now.

Alexandre?

#912173#20
Date:
2020-12-30 19:54:52 UTC
From:
To:
Hi Amin,

Doesn't look like that to me:

http://crossqa.debian.net/build/ring_20201217.1.80217fa%7Eds1-2_arm64_20201229181656.log

Did you try applying my patch?

Helmut

#912173#25
Date:
2020-12-30 20:28:10 UTC
From:
To:
Hi Helmut,

Helmut Grohne writes:

Whoops, you're quite right, sorry!  I somehow misread/misunderstood the
report.  I have not tried your patch yet.  Would you please share the
exact series of commands used to attempt the above build, so I could try
and do some digging locally?

Thanks,

#912173#30
Date:
2020-12-30 21:23:11 UTC
From:
To:
Hi Amin,

This particular log was produced by sbuild. In order to cross build with
sbuild for arm64, you pass --host=arm64. If you prefer using pbuilder,
the option becomes --host-arch arm64. If you use something else, you
need to pass --host-arch arm64 to dpkg-buildpackage. Hope this helps.
please let me know if this doesn't.

Beware that cross building is not an expected archive feature. It is
more like a port. Maintainers are supposed to apply patches on a
best-effort basis and porters (like me) are supposed to supply them. So
if you run into some error that you deem too difficult, don't hesitate
to post a build log to debian-cross@lists.debian.org to receive help.
Making jami cross buildable will be a longer journey. My patch goes a
long way, but it is insufficient.

Helmut