交叉编译百度开放云的MQTT-c时遇到的问题总结

MQTT-c 依赖photo库 
photo库依赖libssl和libcrypto两个库,这两个库包在openssl中 
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。

昨天编译MQTT-c 出现错误:

arm-linux-gcc -c src/PublisherSync.c -I/home/whl/output/arm-linux/include 
arm-linux-gcc -o PublisherSync ConnectorSync.o PublisherSync.o -L/home/whl/output/arm-linux/lib -lpaho-mqtt3cs -I/home/whl/output/arm-linux/include -lrt 
/usr/local/arm/4.2.2-eabi/usr/bin-ccache/../lib/gcc/arm-unknown-linux-gnueabi/4.2.2/../../../../arm-unknown-linux-gnueabi/bin/ld: warning: libssl.so.1.0.0, needed by /home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so, not found (try using -rpath or -rpath-link) 
/usr/local/arm/4.2.2-eabi/usr/bin-ccache/../lib/gcc/arm-unknown-linux-gnueabi/4.2.2/../../../../arm-unknown-linux-gnueabi/bin/ld: warning: libcrypto.so.1.0.0, needed by /home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so, not found (try using -rpath or -rpath-link) 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_connect' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
ERR_print_errors_fp’ 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_get1_session' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
CRYPTO_set_locking_callback’ 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_set_session' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
OPENSSL_add_all_algorithms_noconf’ 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_CTX_set_verify' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
SSL_load_error_strings’ 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_get_cipher_list' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
SSLeay_version’ 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_CTX_use_certificate_chain_file' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
SSL_free’ 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_CTX_set_default_passwd_cb_userdata' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
SSL_CTX_new’ 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_get_verify_result' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
SSL_read’ 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to SSL_set_fd' 
/home/whl/output/arm-linux/lib/libpaho-mqtt3cs.so: undefined reference to
SSL_pending’

这个错误很奇怪,排查了好久,因为同样的Makefile文件,交叉编译 时就报错,编译 x86版本时就很正常。 
后来google到要在编译时加上 -lssl -lcrypto,就可以顺利编译通过了。

猜你喜欢

转载自blog.csdn.net/renanrenan/article/details/81981058