qt version problem

Hi,

I need to use qt5, in my system:

viniciusbr@linux-wu6s:~> qmake --version
QMake version 2.01a
Using Qt version 4.8.6 in /usr/lib64

But I have the qt5 installed. So, I tried to update the alternatives, but there is something wrong:

viniciusbr@linux-wu6s:~> sudo update-alternatives --install "/usr/bin/qmake" "qmake" "/usr/bin/qmake-qt5" 60
root's password:
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/qmake-qt5 because link group qmake is broken
update-alternatives: warning: not replacing /usr/bin/qmake with a link

What can I do?

qmake is not handled by update-alternatives.

What can I do?

Run “qmake-qt5” instead, if you want to use Qt5.
Or add the result of the command “qtpaths --binaries-dir” to the path, before /usr/bin/.

Alternatively, you could also create a symlink called “qmake” (that points to /usr/bin/qmake-qt5 or $(qtpaths --binaries-dir)/qmake) in /usr/local/bin/ (or ~/bin), if you want to override qmake in general.

Hi!

So:

viniciusbr@linux-wu6s:~> qtpaths --binaries-dir
/usr/lib64/qt5/bin

Then:

sudo update-alternatives --install "/usr/bin/qmake" "qmake" "/usr/lib64/qt5/bin/make-qt5" 60

Is it?

I did it:

sudo update-alternatives --install /usr/lib64/qt5/bin/qmake-qt5 qmake-qt5 /usr/bin/qmake-qt5 60

But I think that is wrong once:

viniciusbr@linux-wu6s:~> sudo update-alternatives --config qmake
There are 2 choices for the alternative qmake (providing /usr/lib64/qt5/bin/qmake).


  Selection    Path                          Priority   Status
------------------------------------------------------------
* 0            /usr/lib64/qt5/bin/qmake-qt5   60        auto mode
  1            /usr/bin/qmake-qt5             60        manual mode
  2            /usr/lib64/qt5/bin/qmake-qt5   60        manual mode


Press <enter> to keep the current choice
[li], or type selection number: 2[/li]viniciusbr@linux-wu6s:~> qmake --version
QMake version 2.01a
Using Qt version 4.8.6 in /usr/lib64



No.
Again, qmake is not managed by update-alternatives.

/usr/bin/qmake is the Qt4 version, and you cannot change that. (well, you can, but updates will revert your change)

Also, /usr/lib64/qt5/bin/ contains both “qmake” and “qmake-qt5” (the latter points to the former). The symlink in /usr/bin/ has been renamed to not conflict with Qt4.

Again, if you want to refer to the Qt5 version as “qmake” (instead of “qmake-qt5”), you’d need to add /usr/lib64/qt5/bin/ to the path (before /usr/bin/, so that the qmake from there will be preferred), or add a symlink to /usr/local/bin/ or ~/bin/ (both are preferred over /usr/bin/ by default).

E.g.:

export PATH="/usr/lib64/qt5/bin/:$PATH"

or

sudo ln -s /usr/bin/qmake-qt5 /usr/local/bin/qmake

or

sudo ln -s /usr/lib64/qt5/bin/qmake /usr/local/bin/

Or just run qmake-qt5 instead of qmake.

Yeah, you created your own qmake-qt5 now, managed by update-alternatives.
But that won’t change /usr/bin/qmake…
(and that change will also be reverted by updates)

Yah, but didn’t work. Because when I tried to run the application:

viniciusbr@linux-wu6s:~/Downloads/RANA> make
g++ -c -pipe -Wextra -Wno-unused-variable -Wno-unused-parameter -O2 -o3 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I/home/viniciusbr/Downloads/RANA/../lua51_64bit/include -I/usr/include/luajit-5_1-2.0 -I. -I. -o main.o main.cpp
In file included from mainwindow.h:35:0,
                 from main.cpp:26:
control.h:27:42: fatal error: QtConcurrent/qtconcurrentrun.h: Arquivo ou diretório não encontrado
 #include <QtConcurrent/qtconcurrentrun.h>
                                          ^
compilation terminated.
Makefile:444: recipe for target 'main.o' failed
make: *** [main.o] Error 1

PS, it would of course also work to create a shell alias:

alias qmake=qmake-qt5

Then the shell would actually run qmake-qt5 if you enter qmake.
:wink:

You may also have to restart the shell, it may have cached the qmake lookup result to use /usr/bin/qmake instead of the new /usr/local/bin/qmake.

Oh, and if you already tried to build using qmake (Qt4), you have to clean out the build folder first (and rerun qmake) before you try again.
Just running make will use the already generated Makefiles that refer to Qt4…

Hi,

thank you, but still doesn’t work.

