遵循 AWS 指南:https : //aws.amazon.com/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/ 我到了安装 mosquitto 的步骤。
//Update the list of repositories with one containing Mosquitto
sudo wget http://download.opensuse.org/repositories/home:/oojah:/mqtt/CentOS_CentOS-7/home:oojah:mqtt.repo -O /etc/yum.repos.d/mqtt.repo
//Install Mosquitto broker and Mosquitto command line tools
sudo yum install mosquitto mosquitto-clients
但是,该指南已经过时,没有提到任何关于缺少的 libwebsockets 库的内容。我花了大约 4-5 个小时来寻找有关如何手动安装/链接/设置库的答案,但我无法使任何工作。
(1) 试过这个
git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc
make
sudo make install
但是是的,那没有用,因为 CMAKE 抛出了各种各样的错误,比如
CMake Error at /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:99 (message): Could not find toolchain file: /tmp/mytoolchainfile
Call Stack (most recent call first):
CMakeLists.txt:131 (project)
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file: /tmp/libwebsockets/build/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake
-- Configuring incomplete, errors occurred!
所以我尝试将 CMAKE_C_COMPILER 路径设置为 /usr/bin/gcc,这是安装编译器的位置,也没有做任何事情。老实说,我对 Linux 不是很熟悉,我只是想尽我所能。我真的可以使用一些关于如何最好地安装库并将其链接到 Linux 的指导。我确实相信 AWS 运行的是红帽版本的 linux。
谢谢你的时间!