Important: Please read the Qt Code of Conduct -

Simple problem: building QtSerialPort, no qlockfile.h

  • Hi all. I am on Ubuntu 13.10, using QT Creator 2.7.1 (Qt version 5.0.2) to do some development. I want to use serial ports, so I am installing QtSerialPort using the official instructions ( I am up to the step where I have to build the source, and when I try to make, I get a failure because qlockfile.h can't be found:

    @matt@mattdevel:~/serialport-build$ make
    cd src/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/matt/qtserialport/src/ -o Makefile ) && make -f Makefile
    make[1]: Entering directory /home/matt/serialport-build/src' cd serialport/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/matt/qtserialport/src/serialport/ -o Makefile ) && make -f Makefile make[2]: Entering directory/home/matt/serialport-build/src/serialport'
    g++ -c -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O2 -std=c++0x -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQ_USE_APPMENU -DLINK_LIBUDEV -DQT_BUILD_SERIALPORT_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -I/usr/share/qt5/mkspecs/linux-g++-64 -I/home/matt/qtserialport/src/serialport -I/home/matt/qtserialport/src/serialport -I../../include -I../../include/QtSerialPort -I../../include/QtSerialPort/5.2.1 -I../../include/QtSerialPort/5.2.1/QtSerialPort -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/include/qt5/QtCore/5.0.2 -I/usr/include/qt5/QtCore/5.0.2/QtCore -I.moc/release-shared -I. -o .obj/release-shared/qserialport.o /home/matt/qtserialport/src/serialport/qserialport.cpp
    In file included from /home/matt/qtserialport/src/serialport/qserialport.cpp:53:0:
    /home/matt/qtserialport/src/serialport/qserialport_unix_p.h:48:30: fatal error: QtCore/qlockfile.h: No such file or directory
    #include <QtCore/qlockfile.h>
    compilation terminated.
    make[2]: *** [.obj/release-shared/qserialport.o] Error 1
    make[2]: Leaving directory /home/matt/serialport-build/src/serialport' make[1]: *** [sub-serialport-make_first] Error 2 make[1]: Leaving directory/home/matt/serialport-build/src'
    make: *** [sub-src-make_first] Error 2

    What gives? Is my version of QT already outdated? How can I resolve?

    Thank you

  • Moderators

    QSerialPort was updated before being released with Qt 5.1. So right now, you need to either use Qt 5.1 (you don't need to install QtSerialPort, though, it's already there), or Qt 4.x.

  • Thanks for the reply sierdzio. Is it possible to update to Qt 5.1 without updating my version of Qt Creator, or must I uninstall Qt Creator and download a new version of Qt Creator with Qt 5.1?

  • Moderators

    Qt Creator can work with multiple versions of Qt. I don't know how it works with the SDK, since I don't use it, but you can definitely download and install Qt libraries separately.

  • Thanks sierdzio,

    I have uninstalled my old version of Qt Creator that I got from the Ubuntu Software Center and I have downloaded and installed the latest Qt Creator 2.8.1 (Qt 5.1.1) from the qt website. The code still does not compile, and the only error I get is:

    @Unknown module(s) in QT: qserialport@

    This only happens when appending qserialport to the project file:

    @QT += core gui qserialport@

    The kit that I am using displays the Qt version correctly as: Qt 5.1.1 GCC 32bit

    Any ideas?


  • Moderators

    This should work:
    QT += core gui serialport

    No need for that "q" in front of serialport :)

  • Gah that was it! Problem solved. Thank you for your patience!

Log in to reply