M HYPE SPLASH
// news

QMake pointing to wrong directory

By Sarah Scott

I am trying to build cpp project that has is dependent from Qt. I have installed the Qt in the folder opt.

The Qt home directory is: /opt/Qt/5.9.9/gcc_64The qmake executable is located in the directory: /opt/Qt/5.9.9/gcc_64/bin

When I run the command make clean or make install it fails with the error below:

/usr/lib/qt5/bin/qmake -o Makefile cloudscrape.pro
Project ERROR: Unknown module(s) in QT: core gui core-private gui-private platformcompositor_support-private fontdatabase_support-private eventdispatcher_support-private theme_support-private
make: *** [Makefile:245: Makefile] Error 3

When I run the command qmake -v, it shows the following result:

QMake version 3.1
Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu

It is very strange that the path of qmake in error is /usr/lib/qt5/bin/qmake. I have tried to change the qmake directory path implementing the following actions:

  • I have check PATH varible and it points to the correct QT. Below is the value of the PATH:
PATH=/home/rando/.pyenv/shims:/home/rando/.pyenv/bin:/home/rando/.nvm/versions/node/v9.6.1/bin:/home/rando/.sdkman/candidates/maven/current/bin:/home/rando/.sdkman/candidates/java/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/Qt/5.9.9/gcc_64/bin
  • Modified the qtchooser configuration file, after this qmake points to right directory , I confirmed by running the command below:
QMake version 3.1
Using Qt version 5.9.9 in /opt/Qt/5.9.9/gcc_64/lib

But still the problem persists, because when I run make clean or make install the it is using the wrong directory:

/usr/lib/qt5/bin/qmake -o Makefile cloudscrape.pro
Project ERROR: Unknown module(s) in QT: core gui core-private gui-private platformcompositor_support-private fontdatabase_support-private eventdispatcher_support-private theme_support-private
make: *** [Makefile:245: Makefile] Error 3

1 Answer

I was able to fix this issues by restarting the machine. I think the problem was with cached configuration and starting a new session helped clear.

  • Modify the qtchooser configuration file
    • find the configuration file with command : locate qtchooser | grep conf
    • modify with your favorite editor: sudo gedit ${path}/qtchooser/qt5.conf like below:
/opt/Qt/5.9.9/gcc_64/lib
/opt/Qt/5.9.9/gcc_64
  • Start a new session

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy