In Linux Mint 17.2 (i.e. Ubuntu 14.04), how to make qt 5.4 as the default qt5 library version of programs?

3.3k Views Asked by At

I install the latest qt version from the official website http://www.qt.io/qt5-4/ successfully. I follow this tutorial http://sysads.co.uk/2014/05/install-qt-5-3-ubuntu-14-04 and install the qt 5.4 version. Besides, I have the Ubuntu repository version of qt 5.2.1 installed.

Now I want to make the default version of 5.4 due to a program can't work well in the old qt5 version. That is to say, when I start a program which need to use qt5 library the program will use the version 5.4 rather than the version qt 5.2. Though I have installed the version 5.4 and 5.2, the program still use qt 5.2 version.

I try to use qtchooser to choose the 5.4 version as the default option, however, the program installed in the system still use the qt 5.2 library. I endeavor to modify the related files regarding qtchooser, nothing changes.

2

There are 2 best solutions below

4
rubenvb On

If the library version is not in some regular repository, I would strongly suggest not relying on the user to install it somehow from an "unofficial" install location. Or provide a package for the library version yourself to install alongside your application. But don't replace the system Qt version. That would be Bad®.

Instead, either compile your program with a specific rpath, or wrap your program in scripts that use something like LD_PRELOAD and/or LD_LIBRARY_PATH to load the library version you're shipping in your application package.

Both ways are clunky, and I would try to at least work around the Qt version bug if at all possible.

1
agold On

The latest Qt version (non-alpha) actually is Qt 5.5.

If you install it through the installer provided by Qt, you should change the default Qt version by editing/creating:

/etc/xdg/qtchooser/default.conf

which should contain first the bin directory, then the lib directory, for example:

/opt/Qt/5.5/gcc_64/bin
/opt/Qt/5.5/gcc_64/lib

At least this works for the qmake version. Otherwise you might need to change LD_LIBRARY_PATH as commented by rubenvb.