Search code examples
qtqmakeqtscriptqt5.4

How do I include the QtScript module in a Qt 5.4 application


Prior to Qt 5.4, I could add the QtScript module to my build by adding

QT += script

to my .pro file. However when I tried to build a project with Qt 5.4, 'script' is flagged as a unknown module by qmake.

I can see the QtScript shared object in my library folder.

I cannot find any reference to this in any Qt 5.4 release notes.


Solution

  • It turns out this problem with this is a defect in the RedHat EPEL repository packaging of Qt 5.4 for RedHat EL 6. The qt5-qtscript package apparently does not register itself with the system, so qmake does not recognize the 'script' keyword (QT += script).

    I solved this problem by installing the 5.4.1 libraries from the Qt website (qt.io). RHEL 6.4 has a problem with the installation of QtCreator from the qt.io online installer, because the gcc is pre-4.7.3 and the QtCreator complains about the libstdc++ version, but apart from QtCreator, the Qt 5.4.1 libraries installed fine.

    So I am using qt-creator from the epel repository, (supported by the Qt 5.4 libs from epel) and building my programs against Qt 5.4.1 libs from qt.io installed in a separate place, (my build Kit uses those libs), and everything works for me now.

    Once I figure out what the qt5-qtscript package is doing wrongly, I will submit a patch to fix that, but it might be a while before I get to that task.