I have currently got the 64-bit version of Qt5 installed on a 64-bit Ubuntu machine but I'd also like to be able to do 32-bit builds on the same machine. On Windows I can simply select additional kits in the MaintenanceTool but on Linux this doesn't seem to be possible. Or am I missing something?
Three steps:
Get the 32 bit version from Qt or build from source with ./configure -platform linux-g++-32.
Make sure it gets installed to a different path than the 64-bit version. Can be achieved with something like ./configure -platform linux-g++-32 -prefix /opt/qt32 or the path that feels comfortable to you.
Fix compiler settings along these lines for building the application
Related
I have a project which relies on /opt/qt59/bin/qt59-env.sh which sets up QT environment. Without it, qmake complains:
Project ERROR: Unknown module(s) in QT: quick quickwidgets
It's not on my system (Ubuntu 17.10). I have QT 5.9 installed through qt5-default. I have been looking around but can't find. I've tried packages qtscript5-dev but qt59-env.sh did not appear.
What should I install to get it? Or what's an alternative to set up the environment?
Ubuntu's default packages don't include this kind of script.
qt59-env.sh comes from qt59base, that is from this ppa.
The ppa is for Ubuntu xenial (16.04), but it could also work on 17.10.
Otherwise you can just download qt59-env.sh from here and modify the paths to your installed Qt version.
As per my information, Binaries (or offline/online installers) for installing Qt (>= 5.6) on 32-bit linux are not provided. For example, If I want to use Qt 5.9.0 on 32-bit linux (debian, specifically), the only option is to download Qt source and build it. I have successfully built Qt 5.9.0 on my 32-bit linux machine. But I have to do this on all my development PC's. Instead if I can build it once and create an installer somehow, that will save a lot of time. Is there a way to create offline installer (e.g. *.run files) for installing Qt 5.9.0 on 32-bit Linux (e.g. debian)?
As stated by #Velkan, Qt is available on 32 bit Debian from the official repos.
But, indeed, there is no 32-bit Linux installer from the Qt project.
Regarding copying a Qt install from a Debian PC to another, you do not need to create an installer. Just copy/tar/zip the directory in which Qt is installed. The only requirement is that you must keep the installation in the same absolute path as the Qt Core library has the path hardcoded in it and it is use for plugin detection.
NB1: It is possible to patch Qt Core library to change the hardcoded path and even make it relative. It is not officially documented but you can take a look in the sources of tools like windeployqt or the online installer
NB2: Do not use Qt 5.9.0, prefer 5.9.2. Both are forward and backward binary compatible, but the latter received bug fixes.
On my Ubuntu 16.04, I have some packages installed (through Synaptic) that have QT version 5.5.1. And they seem to be needed by software that I have (TeXstudio, for instance).
But as a developer I am trying to use Qt 5.9.1, which I installed by downloading it from the QT website (like this). But when I run qmake, it runs the wrong version. How can I choose which version I want to use?
$ qmake --version
QMake version 3.0
Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu
But I want this one:
~/lib/Qt5.9.1/5.9.1/gcc_64/bin/qmake --version
QMake version 3.1
Using Qt version 5.9.1 in /home/diego/lib/Qt5.9.1/5.9.1/gcc_64/lib
I would like that all that when I'm building software or running software I have built (instead of software installed on the system) it uses 5.9.1. How can I do this?
You should run qmake with its full path:
$ ~/lib/Qt5.9.1/5.9.1/gcc_64/bin/qmake
If you don't want to type full path, you could prepend your local Qt directory to PATH environment variable. In order for runtime linker to find right libraries, you can add Qt directory to LD_LIBRARY_PATH. You could set QTDIR too, so tools like CMake find right Qt:
You could put following line in ~/.bashrc:
export QTDIR="~/lib/Qt5.9.1/5.9.1/gcc_64/"
export PATH="$QTDIR/bin:$PATH"
export LD_LIBRARY_PATH="$QTDIR/lib:$LD_LIBRARY_PATH"
I just installed Qt 5.2 package on ubuntu. I simply created a Qt widget application, and when I tried to build it, I got the following message:
Qt Creator needs a compiler set up to build. Configure a compiler in
kit options
I have tried several things, all of which were unsuccessful. I tried setting the compiler kit to
Desktop Qt 5.2.0 GCC 32bit (default)
However it didn't work
After that I set the compiler to
GCC (x86 32bit in use/bin)
However that didn't work either.
I also tried adding gcc manually and gave it the path
/usr/bin/g++-4.6
but it still didn't work.
This is what appears in there Qt Version tab
This is what I get when I remove the .pro.user file and restart the IDE, Whats the difference between configuring a project as Desktop and Desktop Qt 5.2.0 GCC 32bit?
Qt Creator needs a version of tools that are able to link against the Qt binaries that the downloaded package contains. In your case, the local toolchain and the binaries don't match. That means that you would actually have to build the Qt with your toolkit and make sure that QtCreator can find the built binaries.
The simpler way for Ubuntu is to use the packaged version of the tools; they play well with the already delivered binaries. Use sudo apt-get install qtcreator to install it with all the dependencies.
I created a development environment with Fedora 18 and Qt 5
When I compile my app it will be 64 bit, and depend on Qt 5. After some research it seems that will be a problem since Centos 6.x is still dependong on Qt 4.6, and Centos 5.x is dependant on earlier Qt, and I'm guessin Ubuntu has its own package limitations.
Is there a "safe" version of Qt I can compile against to ensure it runs everywhere? If not, how can I expect customers to run my program?
If you want to target Linux, then I would recommend using Qt 4.8 (available on most of the Linux Distros), forget about Qt 5 for a year or so. Hardly any Linux distro other than Ubuntu 13.04 and above comes with Qt 5.
Secondly, as far as compiling is considered, if you wish to target Linux distros other than Ubuntu and Fedora than never use Ubuntu or Fedora for compilation. These are bleeding edge Linux distros which include new libraries without much testing. You will not only face the problem of old Qt versions in some Linux distros as you will face the bigger problem of glibc (C library). Make sure the Linux distro you use for compilation has a minimum possible glibc version for Qt 4.8, otherwise even if any Linux distro has Qt 4.8 installed, but has a lower version of glibc, you app still won't run. You can check out distrowatch.com to find out glibc and Qt versions for any Linux Distro
Example:
I compiled my app on Ubuntu 12.04, Qt 4.8.1 with glibc v 2.16 (perhaps). I got a bug report than application does not run on CrunchBang which also has Qt 4.8.1 available but since it is a Debian unstable Linux Distro it uses glibc v2.13. Since that day I always compile my application on CrunchBang (very lighweight, you can Virtual Box for this) and hardly some one complains now.
As far as CentOs is considered, you will need to recompile your code on CentOS.