Cross-compiling a cmake project with OpenWrt SDK

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!

cmake is definitely available and is used by the openwrt buildroot.

for an example see package/system/ubox/Makefile

Unfortunately I made several attempts but I'm still unable to solve my problem.
After compiling a glibc OpenWrt image the libpthread error is gone but I'm still getting several linking errors and missing libraries which are preventing me from cross-compiling Qpid Proton.

My final goal would be to:

  1. Cross-compile Qpid-proton, which is already using cmake as a build system. Currently, with a glibc toolchain, the build process stops showing the following errors:
$ cmake .. -DCMAKE_CXX_COMPILER=x86_64-openwrt-linux-gnu-g++ -DCMAKE_INSTALL_PREFIX=/usr -DSYSINSTALL_BINDINGS=ON -DBUILD_GO=OFF -DBUILD_PYTHON=OFF -DBUILD_RUBY=OFF -DBUILD_EXAMPLES=OFF
$ make
[  1%] Built target generated_c_files
[ 14%] Built target qpid-proton-core-objects
[ 23%] Built target qpid-proton
[ 23%] Built target qpid-proton-core
[ 24%] Built target qpid-proton-proactor
[ 25%] Built target c-direct
[ 25%] Built target c-send-abort
[ 26%] Built target c-send-ssl
[ 27%] Built target c-receive
[ 27%] Built target c-broker
[ 28%] Built target c-send
[ 29%] Built target test_main
[ 31%] Built target c-proactor-test
[ 33%] Built target c-ssl-proactor-test
[ 33%] Linking CXX executable c-extra-test
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: warning: libssl.so.1.1, needed by ../libqpid-proton.so.11.9.1, not found (try using -rpath or -rpath-link)
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: warning: libsasl2.so.2, needed by ../libqpid-proton.so.11.9.1, not found (try using -rpath or -rpath-link)
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: warning: libcrypto.so.1.1, needed by ../libqpid-proton.so.11.9.1, not found (try using -rpath or -rpath-link)
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_server_init@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `OPENSSL_init_ssl@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `ERR_get_error@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CIPHER_get_name@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_use_PrivateKey_file@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `TLS_server_method@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_set_session@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_test_flags@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_get_subject_name@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_set_connect_state@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_NAME_get_entry@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_set_accept_state@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_free@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_listmech@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_ctrl@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_get_error@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_read@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_new_bio_pair@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_server_step@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_SESSION_free@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BN_free@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `EVP_get_digestbyname@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_check_private_key@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_NAME_print_ex@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_STORE_CTX_get_current_cert@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_load_client_CA_file@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_ctrl@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_encode@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_session_reused@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_client_start@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_client_init@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `ASN1_STRING_to_UTF8@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_s_mem@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `CRYPTO_get_ex_new_index@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `DH_free@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `ERR_clear_error@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `OPENSSL_init_crypto@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_set_bio@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_set_path@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CIPHER_get_bits@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_set_cipher_list@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_errdetail@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_STORE_CTX_get_ex_data@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_set_security_level@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_set_default_verify_paths@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_new@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_get_peer_certificate@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_NAME_ENTRY_get_data@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `GENERAL_NAMES_free@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_set_verify@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CIPHER_get_version@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_get_ex_data@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_get1_session@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_digest@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_ctrl_pending@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_set_shutdown@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_ctrl@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_set_default_passwd_cb@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_client_done@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_server_done@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `TLS_client_method@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `DH_set0_pqg@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_clear_options@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_new@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_server_new@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `OPENSSL_sk_value@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_ssl_shutdown@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_errstring@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_dispose@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_set_options@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_get_ext_d2i@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_get_current_cipher@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_free@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_setprop@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_getprop@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_free@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_write@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_decode@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_set_client_CA_list@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_get_shutdown@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_set_ex_data@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BN_bin2bn@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_NAME_get_index_by_NID@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_STORE_CTX_get_error_depth@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_server_start@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_set_default_passwd_cb_userdata@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `X509_STORE_CTX_set_error@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `ERR_error_string_n@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_client_step@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `CRYPTO_free@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `DH_new@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `sasl_client_new@SASL2'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_f_ssl@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_CTX_get_security_level@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_number_written@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_get_ex_data_X509_STORE_CTX_idx@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `SSL_new@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `OPENSSL_sk_num@OPENSSL_1_1_0'
/home/francesco/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_glibc/lib/gcc/x86_64-openwrt-linux-gnu/7.5.0/../../../../x86_64-openwrt-linux-gnu/bin/ld: ../libqpid-proton.so.11.9.1: undefined reference to `BIO_free@OPENSSL_1_1_0'
collect2: error: ld returned 1 exit status
make[2]: *** [c/tests/CMakeFiles/c-extra-test.dir/build.make:102: c/tests/c-extra-test] Error 1
make[1]: *** [CMakeFiles/Makefile2:1667: c/tests/CMakeFiles/c-extra-test.dir/all] Error 2

  1. Install the cross-compiled external library into OpenWrt.
  2. Use the external library inside the OpenWrt toolchain to compile a program which needs it, and which compilation fails due to the missing Qpid Proton library:
$ make
x86_64-openwrt-linux-gnu-gcc -Wall -O2 -Iinclude -IRawsock_lib/Rawsock_lib -DAMQP_1_0_ENABLED -Iinclude/qpid_proton -c src/udp_client.c -o obj-full/udp_client.o
In file included from include/udp_client.h:6:0,
                 from src/udp_client.c:1:
include/common_socket_man.h:10:10: fatal error: proton/proactor.h: No such file or directory
 #include <proton/proactor.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:78: obj-full/udp_client.o] Error 1

How can I use cmake to achieve this result? Is it even possibile to do so, without the need of manually cross-compiling all the dependencies and given the library requirements?

Thank you very much in advance for your assistance!