将 paho mqtt c 与 arm-none-linux-gnueabi-gcc 和 arm-none-linux-gnueabi-g++ 链接时出错
Posted
技术标签:
【中文标题】将 paho mqtt c 与 arm-none-linux-gnueabi-gcc 和 arm-none-linux-gnueabi-g++ 链接时出错【英文标题】:Error in linking paho mqtt c with arm-none-linux-gnueabi-gcc and arm-none-linux-gnueabi-g++ 【发布时间】:2020-04-15 14:23:13 【问题描述】:我在下面的路径中有 arm-none-linux-gnueabi,并且使用相同的编译器来构建我的目标文件,
root@user-VirtualBox:/home/user/octane_etk_sample-6.0.0.240# which arm-none-linux-gnueabi-gcc
/home/user/octane_etk-6.0.0.240/arm-toolchain/bin/arm-none-linux-gnueabi-gcc
root@user-VirtualBox:/home/user/octane_etk_sample-6.0.0.240# which arm-none-linux-gnueabi-g++
/home/mindlogic/octane_etk-6.0.0.240/arm-toolchain/bin/arm-none-linux-gnueabi-g++
现在,我需要将 paho mqtt c & c++ 与上述编译器路径链接起来,这样我就可以在使用相同编译器的 trget 文件中包含 paho 头文件以建立连接。
我已给出以下命令将 paho mqtt c 与 arm-none-linux-gnueabi 链接并得到响应,
root@user-VirtualBox:/home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c# cmake -Bbuild -H. -DPAHO_WITH_SSL=ON -DPAHO_ENABLE_TESTING=OFF -DCMAKE_C_COMPILER=/home/user/octane_etk-6.0.0.240/arm-toolchain/bin/arm-none-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=/home/user/octane_etk-6.0.0.240/arm-toolchain/bin/arm-none-linux-gnueabi-g++
-- CMake version: 3.10.2
-- CMake system name: Linux
-- Timestamp is 2020-04-15T14:03:15Z
-- OpenSSL hints:
-- OpenSSL headers found at /usr/include
-- OpenSSL library found at OPENSSL_LIB-NOTFOUND
-- OpenSSL Crypto library found at OPENSSLCRYPTO_LIB-NOTFOUND
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSLCRYPTO_LIB
linked by target "Sha1TestOpenSSL" in directory /home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/src
linked by target "Base64TestOpenSSL" in directory /home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/src
linked by target "paho-mqtt3cs" in directory /home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/src
linked by target "paho-mqtt3as" in directory /home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/src
OPENSSL_LIB
linked by target "Sha1TestOpenSSL" in directory /home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/src
linked by target "Base64TestOpenSSL" in directory /home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/src
linked by target "paho-mqtt3cs" in directory /home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/src
linked by target "paho-mqtt3as" in directory /home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/src
-- Configuring incomplete, errors occurred!
See also "/home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/octane_etk_sample-6.0.0.240/paho.mqtt.c/build/CMakeFiles/CMakeError.log".
谁能帮我把 paho mqtt c & c++ 与 arm-none-linux-gnueabi-gcc & arm-none-linux-gnueabi-g++ 联系起来?paho
【问题讨论】:
【参考方案1】:这里的问题是它找不到正确版本的 OPENSSL 库来链接 paho 库,而不是工具链。
您需要设置它可以找到这些依赖库的 ARM 版本的路径,以便它们可以首先链接到 paho 库。
【讨论】:
我应该为 arm-none-linux-gnueabi-g++ 编译器安装 openssl 库吗? 您需要安装或构建目标架构的所有依赖项 是否应该使用 -DOPENSSL_LIB_SEARCH_PATH 来链接 SSL以上是关于将 paho mqtt c 与 arm-none-linux-gnueabi-gcc 和 arm-none-linux-gnueabi-g++ 链接时出错的主要内容,如果未能解决你的问题,请参考以下文章
MT7621加 OPENWRT 移植MQTT(paho.mqtt.c) 进行数据的收发
cmake:VS2015和GCC编译paho.mqtt C/C++ client