|
Re: paho mqtt on wago? [message #1753363 is a reply to message #1753327] |
Sat, 04 February 2017 18:28 |
|
Hi,
you would need to also cross compile mqtt. For a first test you can do this without ssl support. As Wago uses the ptxdist envrionment for building you would need to make your own ptx dist package for mqtt. This would be similar to what we did for FORTE. Maybe the FORTE ptxdist files can even serve you as starting point.
Alois
|
|
|
Re: paho mqtt on wago? [message #1753395 is a reply to message #1753363] |
Sun, 05 February 2017 19:13 |
|
Hi,
I'm not familiar with the Wago ptxdist environment, but I crosscompiled Eclipse Paho MQTT successfully for a Raspberry Pi and used it together with FORTE. First i tried to get the Paho sources from the Repository given on the Eclipse Paho MQTT Website and in the 4DIAC documentation, but that did not work for me. I had to clone the sources from https://github.com/eclipse/paho.mqtt.c.git. If you are not using any special settings, mqtt is compiled and linked with SSL support and you might get a linker error if the openssl includes and libraries are not present on your system.
I also attached a little PDF showing the steps I did to get MQTT up and running, there might be better ways to do it, but it worked for me
Herwig
|
|
|
Re: paho mqtt on wago? [message #1753396 is a reply to message #1753363] |
Sun, 05 February 2017 19:14 |
|
Hi,
I'm not familiar with the Wago ptxdist environment, but I crosscompiled Eclipse Paho MQTT successfully for a Raspberry Pi and used it together with FORTE. First i tried to get the Paho sources from the Repository given on the Eclipse Paho MQTT Website and in the 4DIAC documentation, but that did not work for me. I had to clone the sources from https://github.com/eclipse/paho.mqtt.c.git. If you are not using any special settings, mqtt is compiled and linked with SSL support and you might get a linker error if the openssl includes and libraries are not present on your system.
I also attached a little PDF showing the steps I did to get MQTT up and running, there might be better ways to do it, but it worked for me
Herwig
[Updated on: Sun, 05 February 2017 19:15] Report message to a moderator
|
|
|
Re: paho mqtt on wago? [message #1753399 is a reply to message #1753396] |
Sun, 05 February 2017 20:31 |
|
Hi,
you are right per default Paho requires ssl support. But when I compiled Paho for the Bosch Rexroth PLC I found out you can dissable it in Paho's cmake option.
Alois
P.S.: I think the 4diac docs have now also the correct repository to clone.
|
|
|
|
Re: paho mqtt on wago? [message #1754446 is a reply to message #1753896] |
Fri, 17 February 2017 21:19 |
Ernst Murnleitner Messages: 19 Registered: December 2016 |
Junior Member |
|
|
In the meantime we cross compiled it, but it does not work.
Publish1/Subscribe1 say "invalid id" or "terminated", which also is displayed if we write any trash into "ID" of the PUBLISH1 FB. Publish and subscribe programs supplied as Paho examples work on the wago. Starting forte, there is no error.
The connect-function of the paho mqtt layer is never called.
Unfortunately there are many possibilities for making errors but forte compiles and links and there is no helpful errormessage and the logfile is empty.
Here some errors which occured:
- in CMakeList of paho, "mqtt" is set "OFF" by default, which we did not recognise. There is no error message, forte is linked, the project is deployed
- Accidentally we linked the i386 version of the paho libs. There is an error in the output of the ptxdist logfile, but the forte binary was produced. There was no error after deploy.
- the paho directory in the setting for forte was wrong once but forte was linked.
- the mqtt computer has 2 ip addresses, if you use both, paho is not working
|
|
|
Re: paho mqtt on wago? [message #1754447 is a reply to message #1754446] |
Fri, 17 February 2017 21:20 |
Ernst Murnleitner Messages: 19 Registered: December 2016 |
Junior Member |
|
|
On my computer w/o cross compiler I found in the generated bin directory the code presented below.
The constructor of MQTTComLayer was not called on the forte for wago.
But it was compiled. And paho libs was linked (2 of them, withoud ssl).
I cannot access the computer with the ptxdist cross compiler now, but we can look on Monday, if this code was generated there also.
The CMakeList of the forte paho was adjusted:
forte_add_network_layer(PAHOMQTT OFF "mqtt" MQTTComLayer MQTTComLayer "Enable Paho MQTT Com Layer")
was changed to "ON"
forte_add_link_library( paho-mqtt3a.so paho-mqtt3as.so paho-mqtt3c.so paho-mqtt3cs.so)
was changed:
forte_add_link_library( paho-mqtt3a.so paho-mqtt3c.so)
Here the above mentioned source code:
CComLayer* CComLayersManager::createCommunicationLayer(char *pa_acLayerIdentifier, CComLayer* pa_poUpperLayer, CCommFB * pa_poComFB){
CComLayer* m_poNewLayer = 0;
if(false){}
else if(0 == strcmp("fbdk", pa_acLayerIdentifier)){
m_poNewLayer = new CFBDKASN1ComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("ip", pa_acLayerIdentifier)){
m_poNewLayer = new CIPComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("loc", pa_acLayerIdentifier)){
m_poNewLayer = new CLocalComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("raw", pa_acLayerIdentifier)){
m_poNewLayer = new CRawDataComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("json", pa_acLayerIdentifier)){
m_poNewLayer = new CJsonComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("mqtt", pa_acLayerIdentifier)){
m_poNewLayer = new MQTTComLayer(pa_poUpperLayer, pa_poComFB);
}
return m_poNewLayer;
}
[Updated on: Fri, 17 February 2017 21:41] Report message to a moderator
|
|
|
Re: paho mqtt on wago? [message #1754486 is a reply to message #1754447] |
Sat, 18 February 2017 16:27 |
|
In order to turn on MQTT you need to explicitly set the CMAKE option FORTE_COM_PAHOMQTT to ON. Only when this option is ON the communication layer will be added to forte. This is true for any comunication layer (e.g., also the JSon layer you proposed).
This can be don either by adjusting the setup_posix.sh, checking the option in the cmake gui or by editing the CMakeCache.txt in your build directory. For Wago you should adjust the FORTE_WAGO_CONF_OPT option of the forte_wago.make of the ptx build system. Please don't change the CMakeList.txt in the mqtt_paho directory.
|
|
|
Re: paho mqtt on wago? [message #1754539 is a reply to message #1754486] |
Sun, 19 February 2017 22:28 |
Ernst Murnleitner Messages: 19 Registered: December 2016 |
Junior Member |
|
|
> In order to turn on MQTT you need to explicitly set the CMAKE option FORTE_COM_PAHOMQTT to ON. Only when this option is ON the communication layer will be added to forte. This is true for any comunication layer (e.g., also the JSon layer you proposed).
This was already switched on from the beginning.
The change of CMakeList was made at the latest try only.
I guess, without FORTE_COM_PAHOMQTT setting to on, the paho libs would not have been linked to forte.
[Updated on: Sun, 19 February 2017 22:33] Report message to a moderator
|
|
|
|
Re: paho mqtt on wago? [message #1754608 is a reply to message #1754591] |
Mon, 20 February 2017 21:18 |
|
This is a very nasty situation. I never experienced it that it is so hard to get mqtt running on a platform. Espcially as Wago PFC200 is Linux based. We even got it running on vxWorks. There the main issue was to get it compiling. But when we had the lib it worked. I hope we can soon sort it out what is the cause here as well.
|
|
|
|
Re: paho mqtt on wago? [message #1754915 is a reply to message #1754869] |
Thu, 23 February 2017 22:34 |
|
This is really strange that the ptxdist build is producing a different result. Would be interesting to find out the cause. But good that you have some workaround for you.
Both are arm processors with linux so the binary compatibility seams reasonable.
|
|
|
Powered by
FUDForum. Page generated in 0.05978 seconds