viniciusbr@linux-wu6s:~> alias qmake=qmake-qt5
viniciusbr@linux-wu6s:~> cd Downloads/RANA/
viniciusbr@linux-wu6s:~/Downloads/RANA> make
g++ -c -pipe -Wextra -Wno-unused-variable -Wno-unused-parameter -O2 -o3 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I/home/viniciusbr/Downloads/RANA/../lua51_64bit/include -I/usr/include/luajit-5_1-2.0 -I. -I. -o main.o main.cpp
In file included from mainwindow.h:35:0,
                 from main.cpp:26:
control.h:27:42: fatal error: QtConcurrent/qtconcurrentrun.h: Arquivo ou diretório não encontrado
 #include <QtConcurrent/qtconcurrentrun.h>
                                          ^
compilation terminated.
Makefile:444: recipe for target 'main.o' failed
make: *** [main.o] Error 1

Hi,

thank you, but didn’t work:


viniciusbr@linux-wu6s:~> alias qmake=qmake-qt5
viniciusbr@linux-wu6s:~> cd Downloads/RANA/
viniciusbr@linux-wu6s:~/Downloads/RANA> make
g++ -c -pipe -Wextra -Wno-unused-variable -Wno-unused-parameter -O2 -o3 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I/home/viniciusbr/Downloads/RANA/../lua51_64bit/include -I/usr/include/luajit-5_1-2.0 -I. -I. -o main.o main.cpp
In file included from mainwindow.h:35:0,
                 from main.cpp:26:
control.h:27:42: fatal error: QtConcurrent/qtconcurrentrun.h: Arquivo ou diretório não encontrado
 #include <QtConcurrent/qtconcurrentrun.h>
                                          ^
compilation terminated.
Makefile:444: recipe for target 'main.o' failed
make: *** [main.o] Error 1

Again, you need to run qmake(-qt5) before make to regenerate the Makefiles.

alias (or the other things I mentioned) just “replaces” qmake with qmake-qt5, it doesn’t run it nor modifies the source/build files of the project you want to compile.

I see! Ok, now this:


viniciusbr@linux-wu6s:~/Downloads/RANA> qmake-qt5
viniciusbr@linux-wu6s:~/Downloads/RANA> make
g++ -c -pipe -Wextra -Wno-unused-variable -Wno-unused-parameter -O2 -o3 -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/viniciusbr/Downloads/RANA/../lua51_64bit/include -isystem /usr/include/luajit-5_1-2.0 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib64/qt5/mkspecs/linux-g++ -o main.o main.cpp
g++ -c -pipe -Wextra -Wno-unused-variable -Wno-unused-parameter -O2 -o3 -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/viniciusbr/Downloads/RANA/../lua51_64bit/include -isystem /usr/include/luajit-5_1-2.0 -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib64/qt5/mkspecs/linux-g++ -o mainwindow.o mainwindow.cpp
In file included from /usr/include/QtGui/qtextbrowser.h:45:0,
                 from /usr/include/QtGui/QTextBrowser:1,
                 from ui_mainwindow.h:37,
                 from mainwindow.cpp:35:
/usr/include/QtGui/qtextedit.h:235:16: error: ‘QPrinter’ has not been declared
     void print(QPrinter *printer) const;
                ^~~~~~~~
In file included from mainwindow.cpp:35:0:
ui_mainwindow.h: In member function ‘void Ui_MainWindow::setupUi(QMainWindow*)’:
ui_mainwindow.h:402:25: error: ‘class QSpinBox’ has no member named ‘setDisplayIntegerBase’
         timeResSpinBox->setDisplayIntegerBase(10);
                         ^~~~~~~~~~~~~~~~~~~~~
ui_mainwindow.h:1030:30: error: ‘class QGraphicsView’ has no member named ‘setSizeAdjustPolicy’; did you mean ‘setSizePolicy’?
         vis_mapGraphicsView->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
                              ^~~~~~~~~~~~~~~~~~~
ui_mainwindow.h:1030:50: error: ‘AdjustToContents’ is not a member of ‘QAbstractScrollArea’
         vis_mapGraphicsView->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
                                                  ^~~~~~~~~~~~~~~~~~~
