Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

install "serialbus" module



  • Hello !

    I'm trying to install "serialbus" module. Because, I would like to code a communication between two devices with modbus protocol.

    But it doesn't work.

    I'm working with :

    • Linux Mint 18 OS
    • Qt creator 4.5.2 based on Qt 5.9.5

    Here, my Build & run's configuration :
    0_1550073505609_Screenshot_2019-02-13_16-58-17.png
    I don't know what linux package to install.

    Thank you for your help.
    PP



  • @dfvgergver not that I've used it myself, but it looks like Qt Modbus support is "built-in" with 5.9 see documentation.

    I don't know what linux package to install
    From Qt standpoint, I guess you should have everything laid out. You might need some driver(s) for any specific card although, I'm not sure.

    Have you tried any of the examples provided? i.e. Modbus slave example 5.9

    I've just tried with Qt 5.12.0 and I was able to at least build the Modbus slave example 5.12 out of the box...


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Since you are using your distribution provided Qt, use its package manager to install additional Qt packages.



  • @Pablo-J-Rogina Yes, i'm agree with you. But I had some doubts :-| . Because it didn't work anyway.

    I tried to launch some modbus examples. But I didn't find them...
    0_1550131770764_Screenshot_2019-02-14_09-08-42.png

    I don't understand why. Because i installed all possible qt examples packages with this command : apt-get install qt.*example.

    @SGaist I installed Qt creator and all other qt packages with apt-get command.
    Then I tried to install serial bus module with linux qt installer (qt-unified-linux-x64-3.0.6-online.run). But it didn't work. Because the downloading is VERY slow.


    And, to be more specific, i have this error when I run make :

    /usr/lib/qt5/bin/qmake -o Makefile modbus_com.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
    Project ERROR: Unknown module(s) in QT: serialbus
    

    Thank you


  • Lifetime Qt Champion

    @dfvgergver said in install "serialbus" module:

    Then I tried to install serial bus module with linux qt installer (qt-unified-linux-x64-3.0.6-online.run)

    This will not help as you can't mix your Linux distributions Qt packages and those installed via Qt installer.
    On my Ubuntu system I see libqt5serialport5 package - did you install it (and its -dev packet)?



  • @jsulm yes, i installed libqt5serialport5 and libqt5serialport5-dev packages.


  • Lifetime Qt Champion

    @dfvgergver What happens if you remove "-spec linux-g++"?



  • nothing good :-(
    I have this message : "make: *** No rule to make target 'common/xxx_params.cpp', needed by 'xxx_params.o'. Stop."

    But it's normal.

    Because, I have a project A which to work must include a project B (a kind of template I suppose).
    However, it is this project B that requires the "serialbus" module. That's why I tried to compile this project B to "get closer to the problem". But it makes no sense to compile project B since it is intended to be included in another project.
    Sorry if my explanations are a little esoteric. I am a new Qt user (I only know him for 2 days...).


  • Lifetime Qt Champion

    @dfvgergver

    The package you need is qtserialbus, not qtserialport.

    If your distribution does not provide it, you have two options:

    1. Install the complete Qt with the online installer
    2. Use the distribution Qt packages and compile qtserialbus from source. The source code can be cloned with Git from git://code.qt.io/qt/qtserialbus.git

    Regards



  • I'm trying the option two.

    But, when i execute make (after run qmake), i have this error :

    qcanbusdevice_p.h:43:10: fatal error: private/qobject_p.h: No such file or directory
     #include <private/qobject_p.h>
              ^~~~~~~~~~~~~~~~~~~~~
    

    And from qtcreator when i open the .pro file and try to compile :
    0_1550141717448_Screenshot_2019-02-14_11-54-14.png

    So, i'm trying to find the package which contain the "private/qobject_p" library. But, i don't find him...



  • @dfvgergver is it a good reason you're using "Qt creator 4.5.2 based on Qt 5.9.5"?

    I'd suggest that instead of go looking for a needle in the haystack (i.e. building yourself the Qt Serialbus module, you install Qt 5.12.0 (or 5.12.1) that will provide you with the module you're looking for in a smooth way...



  • I would like to be able to install the 5.12 on my linux mint. But I can't go through the Qt installer to install Qt 5.12 (see above): the connection is too slow.


  • Lifetime Qt Champion

    @dfvgergver
    Hi
    I wonder if using another server would help ?
    https://github.com/JKSH/QtSdkRepoChooser

    However, if its the actual connection that's too slow it won't help.



  • @dfvgergver said in install "serialbus" module:

    But I can't go through the Qt installer to install Qt 5.12 (see above): the connection is too slow

    Could it be possible you use any of the offline installers?



  • I use qmake & make to compile the source then something happen with these below:
    qcanbusdevice_p.h:43:10: fatal error: private/qobject_p.h: No such file or directory
    Anyone who can tell what's wrong with it . I guess the module sources of qt on github more or less give some tips for users how to build them but nothing clue happened so far. By the way i'm using ubuntu 18.05 and no serialbus module for this platform, please help!



  • I build serialbus with the following instructions (also mirrored in this gist: https://gist.github.com/awesomebytes/ed90785324757b03c8f01e3ffa36d436):

    # Overkill: get all qt-stuff
    sudo apt install qml-module-qt-labs-folderlistmodel qml-module-qtquick-extras qml-module-qtquick-controls2 qt5-default libqt5quickcontrols2-5 qtquickcontrols2-5-dev qtcreator qtcreator-doc libqt5serialport5-dev build-essential qml-module-qt3d qt3d5-dev qtdeclarative5-dev qtconnectivity5-dev qtmultimedia5-dev
    # To get rid of the private/qobject_p.h error
    sudo apt-get install qtbase5-private-dev
    # Build and install qtserialbus
    git clone git://code.qt.io/qt/qtserialbus.git
    cd qtserialbus
    git checkout 5.9.8
    qmake
    make -j6
    sudo make install
    

    I hope it may be useful for someone else.

    I found that qt in Ubuntu 18.04 from official apt repositories (Qt 5.9.6) didn't have serialbus so it needs to be built and installed like that.


Log in to reply