I have both qt4 and qt5 on my Linux system. qt4 is used by default. What is a clean way to change that so that qmake uses qmake-qt5 by default?
The system might have different meta packages that handle the default.
For example on Debian there is a qt4-default and a qt5-default package, installing one of them will uninstall the other and set the symlinks appropriately
Step 0: Install qtchooser in your system.
$sudo apt-get install qtchooser
Step 1: locate your qtchooser configure file in your system.
$ locate qtchooser | grep conf
/usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
/usr/lib/x86_64-linux-gnu/qtchooser/4.conf
/usr/lib/x86_64-linux-gnu/qtchooser/5.conf
/usr/lib/x86_64-linux-gnu/qtchooser/qt4.conf
/usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf
The command result may be different from yours. Those x.conf files represent all of qt versions qtchooser could recognized in your system. Each x.conf file is a symbolic link to a file configured the qt you have installed. Modifying the default.conf could configure the default qt version you expected.
Step 2: Find out the file location the symbolic link file default.conf linked to.
$ls -l /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
lrwxrwxrwx 1 root root 53 x xx xxx /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf -> ../../../../share/qtchooser/qt4-x86_64-lnux-gnu.conf
Step 3: Create your qt version conf file
The result of step 2 shows the location of all qt version conf file: /usr/share/qtchooser. You just create a conf file specified your qt version in this path. For example, my qt is installed at /opt/Qt5.13.1/ and I want to set this qt version as the default one in my system. We could create a file named like qt5.13.1.conf.
$cd /usr/share/qtchooser
$sudo vi qt5.13.1.conf
and fill in the following two lines: first line means the qmake location and another represents the library path.
/opt/Qt5.13.1/5.13.1/gcc_64/bin
/opt/Qt5.13.1/5.13.1/gcc_64/lib
Step 4: Set your qt as the default one.
Just modify the default.conf symbolic link to your qt conf file created at step 3.
$cd /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/
$sudo ln -snf ../../../../share/qtchooser/qt5.13.1.conf default.conf
After complete those steps, the default qt has been configured and you can type following command to test and it should be your qt as the default.
$qmake -v
There is a tool named qtchooser to switch between Qt versions. On Debian and Ubuntu you can install it with apt-get install qtchooser.
Easiest way is to use it to list the alternatives and then create QT_SELECT environment variable.
$ qtchooser -list-versions
4
5
default
opt-qt55
qt4-i386-linux-gnu
qt4
qt5-i386-linux-gnu
qt5
Then you create QT_SELECT environment variable and set e.g. export QT_SELECT=4 or export QT_SELECT=5.
Related
I am currently using Ubuntu 14.04 LTS.
How can I statically build Qt 4.8.5 -
https://download.qt.io/archive/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
such that when I cmake OpenCV 2.4.13 -
https://github.com/opencv/opencv/archive/2.4.13.zip
it correctly identifies the location of Qt4 ?
When I cmake OpenCV after I have installed Qt4 in /usr/local/qt4-static/, the find_package(Qt4 REQUIRED QtCore QtGui QtTest) function call within opencv-2.4.13/cmake/OpenCVFindLibsGUI.cmake fails because it cannot find qmake. Also, upon running the qmake -query in the terminal, Ubuntu says that qmake is not installed, when it clearly in /usr/local/qt4-static/.
How should I go about this so OpenCV cmake correctly recognizes Qt4 ?
Build Qt
Extract the source-code and run ./configure && make and then sudo make install. It should create all necessary configuration to run qmake in any folder (system-wide).
Additional: create a symlink/export (use only if make install did not work for you)
You need to promote qmake to $PATH or create a symlink, but this is usually done when you run sudo make install after make in the Qt source-folder.
root:/home# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
Symlink (permanently)
ln -s /path/to/qmake /usr/sbin/qmake
or
export (temporary)
export PATH=$PATH:/folder/of/qmake
Afterwards qmake -v is working whereever you are
root:/tmp qmake -v
QMake version 3.1
Using Qt version 5.10.1 in /usr/local/Qt-5.10.1/lib
If your project still cannot determine the location of Qt, read the pro/pri/cmake file to understand how it looks for the path.
I tried to build the AllJoynChat sample and got the following error message:
ld: warning: directory not found for option '-L/build/Debug-iphoneos'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am using Xcode 7.2 and iOS 9.2 SDK. Any help?
It seems like your the build cannot find openssl library.
The following steps need to be followed exactly as below:
Unzip the AllJoyn SDK package to a folder on your development system.
Download and copy the OpenSSL source into a separate folder on your development system, not under the AllJoyn SDK.
Navigate to the OpenSSL source top folder in Finder, and copy the openssl.xcodeproj folder you downloaded from GitHub into this folder.
Open the openssl.xcodeproj in Xcode.
In Xcode, build the crypto target (libssl.a and libcrypto.a) for each
combination of configuration (debug|release) and platform (iphoneos|iphonesimulator) that you need for your iOS project by selecting Product->Build For->(your desired configuration).
Create a new folder called "build" under the top-level OpenSSL folder created in step 1.
Locate your OpenSSL build products folders (i.e.: Debug-iphoneos) in the
/Users//Library/Developer/Xcode/DerivedData/XXXXXXXXXXXXX-openssl/Build/Products folder, and copy all the - folders, like Debug-iphoneos, to the build
folder created in step 6.
You should now have a folder structure similar to this containing libssl and libcrypto
for each $(CONFIGURATION)-$(PLATFORM_NAME) you built in step 5:
openssl-1.0.1c
build
Debug-iphoneos
libssl.a
libcrypto.a
Debug-iphonesimulator
libssl.a
libcrypto.a
Define an environment variable OPENSSL_ROOT=
This environment variable needs to be present whenever you build projects using the AllJoyn SDK.
9a. For Mac OS X 10.7 to 10.9, to set the environment variable, open a Terminal window and type the
following:
launchctl setenv OPENSSL_ROOT <path to top level folder containing openssl>
Restart XCode.
9b. With Mac OS X 10.10, environment variable processing changed. Most importantly, OPENSSL_ROOT
must be defined before launching Xcode (Xcode will not pick up new or changed variables
after launching). Therefore, to set the environment variable, open a Terminal window and type
the following:
launchctl setenv OPENSSL_ROOT <path to top level folder containing openssl>
sudo killall Finder
sudo killall Dock
Restart XCode.
If you have already done the above check step 9 since the step differs for different version of OS X and you may be on the latest version for which the instructions have not been updated yet.
My machine use Ubuntu OS.
I built Qt 5.5.1 manually against static linking. Configuring the built, specified a path to install to:
$ ./configure -static -prefix /home/myname/qt_src/installed/
Then I moved the built stuff to another Ubuntu machine and tried call qmake from a shell:
$ qmake CONFIG+=release CONFIG-=debug /home/othername/project/q_panorama.pro -r -spec linux-g++
But I stucked with error
Could not find qmake configuration file linux-g++
Trying to fix it, I discovered that qmake's QTDIR (is it?) is incorrect:
$ qmake -v
QMake version 3.0
Using Qt version 5.5.1 in /home/myname/qt_src/installed/
Okay. Try to change special var with qmake -set option (here consider only one of vars - QT_INSTALL_PREFIX, - for simplicity). First, check it's consistency:
$ qmake -query QT_INSTALL_PREFIX
/home/myname/qt_src/installed/
Perform:
$ qmake -set QT_INSTALL_PREFIX "/home/othername/qt_static/"
Check again:
$ qmake -query QT_INSTALL_PREFIX
/home/myname/qt_src/installed/
Why the variable does not modify?
How can I make Manually Built static version of Qt work? Please, help.
Did not find the way to resolve the issue, and thus decided to act with brute force:
Created a user othername in my machine;
Run full build cycle for the path desired (under the user created).
Copied the built stuff to the target machine
PROFIT.
I'm trying to build Qwt to a custom location. The obvious thing to try is a PREFIX option, but it had no effect and the make install still failed:
$ qmake qwt.pro PREFIX='/my/path'
$ make
$ make install
mkdir: cannot create directory `/usr/local/qwt-5.2.3': Permission denied
There seem to be numerous other questions and answers to this question, which also have no effect and fail:
How to change qmake PREFIX location: qmake -set prefix '/my/path'
How can the install path be set for a qt project: make; INSTALL_ROOT=/my/path; make install
Any other suggestions?
QMake version 2.01a
Using Qt version 4.5.3 in /opt/Qt4/4.5.2/qtsdk-2009.04/qt/lib
RHEL 5.10
Try to edit the qwtconfig.pri file in the source directory, it has the installation path hardcoded for different platforms, as well as many other options you might want to change.
qmake: could not find a Qt installation of ''
This thread was not of any help to me. qmake: could not find a Qt installation of ''.
How can I get qmake to recognize where the Qt folder is?
Right now it is installed in /opt/Qt5.1.0.
Have you installed the qt5-default ? You need to do this in addition to running the Qt supplier .run file.
sudo apt-get install qt5-default
This message shown by qtchooser app.
To setup it properly, you should make conf files in /etc/xdg/qtchooser/
for example:
$ ls -1 /etc/xdg/qtchooser/
default.conf
qt-4.8.5.conf
qt-5.1.0.conf
each file has two lines: path to bin, path to lib:
$ cat /etc/xdg/qtchooser/default.conf
/opt/Qt/4.8.5/bin
/opt/Qt/4.8.5/lib
additional info: man qtchooser
The solution for me on this problem was to specify the QT version, as this message was being generated by /usr/bin/qtchooser
So in my case, it was QT4 I was trying to use, and running:
qmake
generated the error (could not find a Qt installation of '')
qmake -qt=qt4
fixed that error though. In my case, it was a Ruby Gem trying to compile with qmake, so I couldn't get it to pass in that extra command line argument, so I instead added this to my profile
export QT_SELECT=qt4
And now QT4 runs just fine on my Ubuntu system.
For me the symlink to default.conf was missing in /usr/share/qtchooser. It wasn't enough to put it into /etc/xdg/qtchooser.