ui_mainwindow.h: In member function ‘void Ui_MainWindow::retranslateUi(QMainWindow*)’:
ui_mainwindow.h:1129:85: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ow->setWindowTitle(QApplication::translate("MainWindow", "RANA", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1130:80: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ion_Open->setText(QApplication::translate("MainWindow", "&Open", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1131:80: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ion_Exit->setText(QApplication::translate("MainWindow", "&Exit", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1132:81: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 on_Info->setText(QApplication::translate("MainWindow", "&About", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1133:115: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 Application::translate("MainWindow", "&Toggle Event Processing", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
In file included from mainwindow.cpp:35:0:
ui_mainwindow.h:1134:109: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 xt(QApplication::translate("MainWindow", "&Save Current Events", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1135:127: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ion::translate("MainWindow", "&Disable Simulation Debug Output", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1137:96: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ip(QApplication::translate("MainWindow", "Start the simulation", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1139:76: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
  runButton->setText(QApplication::translate("MainWindow", "Run", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1140:76: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
  label_8->setText(QApplication::translate("MainWindow", "Time:", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1141:75: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
   label_10->setText(QApplication::translate("MainWindow", "[s]", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1142:78: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 abel_status1->setText(QApplication::translate("MainWindow", "0", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1144:121: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 nslate("MainWindow", "Initialize the simulation and the agents", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1146:88: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ton->setText(QApplication::translate("MainWindow", "Initialize", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1147:83: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 teButton->setShortcut(QApplication::translate("MainWindow", "I", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1148:77: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 label_9->setText(QApplication::translate("MainWindow", "Delay:", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1150:114: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ::translate("MainWindow", "Delay between steps in milliseconds", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1152:83: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 >setText(QApplication::translate("MainWindow", "<b>Agent Path:", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1153:78: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 abel_status3->setText(QApplication::translate("MainWindow", "0", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1154:88: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 etText(QApplication::translate("MainWindow", "External Events:", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1155:82: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 _3->setText(QApplication::translate("MainWindow", "References:", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1156:78: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 abel_status4->setText(QApplication::translate("MainWindow", "0", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1158:117: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ::translate("MainWindow", "Load up an existing bitmap as a map", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1160:85: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 pButton->setText(QApplication::translate("MainWindow", "Browse", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1162:139: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ", "The precision with which events are distributed in seconds", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1165:83: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 sSpinBox->setPrefix(QApplication::translate("MainWindow", "1e-", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1167:112: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 pplication::translate("MainWindow", "Load up an agent behavior", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1169:90: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 tButton->setText(QApplication::translate("MainWindow", "Browse", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1171:78: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 abel_39->setText(QApplication::translate("MainWindow", "Width:", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1172:79: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 bel_11->setText(QApplication::translate("MainWindow", "Height:", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1174:137: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 MainWindow", "Generate an empty (black) map with height,width.", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1176:97: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 on->setText(QApplication::translate("MainWindow", "GenerateMap", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1177:161: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 style=\" font-weight:600;\">Load Map:</span></p></body></html>", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1178:91: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 xt(QApplication::translate("MainWindow", "<b>Number of Agents:", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1180:243: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 s collision detection and map manipulation).</p></body></html>", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
In file included from mainwindow.cpp:35:0:
ui_mainwindow.h:1182:166: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 e=\" font-weight:600;\">Generate Map:</span></p></body></html>", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1183:172: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ont-weight:600;\">Simulation Threads:</span></p></body></html>", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1184:86: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 n->setText(QApplication::translate("MainWindow", "Clear Output", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1186:180: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
  threads to utilize for the next simulation.</p></body></html>", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1189:148: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 /><body><p>How many meters each pixel covers</p></body></html>", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1191:163: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 tyle=\" font-weight:600;\">Map Scale:</span></p></body></html>", 0, QApplication::UnicodeUTF8));
                                                                     ^~~~~~~~~~~~
ui_mainwindow.h:1193:104: error: ‘UnicodeUTF8’ is not a member of ‘QApplication’
 ation::translate("MainWindow", "Number of microsteps pr second", 0, QApplication::UnicodeUTF8));
Makefile:730: recipe for target 'mainwindow.o' failed
make: *** [mainwindow.o] Error 1
viniciusbr@linux-wu6s:~/Downloads/RANA> 



Well, it still uses Qt4 includes.
Either you don’t have the corresponding Qt5 devel packages installed (libQt5Gui-devel and libQt5Widgets-devel in this case) or there’s a “bug” in the application you want to compile.

What are you trying to build, btw?

The Qt5 devel packages are in the system.

I’m trying to install this: https://github.com/sojoe02/RANA

Hm.
Maybe it would help to run “make clean”, and then “qmake” and “make” again?

I’m trying to install this: https://github.com/sojoe02/RANA

Well, I don’t even get that far, qmake-qt5 tells me “Project ERROR: lua51 development package not found” not found, even though I do have lua51-devel installed…
I’m not sure what’s missing at the moment.

Ah, I replaced “lua51” with “lua” in the Rana_qt.pro file and qmake-qt5 worked.
But now I get:

In file included from main.cpp:30:0:

api/gridmovement.h:28:24: fatal error: shared_mutex: No such file or directory
 #include <shared_mutex>
                        ^
compilation terminated.

Hm…

Hi!

But we are progressing!

After clean, qmake and make:

cc1plus: error: output filename specified twice
Makefile:506: recipe for target 'moc_predefs.h' failed
make: *** [moc_predefs.h] Error 1

Ok, seems that would require gcc 4.9 or higher.
I have no intentions to install that now though, sorry.