[SOLVED] QT Serial Communication with Beaglebone



  • Hello everybody,

    I try to get a QT application with serial communication working on my Beaglebone but I'm stuck...

    I've installed QT Creator 3.0.0
    and I've installed qt4-embedded for working with my Beaglebone. The QT version I use is : QT 4.6.3 in PATH (arm).

    So I've downloaded qt-qtserialport sources form here : http://qt.gitorious.org/qt/qtserialport/archive-tarball/stable and extracted it.
    Then I've opened the project from QT Creator and selected the kit I created for my Beaglebone when prompted (I created a test app with this kit and it works fine on the beaglebone).

    I don't understand the explanation given in Build and install from the QtCreator on the QtSerialPort page => add a new make “Build Step” and write to the “Make arguments” the inslall target. What do I need to do ?

    I tried to build and run like that but get loads of errors.

    Any help or advice would be welcome.
    Thanks in advance.



  • bq. What do I need to do ?

    This: http://pbrd.co/1byGbXh

    bq. QT 4.6.3 in PATH (arm).

    The QtSerialPort support Qt 4.8.0 and above.



  • I build it without any problems
    using ur terminal
    cd to qtserialport directory
    qmake qtserialport.pro
    make
    make install

    on windows use mingw32-make instead of make



  • so, what a problem?



  • can you post the compile error log to be able to help you?



  • Hello, Thank you for your answers !

    kuzulis : Thanks for your screenshot ! If you're right, I have to install qt 4.8 (not really anniying because final development need to use QT 4.8.2). Just have to repreat configure QT 4.8.2 for my Beaglebone.

    seiko : If I use mingw32-make, this will compile the project for use Linux apps not for Beaglebone apps, right ?

    seiko : here is a picture with compiler errors :
    !http://nomics.be/files/debug/ScreenshotQtError.png(QtSerialPort compiler errors)!

    So now I will install qt 4.8.2 and try to compile QtSerialPort using this version.

    Thank you.



  • QElapsedTimer introduced in Qt 4.7 . so you gonna need to upgrade



  • Ok, I upgraded my version to QT 4.8.2 and configure my BeagleboneKit to use this version. But I still get the same errors when trying to build the project.

    seiko : I get a warning when trying to compile using my term :
    /opt/qt/bin$ qmake ~/Downloads/qt-qtserialport/qtserialport.pro
    The program 'qmake' can be found in the following packages:

    • qt3-dev-tools
    • qt4-qmake
      Try: sudo apt-get install <selected package>

    What do I need to do ? Thanks in advance.



  • you are request qmake from system bin prefix since
    you are inside directory as i can see
    /opt/qt/bin
    use ./qmake instead of qmake
    or use
    @
    cd ~/Downloads/qt-qtserialport && /opt/qt/bin/qmake ~/Downloads/qt-qtserialport/qtserialport.pro && make
    @
    then
    @
    sudo make install
    @



  • Hi,

    tried your command seiko but still get the errors...

    cd ~/Downloads/qt-qtserialport && /opt/qt/bin/qmake ~/Downloads/qt-qtserialport/qtserialport.pro && make
    WARNING: /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/share/qtopia/mkspecs/common/g++.conf:44: Variable QMAKE_RPATH is deprecated; use QMAKE_LFLAGS_RPATH instead.
    WARNING: /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/share/qtopia/mkspecs/features/yacc.prf:27: Unescaped backslashes are deprecated.
    WARNING: /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/share/qtopia/mkspecs/features/lex.prf:19: Unescaped backslashes are deprecated.
    cd src/ && make -f Makefile
    make[1]: Entering directory /home/julian/Downloads/qt-qtserialport/src' cd serialport/ && make -f Makefile make[2]: Entering directory/home/julian/Downloads/qt-qtserialport/src/serialport'
    arm-angstrom-linux-gnueabi-g++ -c -pipe -Wall -W -D_REENTRANT -fPIC -DQT_BUILD_SERIALPORT_LIB -DQT_NO_DEBUG -DQT_CORE_LIB -I/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/share/qtopia/mkspecs/linux-g++ -I. -I/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi//usr/include/qtopia/QtCore -I/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi//usr/include/qtopia -I. -I../../include -I../../include/QtSerialPort -Iqt4support/include -Iqt4support/include/QtCore -Iqt4support/include/private -I. -o qserialport_unix.o qserialport_unix.cpp
    qserialport_unix.cpp:58:34: error: QtCore/qelapsedtimer.h: No such file or directory
    qserialport_unix.cpp: In member function 'bool QSerialPortPrivate::waitForReadyRead(int)':
    qserialport_unix.cpp:427: error: 'QElapsedTimer' was not declared in this scope
    qserialport_unix.cpp:427: error: expected ;' before 'stopWatch' qserialport_unix.cpp:429: error: 'stopWatch' was not declared in this scope qserialport_unix.cpp: In member function 'bool QSerialPortPrivate::waitForBytesWritten(int)': qserialport_unix.cpp:461: error: 'QElapsedTimer' was not declared in this scope qserialport_unix.cpp:461: error: expected;' before 'stopWatch'
    qserialport_unix.cpp:463: error: 'stopWatch' was not declared in this scope
    make[2]: *** [qserialport_unix.o] Error 1
    make[2]: Leaving directory /home/julian/Downloads/qt-qtserialport/src/serialport' make[1]: *** [sub-serialport-make_default] Error 2 make[1]: Leaving directory/home/julian/Downloads/qt-qtserialport/src'
    make: *** [sub-src-make_default-ordered] Error 2

    Then I tried : /opt/qt/bin$ sudo ./qmake ~/Downloads/qt-qtserialport/qtserialport.pro
    Makefile has been generated but then, when calling make :
    /opt/qt/bin$ ls

    Makefile moc qmake rcc uic
    /opt/qt/bin$ sudo make

    I get the following errors :

    cd src/ && /opt/qt/bin/qmake /home/julian/Downloads/qt-qtserialport/src/src.pro -o Makefile
    cd src/ && make -f Makefile
    make[1]: Entering directory /opt/qt/bin/src' cd serialport/ && /opt/qt/bin/qmake /home/julian/Downloads/qt-qtserialport/src/serialport/serialport.pro -o Makefile cd serialport/ && make -f Makefile make[2]: Entering directory/opt/qt/bin/src/serialport'
    /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/bin/g++ -c -pipe -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -Wall -W -D_REENTRANT -fPIC -DQT_BUILD_SERIALPORT_LIB -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/opt/qt/mkspecs/qws/linux-am335x-g++ -I/home/julian/Downloads/qt-qtserialport/src/serialport -I/opt/qt/include/QtCore -I/opt/qt/include -I/home/julian/Downloads/qt-qtserialport/src/serialport -I../../include -I../../include/QtSerialPort -I/home/julian/Downloads/qt-qtserialport/src/serialport/qt4support/include -I/home/julian/Downloads/qt-qtserialport/src/serialport/qt4support/include/QtCore -I/home/julian/Downloads/qt-qtserialport/src/serialport/qt4support/include/private -I. -I/home/julian/Downloads/qt-qtserialport/src/serialport -I. -o qserialport.o /home/julian/Downloads/qt-qtserialport/src/serialport/qserialport.cpp
    In file included from /home/julian/Downloads/qt-qtserialport/src/serialport/qserialport.cpp:1399:
    /home/julian/Downloads/qt-qtserialport/src/serialport/moc_qserialport.cpp:14:2: error: #error "This file was generated using the moc from 4.6.3. It"
    /home/julian/Downloads/qt-qtserialport/src/serialport/moc_qserialport.cpp:15:2: error: #error "cannot be used with the include files from this version of Qt."
    /home/julian/Downloads/qt-qtserialport/src/serialport/moc_qserialport.cpp:16:2: error: #error "(The moc has changed too much.)"
    make[2]: *** [qserialport.o] Error 1
    make[2]: Leaving directory /opt/qt/bin/src/serialport' make[1]: *** [sub-serialport-make_default] Error 2 make[1]: Leaving directory/opt/qt/bin/src'
    make: *** [sub-src-make_default-ordered] Error 2

    I think I'm still missing sth but can't figure exactly what....

    Thanks.



  • Are you sure from install qt 4.8 ?
    Because the error still exist "QElapsedTimer"

    @
    qserialport_unix.cpp:58:34: error: QtCore/qelapsedtimer.h: No such file or directory
    qserialport_unix.cpp: In member function ‘bool QSerialPortPrivate::waitForReadyRead(int)’:
    qserialport_unix.cpp:427: error: ‘QElapsedTimer’ was not declared in this scope
    @

    By enter follow command you should see what's your qt version

    @
    /opt/qt/bin/qmake -v && /opt/qt/bin/moc -v
    @



  • Here's the result :

    QMake version 2.01a
    Using Qt version 4.8.2 in /opt/qt/lib



  • first of all check qt doc link "check qt doc link...":http://qt-project.org/wiki/QtSerialPort and re-extract to get a clean dir of QtSerialPort
    because what I see here from your log
    looks like duplicated qmake or you moc version isn't the same as qmake
    @
    /home/julian/Downloads/qt-qtserialport/src/serialport/moc_qserialport.cpp:14:2: error: #error “This file was generated using the moc from 4.6.3. It”
    /home/julian/Downloads/qt-qtserialport/src/serialport/moc_qserialport.cpp:15:2: error: #error “cannot be used with the include files from this version of Qt.”
    /home/julian/Downloads/qt-qtserialport/src/serialport/moc_qserialport.cpp:16:2:
    @
    check your moc version
    @
    /opt/qt/bin/moc -v
    @
    Also your qtopia using old qt flags
    @
    WARNING: /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/share/qtopia/mkspecs/common/g++.conf:44: Variable QMAKE_RPATH is deprecated; use QMAKE_LFLAGS_RPATH instead.
    WARNING: /usr/local/angstrom/arm/arm-angstrom-linux-
    @



  • Qt Meta Object Compiler version 63 (Qt 4.8.2)

    Would it help if I uninstall qt4-emebedded ?

    I think it has worked this time.
    So I downloaded qt-qtserialport once more and extracted it.
    Then :
    @cd ~/Downloads/qt-qtserialport
    /opt/qt/bin/qmake ~/Downloads/qt-qtserialport/qtserialport.pro
    make
    sudo make install
    @
    and it finished without errors. I'm gonna check how it's going in QTCreator.



  • Ok, last step would be having it in QtCreator obviously.

    When I add :
    #include <QtSerialPort/QSerialPort>
    #include <QtSerialPort/QSerialInfo>
    and try to build, it says :
    No such file or directory.
    Another parameter to configure ?



  • Because you forget to add
    @
    CONFIG += serialport
    @
    in your .pro file

    Note: CONFIG += serialport must be the first or second line in your .pro file.



  • Would it help if I uninstall qt4-emebedded ?
    I don't think so , If you upgraded your qt version to 4.8 so your qt4-emebedded gonna upgraded too

    [quote author="Tilapia21" date="1391776804"]
    I think it has worked this time.
    So I downloaded qt-qtserialport once more and extracted it.
    Then :
    @cd ~/Downloads/qt-qtserialport
    /opt/qt/bin/qmake ~/Downloads/qt-qtserialport/qtserialport.pro
    make
    sudo make install
    @
    and it finished without errors. I'm gonna check how it's going in QTCreator.[/quote]

    Here was my guess you used qmake version 4.6.3 then after you upgrade
    you used qmake version 4.8.2 without clean the old moc files and MakeFile

    so I think everything gonna work fine with you this time



  • Sorry, I forgot to mention I had done it too.

    @QT += core gui
    CONFIG += serialport
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = QTTest2
    target.files = QTTest2
    target.path = /home/root

    INSTALLS += target
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui@



  • Well in that case qt creator has different qmake
    since you had been upgraded your qt you have to add a new qt kit
    for /opt/qt/bin/qmake and make it a default qt for your project



  • You're right it had gone back to qt 4.6.3 qmake.
    All errors have disappeared.
    I'm gonne make a small test program and mark this subject as solved if everything goes fine.

    Thank you for your help ! Great community !
    Special thanks to you seiko !



  • Ok, just a last problem then I think I'll be ready to fly on my own.

    I compiled the "terminal" example and it was displayed on the beaglebone screen. But I wanted to change the mainWindow resolution cause the example was really small and I should have made sth wrong cause now I get this error :

    16:06:32: Running steps for project terminal...
    16:06:32: Configuration unchanged, skipping qmake step.
    16:06:32: Starting: "/usr/bin/make"
    arm-angstrom-linux-gnueabi-g++ -Wl,-rpath-link,/opt/qt/lib -o terminal main.o mainwindow.o settingsdialog.o console.o moc_mainwindow.o moc_settingsdialog.o moc_console.o qrc_terminal.o -L/home/julian/Downloads/qt-qtserialport/src/serialport -L/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi//usr/lib -lglib-2.0 -lQtSerialPort -lQtGui -lQtCore -lpthread
    /usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: cannot find -lQtGui
    collect2: ld returned 1 exit status
    make: *** [terminal] Error 1
    16:06:32: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project terminal (kit: BeagleboneKit)
    When executing step 'Make'
    16:06:32: Elapsed time: 00:00.



  • @
    /usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: cannot find -lQtGui
    collect2: ld returned 1 exit status
    @
    the linker can't find QtGui because in follow directory you should have
    QT library and I don't why qt qmake didn't even provide the path of lib maybe you should recall qmake
    @
    /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib
    @


Log in to reply
 

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