Use Libmodbus library



  • Goodmorning to all,
    I've build a custom OS image and sdk generated with yocto poky-morty so that I could cross compile my applications for a Raspberrypi3.
    Qt version is 5.7.1. I've done the folling steps:

    • Yocto generated the following modbus library files:
      libmodbus.so
      libmodbus.la
      libmodbus.so.5
      libmodbus.so.5.0.5
      saved in the following path of my host sytem:
      /opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/lib
    • When I try to compile the project I get the error:
      modbus.h: No such file or directory
    • I tried to include the external library, giving the path for libmodbus.so reported above but I get the same error.

    Can you help me?
    Thank you.


  • Lifetime Qt Champion

    Hi,

    Why not use the QtSerialBus module ?



  • Hello StGaist,
    thank you again for your answer. I didn't know of this library, and it looks simpler to use than the qt wrappeer that I found, I'll definitely pass to this.

    Just for information for those ones who use Yocto, the problem was that I had to add the following for seeing modbus.h:
    INCLUDEPATH += $$PWD/../../../../opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/modbus
    DEPENDPATH += $$PWD/../../../../opt/poky/sdk-2.2.2/sysroots/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/usr/include/modbus
    After that I had the following problem:
    cannot find /lib/arm-linux-gnueabihf/libpthread.so.0
    and found solution here:
    https://stackoverflow.com/questions/14207189/crosstools-ng-cant-find-pthread-so

    Thank you again StGaist :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.