Skip to content

Instantly share code, notes, and snippets.

@krautcat
Last active July 17, 2017 15:47
Show Gist options
  • Select an option

  • Save krautcat/2b65593929bacb9157ed59627af0f53c to your computer and use it in GitHub Desktop.

Select an option

Save krautcat/2b65593929bacb9157ed59627af0f53c to your computer and use it in GitHub Desktop.
paho.mqtt.cpp installation
#!/bin/bash
BUILD_DIR="/tmp/build"
sudo apt-get install gcc cmake libssl-dev libjsoncpp1 libjsoncpp-dev ninja
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
git clone https://github.com/eclipse/paho.mqtt.c.git
git clone https://github.com/eclipse/paho.mqtt.cpp.git
# Compile and install C library as package
cd paho.mqtt.c
mkdir build && cd build
cmake -GNinja -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_DEB_PACKAGE=TRUE ..
ninja package
sudo dpkg -i $(find . -name "*.deb")
cd ../..
# Compile and install C++ library
cd paho.mqtt.cpp
mkdir build && cd build
cmake -DPAHO_MQTT_C_PATH=../../paho.mqtt.c ..
make && sudo make install
#!/bin/bash
su
dnf install -y openssl-devel gcc cmake jsoncpp jsoncpp-devel
BUILD_DIR="/tmp/build"
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
git clone https://github.com/eclipse/paho.mqtt.c.git
git clone https://github.com/eclipse/paho.mqtt.cpp.git
# Compile and install C library
cd paho.mqtt.c
mkdir build && cd build
cmake -DPAHO_WITH_SSL=TRUE ..
make && sudo make install
cd ../..
# Compile and install C++ library
cd paho.mqtt.cpp
mkdir build && cd build
cmake -DPAHO_MQTT_C_PATH=../../paho.mqtt.c ..
make && sudo make install
# Update dynamic library loader config files
echo "/usr/local/lib
/usr/local/lib64" > /etc/ld.so.conf.d/mqtt-x86_64.conf
ldconfig
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment