MQTT Client Support


#21

Hi Niladri,

Good to know it worked for you.
I am also attempting something similar but with openssl.
Are you also using openssl ?
If so any feedback how that can be done ?

Regards.
CKV


#22

I’m pretty sure that SSL won’t work yet. There was an “SSL options” parameter to one of the functions of paho.mqtt.c which is just being passed as NULL for now. SSL support is on the TODO list, but I don’t know when it will be implemented.


#23

Hi CKV,
openssl, I am not tired yet. Working on the same and will update soon.
@David, I am using “le_data_interface” to invoke the data connection service in MqttClient code and it is working fine.

Thanks


#24

Hi,

Pull the latest commit (c40f807248fdb5adb6b3636c7746aa472fef0e5b)
I am not able to compile this, there are undeclared variables mqtt_SessionRef_t, mqtt_Qos_t.
I can’t find definition in any headers of them.
David, can you please let me how to fix this?

Thanks!

ninja explain: _build_mqttClient/wp85/app/mqttClient/staging/info.properties is dirty
[1/11] /home/ytsai/legato/packages/legato.toolchain.1.7.3.SWI9X15Y_07120900-wp85-wp750x-native-x86_64-201705021320/resources/native/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -MMD -MF _build_mqttClient/wp85/app/mqttClient/obj/mqttClientService/_main.c.o.d -c _build_mqttClient/wp85/app/mqttClient/src/mqttClientService/_main.c -o _build_mqttClient/wp85/app/mqttClient/obj/mqttClientService/_main.c.o -DLE_FILENAME=basename _build_mqttClient/wp85/app/mqttClient/src/mqttClientService/_main.c -Wall -fPIC -Werror -fvisibility=hidden -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -I/work/legato/legato-16.10.3/interfaces -I/work/legato/legato-16.10.3/framework/c/inc -I/work/legato/legato-16.10.3/interfaces -I/work/legato/legato-16.10.3/apps/MqttClientPaho -DLE_COMPONENT_NAME=mqttClientService_exe -DLE_LOG_SESSION=mqttClientService_exe_LogSession -DLE_LOG_LEVEL_FILTER_PTR=mqttClientService_exe_LogLevelFilterPtr
[2/11] /home/ytsai/legato/packages/legato.toolchain.1.7.3.SWI9X15Y_07120900-wp85-wp750x-native-x86_64-201705021320/resources/native/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -MMD -MF _build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/obj/_componentMain.c.o.d -c _build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/src/_componentMain.c -o _build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/obj/_componentMain.c.o -DLE_FILENAME=basename _build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/src/_componentMain.c -Wall -fPIC -Werror -fvisibility=hidden -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -I/work/legato/legato-16.10.3/interfaces -I/work/legato/legato-16.10.3/framework/c/inc -I/work/legato/legato-16.10.3/interfaces -I/work/legato/legato-16.10.3/apps/MqttClientPaho -I./_build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/src -I./_build_mqttClient/wp85/api/bc276ed8773930165a03f7afbdac6287/server -DLE_COMPONENT_NAME=mqttClientService -DLE_LOG_SESSION=mqttClientService_LogSession -DLE_LOG_LEVEL_FILTER_PTR=mqttClientService_LogLevelFilterPtr “-DCOMPONENT_INIT=LE_CI_LINKAGE LE_SHARED void _mqttClientService_COMPONENT_INIT()”
[3/11] /home/ytsai/legato/packages/legato.toolchain.1.7.3.SWI9X15Y_07120900-wp85-wp750x-native-x86_64-201705021320/resources/native/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -MMD -MF _build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/obj/2b93a1ed74f8291a91f1c528918ff9eb.o.d -c /work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c -o _build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/obj/2b93a1ed74f8291a91f1c528918ff9eb.o -DLE_FILENAME=basename /work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c -Wall -fPIC -Werror -fvisibility=hidden -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -I/work/legato/legato-16.10.3/interfaces -I/work/legato/legato-16.10.3/framework/c/inc -I/work/legato/legato-16.10.3/interfaces -I/work/legato/legato-16.10.3/apps/MqttClientPaho -I./_build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/src -I./_build_mqttClient/wp85/api/bc276ed8773930165a03f7afbdac6287/server -DLE_COMPONENT_NAME=mqttClientService -DLE_LOG_SESSION=mqttClientService_LogSession -DLE_LOG_LEVEL_FILTER_PTR=mqttClientService_LogLevelFilterPtr “-DCOMPONENT_INIT=LE_CI_LINKAGE LE_SHARED void _mqttClientService_COMPONENT_INIT()” -std=c99 -I/work/legato/legato-16.10.3/apps/MqttClientPaho/…/…/apps/MqttClient/paho.mqtt.c/src
[4/11] cp -T /work/legato/legato-16.10.3/apps/MqttClientPaho/paho.mqtt.c/build/output/libpaho-mqtt3cs.so _build_mqttClient/wp85/app/mqttClient/staging/read-only/lib/libpaho-mqtt3cs.so && chmod u+rw,g+rw,o+r-w _build_mqttClient/wp85/app/mqttClient/staging/read-only/lib/libpaho-mqtt3cs.so
[5/11] cp -T /work/legato/legato-16.10.3/apps/MqttClientPaho/paho.mqtt.c/build/output/libpaho-mqtt3cs.so.1 _build_mqttClient/wp85/app/mqttClient/staging/read-only/lib/libpaho-mqtt3cs.so.1 && chmod u+rw,g+rw,o+r-w _build_mqttClient/wp85/app/mqttClient/staging/read-only/lib/libpaho-mqtt3cs.so.1
[6/11] cp -T /work/legato/legato-16.10.3/apps/MqttClientPaho/paho.mqtt.c/build/output/libpaho-mqtt3cs.so.1.0 _build_mqttClient/wp85/app/mqttClient/staging/read-only/lib/libpaho-mqtt3cs.so.1.0 && chmod u+rw,g+rw,o+r-w _build_mqttClient/wp85/app/mqttClient/staging/read-only/lib/libpaho-mqtt3cs.so.1.0
FAILED: /home/ytsai/legato/packages/legato.toolchain.1.7.3.SWI9X15Y_07120900-wp85-wp750x-native-x86_64-201705021320/resources/native/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/swi/y17-ext/sysroots/armv7a-vfp-neon-poky-linux-gnueabi -MMD -MF _build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/obj/2b93a1ed74f8291a91f1c528918ff9eb.o.d -c /work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c -o _build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/obj/2b93a1ed74f8291a91f1c528918ff9eb.o -DLE_FILENAME=basename /work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c -Wall -fPIC -Werror -fvisibility=hidden -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -I/work/legato/legato-16.10.3/interfaces -I/work/legato/legato-16.10.3/framework/c/inc -I/work/legato/legato-16.10.3/interfaces -I/work/legato/legato-16.10.3/apps/MqttClientPaho -I./_build_mqttClient/wp85/component/c5d02082d74530e3ed9078fb894b91f5/src -I./_build_mqttClient/wp85/api/bc276ed8773930165a03f7afbdac6287/server -DLE_COMPONENT_NAME=mqttClientService -DLE_LOG_SESSION=mqttClientService_LogSession -DLE_LOG_LEVEL_FILTER_PTR=mqttClientService_LogLevelFilterPtr “-DCOMPONENT_INIT=LE_CI_LINKAGE LE_SHARED void _mqttClientService_COMPONENT_INIT()” -std=c99 -I/work/legato/legato-16.10.3/apps/MqttClientPaho/…/…/apps/MqttClient/paho.mqtt.c/src
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:11:5: error: unknown type name 'mqtt_MessageArrivedHandlerFunc_t’
mqtt_MessageArrivedHandlerFunc_t messageArrivedHandler;
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:13:5: error: unknown type name 'mqtt_ConnectionLostHandlerFunc_t’
mqtt_ConnectionLostHandlerFunc_t connectionLostHandler;
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:19:32: error: unknown type name 'mqtt_Qos_t’
static int mqtt_QosEnumToValue(mqtt_Qos_t qos);
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:59:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session;
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:90:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t* session ///< [OUT] The created session if the return result is LE_OK
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:137:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session ///< Session to destroy
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:173:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session, ///< [IN] Session to set connection options in
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:259:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:317:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:369:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session,
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:373:5: error: unknown type name 'mqtt_Qos_t’
mqtt_Qos_t qos,
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:415:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session,
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:417:5: error: unknown type name 'mqtt_Qos_t’
mqtt_Qos_t qos
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:453:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session,
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:491:1: error: unknown type name 'mqtt_ConnectionLostHandlerRef_t’
mqtt_ConnectionLostHandlerRef_t mqtt_AddConnectionLostHandler
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:493:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session,
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:494:5: error: unknown type name 'mqtt_ConnectionLostHandlerFunc_t’
mqtt_ConnectionLostHandlerFunc_t handler,
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:531:5: error: unknown type name 'mqtt_ConnectionLostHandlerRef_t’
mqtt_ConnectionLostHandlerRef_t handler
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:561:1: error: unknown type name 'mqtt_MessageArrivedHandlerRef_t’
mqtt_MessageArrivedHandlerRef_t mqtt_AddMessageArrivedHandler
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:563:5: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t session,
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:564:5: error: unknown type name 'mqtt_MessageArrivedHandlerFunc_t’
mqtt_MessageArrivedHandlerFunc_t handler,
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:601:5: error: unknown type name 'mqtt_MessageArrivedHandlerRef_t’
mqtt_MessageArrivedHandlerRef_t handler
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:632:5: error: unknown type name 'mqtt_Qos_t’
mqtt_Qos_t qos ///< The QoS enum value to convert.
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c: In function ‘connectionLostEventHandler’:
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:689:34: error: comparison between pointer and integer [-Werror]
if (s->connectionLostHandler != NULL)
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:691:9: error: called object is not a function or function pointer
s->connectionLostHandler(s->connectionLostHandlerContext);
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c: In function ‘mqtt_MessageArrivedHandler’:
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:725:24: error: assignment makes integer from pointer without a cast [-Werror]
storedMsg->session = context;
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c: In function ‘messageReceivedEventHandler’:
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:756:23: error: passing argument 2 of ‘le_ref_Lookup’ makes pointer from integer without a cast [-Werror]
mqtt_Session* s = le_ref_Lookup(SessionRefMap, storedMsg->session);
^
In file included from /work/legato/legato-16.10.3/framework/c/inc/legato.h:194:0,
from /work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:1:
/work/legato/legato-16.10.3/framework/c/inc/le_safeRef.h:242:7: note: expected 'void ’ but argument is of type 'int’
void
le_ref_Lookup
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:759:9: error: format ‘%p’ expects argument of type ‘void *’, but argument 8 has type ‘int’ [-Werror=format=]
LE_WARN(“Session lookup failed for session=0x%p”, storedMsg->session);
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:763:34: error: comparison between pointer and integer [-Werror]
if (s->messageArrivedHandler != NULL)
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:765:39: error: ‘MQTT_MAX_TOPIC_LENGTH’ undeclared (first use in this function)
if (storedMsg->topicLength <= MQTT_MAX_TOPIC_LENGTH &&
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:765:39: note: each undeclared identifier is reported only once for each function it appears in
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:766:41: error: ‘MQTT_MAX_PAYLOAD_LENGTH’ undeclared (first use in this function)
storedMsg->payloadLength <= MQTT_MAX_PAYLOAD_LENGTH)
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:768:13: error: called object is not a function or function pointer
s->messageArrivedHandler(
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c: In function ‘DestroyAllOwnedSessions’:
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:802:9: error: unknown type name 'mqtt_SessionRef_t’
mqtt_SessionRef_t sRef = (mqtt_SessionRef_t)(le_ref_GetSafeRef(it));
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:802:35: error: ‘mqtt_SessionRef_t’ undeclared (first use in this function)
mqtt_SessionRef_t sRef = (mqtt_SessionRef_t)(le_ref_GetSafeRef(it));
^
In file included from /work/legato/legato-16.10.3/framework/c/inc/legato.h:189:0,
from /work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:1:
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:803:24: error: comparison between pointer and integer [-Werror]
LE_ASSERT(sRef != NULL);
^
/work/legato/legato-16.10.3/framework/c/inc/le_log.h:563:15: note: in definition of macro 'LE_ASSERT’
if (!(condition)) { LE_FATAL(“Assert Failed: ‘%s’”, #condition) }
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:809:13: error: passing argument 2 of ‘le_ref_DeleteRef’ makes pointer from integer without a cast [-Werror]
le_ref_DeleteRef(SessionRefMap, sRef);
^
In file included from /work/legato/legato-16.10.3/framework/c/inc/legato.h:194:0,
from /work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:1:
/work/legato/legato-16.10.3/framework/c/inc/le_safeRef.h:254:6: note: expected ‘void *’ but argument is of type 'int’
void le_ref_DeleteRef
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c: At top level:
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:665:13: error: ‘mqtt_ConnectionLostHandler’ defined but not used [-Werror=unused-function]
static void mqtt_ConnectionLostHandler
^
/work/legato/legato-16.10.3/apps/MqttClientPaho/mqttClientService/mqttClientService.c:706:12: error: ‘mqtt_MessageArrivedHandler’ defined but not used [-Werror=unused-function]
static int mqtt_MessageArrivedHandler
^
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
Makefile:9: recipe for target ‘wp85’ failed
make: *** [wp85] Error 1


#25

I’m not sure of the cause of the exact problem you’re having. I just pushed an update which updates the paho.mqtt.c to the recently released v1.2.0. Also, is there a reason why you’re building against Legato 16.10.3 rather than 17.06.0 or 17.05.0?


#26

I update to Legato 17.0.6, and pulled the latest - now it’s compiling fine.
Thanks David!


#27

I am trying to get this to run. I built the paho.mqtt.c and while trying to make the application, I am getting the following error:

 mangoh@mangoh-virtualbox:~/MqttClient$ make
export TARGET=wp85 ; \
mkapp -v -t wp85 -i /home/mangoh/legato/packages/legato.framework.17.6.0.wp85-wp750x-201707120855/resources/legato/interfaces \
          mqttClient.adef
Command-line arguments from previous run not found.
Parsing file: '/home/mangoh/MqttClient/mqttClient.adef'.
Modelling application: 'mqttClient'
  defined in '/home/mangoh/MqttClient/mqttClient.adef'
Application 'mqttClient' contains executable 'mqttClientService'.
Parsing file: '/home/mangoh/MqttClient/mqttClientService/Component.cdef'.
Modelling component: 'mqttClientService'
  found at: '/home/mangoh/MqttClient/mqttClientService'
** ERROR:
/home/mangoh/MqttClient/mqttClientService/Component.cdef:30:8: error: Couldn't find file '$MANGOH_ROOT/apps/MqttClient/mqtt.api'.
Makefile:9: recipe for target 'wp85' failed
make: *** [wp85] Error 1

Please help me figure this out!


#28

run echo $MANGOH_ROOT in the terminal where you are trying to build. If nothing is shown, then do export MANGOH_ROOT=/path/to/your/mangOH_folder


#29

Oh I totally missed setting that up. But now I am getting another error:

/home/mangoh/MqttClient/mqttClientService/mqttClientService.c:4:24: fatal error: MQTTClient.h: No such file or directory
#include “MQTTClient.h”
^
compilation terminated.
ninja: build stopped: subcommand failed.
Makefile:9: recipe for target ‘wp85’ failed
make: *** [wp85] Error 1


#30

Hi,
I am testing MQTTClient application on wp8548 board, I have successfully compiled the application ‘MQTTClient’ using legato framework. But when i run the ‘testSubscriber’ application it doesn’t produce any output(even printf inside COMPONENT_INIT function not producing any output on console). I also changed the mqtt broker URI to local address ‘127.0.0.1:1883’ as there is mosquitto broker running under linux environment. Do i need to make any extra changes?


#31

Hi dfrey, I have wp7502 and when I cd into the MqttClient folder and type make I got

missing and no known rule to make it
Makefile:9: recipe for target ‘wp85’ failed
make: *** [wp85] Error 1

Can you help me out?


#32

I encountered same error. Did you figure it out?


#33

I have fixed the MqttClient Makefile, so you should be able to do make wp85, make wp750x or make wp76xx now depending on your module.


#34

I manage to make this now but I can not get it to work
my MQTT broker url is in this form
iot.example.ee:1883
Question 1: Is this line correct?
const char mqttBrokerURI[] = “tcp://iot.example.ee:1883”;

I have to use 32 characters long username and password for example ad3b32a228dbd491c9e30cd954f742b9

Question 2: Is this line correct?
char username[] = “ad3b32a228dbd491c9e30cd954f742b9”

Question 3: Is this password line correct? What’s the deal with uint8_t?
const uint8_t mqttPassword[] = “1c9e30cd954ad3b32a228dbd49f742b9”

Question 4: I found this comment from code: // paho uses null terminated strings for passwords, so the password may not contain any embedded null characters. What?


#35

Hi @dfrey,

I am getting the below error when I try to start the mqttclient on the target.

tc/ssl/certs/fc5a8f99.0’ to ‘/legato/systems/current/appsWriteable/mqttClient/etc/ssl/certs/fc5a8f99.0’: Already exists
Jan 6 02:24:12 swi-mdm9x28 user.info Legato: INFO | supervisor[693]/supervisor T=main | app.c CreateFileLink() 1518 | Skipping file link ‘/etc/ssl/certs/fcac10e3.0’ to ‘/legato/systems/current/appsWriteable/mqttClient/etc/ssl/certs/fcac10e3.0’: Already exists
Jan 6 02:24:12 swi-mdm9x28 user.info Legato: INFO | supervisor[693]/supervisor T=main | app.c CreateFileLink() 1518 | Skipping file link ‘/etc/ssl/certs/thawte_Primary_Root_CA.pem’ to '/legato/systems/current/appsWriteable/mqttClient/etc/ssl/certs/thawte_Primary_Root_CA.
Jan 6 02:24:12 swi-mdm9x28 user.info Legato: INFO | supervisor[693]/supervisor T=main | app.c CreateFileLink() 1518 | Skipping file link ‘/etc/ssl/certs/thawte_Primary_Root_CA_-G2.pem’ to '/legato/systems/current/appsWriteable/mqttClient/etc/ssl/certs/thawte_Primary_Roo
Jan 6 02:24:12 swi-mdm9x28 user.info Legato: INFO | supervisor[693]/supervisor T=main | app.c CreateFileLink() 1518 | Skipping file link '/etc/ssl/certs/thawte_Primary_Root_CA
-_G3.pem’ to '/legato/systems/current/appsWriteable/mqttClient/etc/ssl/certs/thawte_Primary_Roo
Jan 6 02:24:12 swi-mdm9x28 user.info Legato: INFO | supervisor[693]/supervisor T=main | app.c CreateFileLink() 1518 | Skipping file link ‘/etc/ssl/openssl.cnf’ to ‘/legato/systems/current/appsWriteable/mqttClient/etc/ssl/openssl.cnf’: Already exists
Jan 6 02:24:12 swi-mdm9x28 user.err Legato: =ERR= | supervisor[693]/supervisor T=main | app.c CreateFileLink() 1490 | Could not stat file at ‘/lib/libcrypto.so’. No such file or directory
Jan 6 02:24:12 swi-mdm9x28 user.err Legato: =ERR= | supervisor[693]/supervisor T=main | app.c CreateFileLink() 1593 | Failed to create link at ‘/lib/libcrypto.so’ in app ‘mqttClient’.
Jan 6 02:24:12 swi-mdm9x28 user.info Legato: INFO | supervisor[693]/supervisor T=main | supervisor.c SigChildHandler() 781 | Reaping unconfigured child process 21960.

Could you let me know what is that I am doing wrong while building?
I feel I am missing something.

Kindly help.

Regards,
Devaiah


#36

I have resolved this issue. It was due to library files location mismatch.


#37

Hi @dfrey,
I get the error when I try to do the following:
cd pahoLegatoComponent/paho.mqtt.c/
make
This is done successfully
cd …/…
make wp77xx
I got an error:
FAILED: /opt/swi/y22-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/swi/y22-ext/sysroots/armv7a-neon-poky-linux-gnueabi -shared -o _build_mqttClient/wp77xx/staging/read-only/lib/libComponent_mqttClientService.so _build_mqttClient/wp77xx/component/c68a67c59d0d9427ebfaeb66c716ec6d/obj/d91f3c57118e9824ef30cf38b7727fd3.o _build_mqttClient/wp77xx/api/ee9abd22411f054b6f4b528e1cd87b2b/server/mqtt_server.o _build_mqttClient/wp77xx/component/c68a67c59d0d9427ebfaeb66c716ec6d/obj/_componentMain.c.o -lpaho-mqtt3cs -lpaho-mqtt3cs -lpaho-mqtt3cs -L/home/artem/legato/workspace/git/MqttClient/…/…/apps/MqttClient/pahoLegatoComponent/paho.mqtt.c/build/output -L_build_mqttClient/wp77xx/staging/read-only/lib -Wl,–enable-new-dtags,-rpath="$ORIGIN/…/lib" “-L_build_mqttClient/wp77xx/component/d3833d982d14c8cf018567f6ade2027c” “-L$LEGATO_BUILD/framework/lib” -llegato -lpthread -lrt -lm
/opt/swi/y22-ext/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.2.0/real-ld: cannot find -lpaho-mqtt3cs
/opt/swi/y22-ext/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.2.0/real-ld: cannot find -lpaho-mqtt3cs
/opt/swi/y22-ext/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.2.0/real-ld: cannot find -lpaho-mqtt3cs
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Makefile: 9: failed to execute the recipe for the target “wp77xx”
make: *** [wp77xx] Error 1

Please help

So far I decided to do this:
sudo mv build/output/lib* /opt/swi/y22-ext/sysroots/armv7a-neon-poky-linux-gnueabi/lib/

I do not know if this is correct, but the command “make wp7702” was successful


#38

I’m not sure what the exact problem is that you encountered, but I just pushed an update to the use_paho_linux_version branch which substantially changes the way the app is built. Update to the latest commit and give it another try. Let me know if you’re still stuck.