报错:
/usr/bin/ld: CMakeFiles/mqtts-sample.dir/utils.c.o: undefined reference to symbol 'BIO_read'
/usr/bin/ld: CMakeFiles/mqtts-sample.dir/utils.c.o: undefined reference to symbol 'BIO_ctrl@@OPENSSL_1.0.0'
解决过程有时间再写。
一、下载代码:
https://open.iot.10086.cn/doc/mqtt/book/device-develop/mqtt-c-demo.html
官方demo使用了2个第三方库,所以也需要这两个文件
二、编译第三方库
1、openssl
./config --prefix=/usr/local/ --openssldir=/usr/local/ssl shared
make
make install
2、paho.mqtt.c-1.3.0
cmake -DPAHO_WITH_SSL=TRUE -DOPENSSL_INCLUDE_DIR=/usr/local/ssl/include -DOPENSSL_LIB=/usr/local/ssl/lib/libssl.so -DOPENSSLCRYPTO_LIB=/usr/local/ssl/lib/libcrypto.so .
注意指定库的路径的时候,一定要加上库名字。
3、解压mqtts-c-demo文件,修改CMakeLists.txt文件
cmake .
make 完成。