Hello,
I'm trying to cross-compile the Qpid Proton library, which is an AMQP 1.0 messaging library developed by Apache.
The library is this one: https://qpid.apache.org/proton/
In particular, I'm interested in building the C library only, in order to run, inside OpenWrt, a program which is using this library to send AMQP messages.
In order to build it, however, it relies on cmake
, which is not available inside OpenWrt.
So, I'm trying to cross-compile it using the OpenWrt SDK. I already have the toolchain, which I used to successfully compile other smaller project, using only make
.
Following the Qpid Proton installation instructions (which I put in a pastebin for your reference: https://pastebin.com/Z1YjVu5m, I'm currently running:
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_CXX_COMPILER=x86_64-openwrt-linux-musl-g++ -DCMAKE_INSTALL_PREFIX=/usr -DSYSINSTALL_BINDINGS=ON -DBUILD_GO=OFF -DBUILD_PYTHON=OFF -DBUILD_RUBY=OFF -DBUILD_EXAMPLES=OFF
Setting the desired compiler for my platform (x86_64-openwrt-linux-musl-g++
).
Unfortunately, it always fails with these errors:
/home/fr483/OpenWrt-V2X/staging_dir/toolchain-x86_64_gcc-7.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/7.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: warning: libpthread.so.0, needed by ../libqpid-proton-proactor.so.1.5.1, not found (try using -rpath or -rpath-link)
/home/fr483/OpenWrt-V2X/staging_dir/toolchain-x86_64_gcc-7.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/7.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: warning: libc.so.6, needed by ../libqpid-proton-proactor.so.1.5.1, not found (try using -rpath or -rpath-link)
/home/fr483/OpenWrt-V2X/staging_dir/toolchain-x86_64_gcc-7.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/7.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld: warning: libdl.so.2, needed by /usr/lib/x86_64-linux-gnu/libcrypto.so, not found (try using -rpath or -rpath-link)
/usr/lib/x86_64-linux-gnu/libcrypto.so: undefined reference to `setcontext@GLIBC_2.2.5'
../libqpid-proton-proactor.so.1.5.1: undefined reference to `accept@GLIBC_2.2.5'
/usr/lib/x86_64-linux-gnu/libcrypto.so: undefined reference to `__vfprintf_chk@GLIBC_2.3.4'
../libqpid-proton-proactor.so.1.5.1: undefined reference to `send@GLIBC_2.2.5'
../libqpid-proton-proactor.so.1.5.1: undefined reference to `connect@GLIBC_2.2.5'
../libqpid-proton-proactor.so.1.5.1: undefined reference to `__errno_location@GLIBC_2.2.5'
/usr/lib/x86_64-linux-gnu/libsasl2.so: undefined reference to `uname@GLIBC_2.2.5'
/usr/lib/x86_64-linux-gnu/libcrypto.so: undefined reference to `closelog@GLIBC_2.2.5'
..............
The problem seems to be related to the fact that it is not able to fing some required libraries for cross-compilation, such as libpthread.so.0
.
As it is the first time in which I trying to use the SDK to compile with cmake
, is there a (relatively) easy way to solve this problem? How can I tell cmake
to look for libraries inside the OpenWrt SDK? Do I need to cross-compile each single library dependency?
Thank you very much in advance!