[MQTT Paho C++] cannot find -lpaho-mqttpp3 when compiling /../src/samples

1,959 views
Skip to first unread message

Marco Datola

unread,
Aug 25, 2016, 12:50:04 PM8/25/16
to MQTT

As per title I'm having problems running the Makefile located in
org.ecliplse.paho.mqtt.cpp/src/samples

I understand the C++ library requires the C library to be correctly installed. To do so I followed the documentation
and in /usr/local/lib I'm able to locate
libpaho-mqtt3a.so
libpaho-mqtt3a.so.1
libpaho-mqtt3a.so.1.0
libpaho-mqtt3as.so
libpaho-mqtt3as.so.1
libpaho-mqtt3as.so.1.0
libpaho-mqtt3c.so
libpaho-mqtt3c.so.1
libpaho-mqtt3c.so.1.0
libpaho-mqtt3cs.so
libpaho-mqtt3cs.so.1
libpaho-mqtt3cs.so.1.0

am I missing something on the installation of the C library? should lpaho-mqttpp3 be produced at that stage?

please help

Frank Pagliughi

unread,
Aug 25, 2016, 3:14:05 PM8/25/16
to mq...@googlegroups.com

Yes, apologies, we're currently working on the build system for the C++ library.  All the libraries that you see in the /usr/local/lib are the Paho C libraries.  The C++ library produces a single library, libpaho-mqttpp, when you build from the top-level cpp workspace. That's the file that is missing.

The GitHub 'develop' branch is in flux at the moment, as we proceed to a 1.0 release of the C++ library, but has a number of updates that might be helpful, particularly a "make install" build target. To get this, clone the latest GitHub repo and then checkout the 'develop' branch:

$ git clone https://github.com/eclipse/paho.mqtt.cpp.git
$ cd paho.mqtt.cpp
$ git checkout develop

$ make
$ sudo make install
$ make samples
That get you going for now. Look for a stable 'master' in a few weeks time.

Frank Pagliughi
--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at https://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.

Marco Datola

unread,
Aug 26, 2016, 9:56:05 AM8/26/16
to MQTT
Thanks so much for your reply. The make compiles fine now.

Would you be able to tell me why when launching
$ ./async_publish
I get the following error:
error while loading the shared libraries: libpaho-mqttpp3.so.0: cannot open shared object file: No such file or directory, should I

Just to be safe I copied libpaho-mqttpp3.so and libpaho-mqttpp3.so.0 in both /org.eclipse.paho.mqtt.c/build/output and /paho.mqtt.cpp/src/samples although I'm pretty sure this makes no difference.

Thanks in advance

Frank Pagliughi

unread,
Aug 26, 2016, 12:14:40 PM8/26/16
to mq...@googlegroups.com

It seems that the loader can not find the shared library. Assuming that you ran "sudo make install", if the libpaho-mqttpp3 library and major/minor version soft links made it into /usr/local/lib, then you just need to re-run ldconfig as the superuser to update the loader cache:

$ sudo ldconfig

If that solves the problem, then the make file should be updated to ensure this is automatically run after the install.

Frank

Reply all
Reply to author
Forward
0 new messages