Solved Wrong (standard) path is used in makefiles
-
I want to install QT and then compile a project. In order to do so, I download QT, execute configure, build it, use qmake in my project and then compile.
Problem is that the makefile of my project contains a wrong reference to the standard QT path:
INCPATH = -I../../qt-everywhere-opensource-src-4.8.6/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.8.6/include/QtCore (...and some more)
The first path is the correct one, the second path is the standard QT path, which in my case is not valid (and I don't have writing privileges there).
As a result, nothing of the QT library is found.I checked all relevant environment variables (PATH, QTDIR, QMAKESPEC, QTINC, QTLIB, QMAKE_RPATHDIR, QT_PLUGIN_PATH, QT_INSTALL_PREFIX) and they are just fine. Since the invalid directory does not exist, I hadn't expected the wrong path in there anyway.
I also made sure to call qmake directly by full path when creating the makefile. The project file does not contain any QT related paths.Reading the makefile of QT itself, it sounds as if it tries to install something under /usr/local/Trolltech/. Is that the problem? That the QT configure wants to install there but can't due to missing writing privileges?
If so, how to fix this? If not, what else can be the problem here? Any more specific information needed, like my configure parameters?(Not interested in the solution of changing the makefile here, I want qmake to create valid makefiles.)
(The old QT version is on purpose, by the way. Compiling some old code here.) -
What distro ?
Anyway, i had somewhat same issue in Mint and used
qt5-default
and the qtchooserBut you are not saying what is old Qt and what is new :)
4.8 is new ?Not sure qt5-default works with 4.x branch. never tried it.
-
@mrjj Red Hat. The QT is use is version 4.8.6.
-
Hi and welcome to devnet,
Out of curiosity, since you are using a Qt4, why not use your distribution provided Qt for development ?
-
@SGaist I have some working Qt available elsewhere, but my current task is to create a shell script that does a full routine of downloading a project and all it's dependencies, including Qt, and then build it from scratch. This one should work on any Linux distribution (at least that's the idea).
Qt4 is the newest Qt version that builds the project - some of the dependencies got old code that won't work with Qt5.
Before that, I did the same with a batch file in Windows, which works fine right now.(Before anyone asks, yes, I made sure to swap out the Qt download for Linux and to change the configure parameters accordingly.)
-
What parameters did you pass to configure when building Qt yourself ?
-
@SGaist I started with those:
-no-qt3support -no-opengl -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-declarative -nomake demos -nomake examples -nomake docs -nomake translations -debug-and-release -platform linux-g++ -static -qt-libjpeg -no-libtiff -no-openvg -no-gif -no-libpng -no-libmng -no-libjpeg -no-mmx -no-3dnow -no-sse -no-openssl -no-dbus -no-script -no-scripttools -no-declarative-debug
But I also tried without any parameters at all.That said, can't imagine that any parameters will result in an invalid path to be used.
That said, I used Qt as found on
https://download.qt.io/archive/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz
Probably not relevant either, but in case if anyone should want to know.To make sure, I also compiled Qt on a single thread.
-
Can you share the part of your script where you prepare and use Qt ?
-
@SGaist I also did this by hand to make sure that the problem is not based on the script, but here you go:
At the very head:
qtfolder=qt-everywhere-opensource-src-4.8.6 root=${PWD} compilesuffix=""
(compilesuffix contains the options for make and will later be set to " -j")
Somewhat later, to make sure that the environment variables are correct within the script for certain:
export PATH=$root/$qtfolder/bin:$root/$qtfolder:$PATH export QTDIR=$root/$qtfolder export QMAKESPEC=$root/$qtfolder/mkspecs/linux-g++ export QTINC=$root/$qtfolder/include export QTLIB=$root/$qtfolder/lib export RPATH=$root/$qtfolder/lib export QMAKE_RPATHDIR=$root/$qtfolder/lib export QT_PLUGIN_PATH=$root/$qtfolder/plugins export QT_INSTALL_PREFIX=$root/$qtfolder
and finally
handle_qt() { echo "configuring QT" cd $qtfolder dir ./configure -no-qt3support -no-opengl -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-declarative -nomake demos -nomake examples -nomake docs -nomake translations -debug-and-release -platform linux-g++ -static -qt-libjpeg -no-libtiff -no-openvg -no-gif -no-libpng -no-libmng -no-libjpeg -no-mmx -no-3dnow -no-sse -no-openssl -no-dbus -no-script -no-scripttools -no-declarative-debug cd $root echo "configure complete" echo "" echo "compiling QT" echo "" cd $qtfolder $root/$makefolder/make$compilesuffix cd $root echo "compilation complete" echo "" }
Later on, qmake is called like
$root/$qtfolder/bin/qmake
(And again, I also tried this with no configure parameters, same problem.)
-
Solved it on my own, simply used the -prefix configure parameter.