Important: Please read the Qt Code of Conduct -

QtSerialPort not building for qt 4.8.5 (Beaglebone Black)

  • Hi All,

    I am trying to get QtSerialPort to build for the Beaglebone Black. I have Qt 4.8.5 built and have the cross-compiler setup with Qt Creator. I can build, deploy and debug a helloworld app from QtCreator.

    My issue now is that I want to use QtSerialPort in this application. I have followed the steps listed in to build within QtCreator, and I get a linking error:

    /home/user/qtprojects/qtserialport/build-qtserialport-BeagleboneBlack-Debug/src/serialport/ undefined reference to `QSerialPort::dataErrorPolicyChanged(QSerialPort::DataErrorPolicy)'

    A quick find in files shows that dataErrorPolicyChanged is wrapped in a #if QT_DEPRECATED_SINCE(5,2) in the header file. Further searching showed that QT_DEPRECATED_SINCE returns a 1 if the version of Qt is 4.x.

    In qserialport.cpp void QSerialPort::dataErrorPolicyChanged(DataErrorPolicy policy) has been labelled as obsolete, commented out and the body of the function has been deleted.

    So I know what's happening, I'm just not sure how to fix it. Is anyone else using the latest version of the qtserialport source on qt 4.8? Is there any easy workaround for this.


  • FWIW I have the exact same issue on Fedora 20. At a guess, I think moc in Qt 4.8.x doesn't understand the #if and so ignores the code inside of such.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    A fix is on its way, to build it now, remove the deprecation guards around the signal

  • I have the same problem with 4.8.2, I'm building on raspberry pi and windows.
    I removed the depreciation guards around the QSerialPort::dataErrorPolicyChanged(DataErrorPolicy policy). I get a new build error in function tst_QSerialPort::twoStageSynchronousLoopback() with indefined reference to bool Qtest::qCompare<int, long>(int const&, long long const&, char const*, char const*, char const*, int)

    File not found:tst_qserialport.cpp

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    A fix is also on its way for that one

    For the moment, if you don't care about the test itself you can simply comment the code from the offending function.

    replace each

    @QCOMPARE(newlineArray.size(), receiverPort.bytesAvailable());@


    @QCOMPARE(qint64(newlineArray.size()), receiverPort.bytesAvailable());@

  • Lifetime Qt Champion

    Building from the GIT repository 5.3 branch is now working for Qt 4

Log in to reply