Qmake or make fails to missing libraries (possibly wrong path)
-
Hello Mates! I've recently downloaded the opensource QT for Linux installer from the main website, and installed 5.6 and 5.7. Specifically, for 5.7 I installed the gcc components, Qt Purchasing, QT Webkit Engine, SCXML, Gamepage, and the deprecated QT Script. For 5.6, I installed the Desktop gcc components, Purchasing, WebEngine, SCXML, SerialBus, Gamepage, and Script, plus QT Creator 4.1.0.
I'm trying to follow the "Getting Started Programming with Qt Widgets" Tutorial that came with QT Creator. After following the tutorial, I ran "qmake", only to see
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
Looking online, it appeared I needed to install qt4-qmake from the repos. So I ranapt-get install qt4-qmake
Now qmake seems to finish correctly (at any rate there is not output) but I'm running into the following error with the next step,make
:/usr/lib/x86_64-linux-gnu/qt4/bin/uic notepad.ui -o ui_notepad.h make: /usr/lib/x86_64-linux-gnu/qt4/bin/uic: Command not found Makefile:199: recipe for target 'ui_notepad.h' failed make: *** [ui_notepad.h] Error 127
Looking around online, it appears that some other people with this problem fixed it by installing
qt-sdk
from their distro repositories. I'm really reluctant to do this, though, because it will install a different version of qt-creator and other programmes, and I don't want to introduce conflicts or break anything.So a few questions:
- Is it normal that after installing from the
qt-unified-linux-x64-2.0.3-1-online.run
installer that I would need to install additional packages from the repositories? - Why did I need to install qt4-qmake, when my program is for qt5? I definitely specified that my project was a qt-5.6 Widgets Application when starting out, and qt-4 isn't installed on this machine.
- Is there a certain path to specify when calling make, or am I stuck installing
qt-sdk
? When installing qt, I went with the default installation directory of /opt/Qt.
Distro: LMDE 2 "Betsy" 64-bit
Thanks for any help!
Fred - Is it normal that after installing from the
-
Hello @Fred-Barclay,
After following the tutorial, I ran "qmake", only to see qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
That's just bad configuration, you should be able to fix it easily enough.
Looking online, it appeared I needed to install qt4-qmake from the repos.
No, you need
qt5-qmake
, but that's only if you're going to develop with the Qt distributed along with the Linux distro (5.6 for me). If you had installed your own Qt distribution, like you did, then you need to create a Kit for Qt Creator that points to theqmake
that came with that same Qt distribution.Looking around online, it appears that some other people with this problem fixed it by installing qt-sdk from their distro repositories. I'm really reluctant to do this, though, because it will install a different version of qt-creator and other programmes, and I don't want to introduce conflicts or break anything.
You can't break it. I usually use my Debian-brought Qt package for development.
Is it normal that after installing from the qt-unified-linux-x64-2.0.3-1-online.run installer that I would need to install additional packages from the repositories?
You may need to, yes. Compiler, debugger, the auto-tools package etc.
Why did I need to install qt4-qmake, when my program is for qt5?
You didn't.
Is there a certain path to specify when calling make, or am I stuck installing qt-sdk? When installing qt, I went with the default installation directory of /opt/Qt.
No, what you should do instead is to create a Kit with the
qmake
you got in/opt/Qt
to develop with that version of Qt.Distro: LMDE 2 "Betsy" 64-bit
What Debian distribution is this based on? Jessie (stable)?
Kind regards.
-
@kshegunov Thanks for your reply! Yes, LMDE 2 is based on Debian Jessie.
I found the path for qmake in /opt:/opt/Qt/5.6/gcc_64/bin/qmake
but I can't tell how to make a kit with that. I've read https://doc.qt.io/qtcreator/creator-targets.html but it seems to be more concerned with cmake. Can you walk me through what I should do?Looking at the prexisting, auto-detected kit for 5.6.1, cmake is definitely not detected. Do you know where I should look? I've already checked
/opt/Qt/5.6/gcc_64/bin/
and it isn't there. There are quite a bit of cmake files inside/opt/Qt/5.6/gcc_64/lib/cmake
but I amd not sure which of these (if any) is appropriate to use.As an experiment, I installed cmake from the Debian Jessie repos (and uninstalled qt4-qmake). Qmake does seem to complete successfully, but make is throwing out a different error:
$ /opt/Qt/5.6/gcc_64/bin/qmake $ make g++ -Wl,-O1 -Wl,-rpath,/opt/Qt/5.6/gcc_64/lib -o Notepad main.o notepad.o moc_notepad.o -L/opt/Qt/5.6/gcc_64/lib -lQt5Widgets -L/usr/lib64 -lQt5Gui -lQt5Core -lGL -lpthread /usr/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status Makefile:201: recipe for target 'Notepad' failed make: *** [Notepad] Error 1
Thanks again, and sorry for the newbie-ness! On the rare occasions I've designed a GUI for my code, I always used something in the gtk family so this is quite a new experience for me!
-
Hi,
You don't need CMake at this point. Add a Qt version for/opt/Qt/5.6/gcc_64/bin/qmake
. After that make a kit as described here. If you haven't had compiler and debugger installed, then by all means do that (you needg++
andgdb
, alsoautotools
and I think that should be sufficient).After you've created a kit, either create a project and configure it with that kit, or add the kit to an existing project (and configure the project build paths accordingly).
I think this should get you going.
PS:
/usr/bin/ld: cannot find -lGL
Means you don't have development package for OpenGL. Install one through the package manager (search formesa-dev
,opengl-dev
or something of that sort).
Kind regards. -
Success! Compilation completed without a hitch and I have my first working QT GUI! :-)
Rehash of what I did since your last post:
Created a new kit. (I didn't link it to my project... oops but it looks like it didn't matter).
Installedlibqt5opengl5-dev
Ran/opt/Qt/5.6/gcc_64/bin/qmake
andmake
So for future reference, I need to use the correct path to qmake (setting up a kit manually will do that) and install
libqt5opengl5-dev
.Thank you!
Fred -
@Fred-Barclay said in Qmake or make fails to missing libraries (possibly wrong path):
So for future reference, I need to use the correct path to qmake (setting up a kit manually will do that) and install
libqt5opengl5-dev
.Actually, you don't need
libqt5opengl5-dev
butlibgl1-mesa-dev
. However, the former depends on the latter and will pull it from the repository.Thank you!
You're welcome.