[Interest] [OS X/MacPorts] parallel qt4 and qt5 installs

Thiago Macieira thiago.macieira at intel.com
Fri Nov 14 18:14:47 CET 2014


On Friday 14 November 2014 16:52:09 René J.V. Bertin wrote:
> Hi,
> 
> My main work environment is under OS X, based on MacPorts. It is currently
> not possible with that framework to have Qt4 and Qt5 installed in parallel;
> it's one or the other, installed into ${prefix} (usually /opt/local).
> 
> I don't know why the Qt4/5 port maintainer didn't set things up from the
> get-go to allow parallel installations, so I'd like to make a start with
> enabling that, at least for Qt4 and probably "simply" using qtchooser as is
> also done under Linux.

In framework builds of OS X, Qt 4 and Qt 5 are not co-installable, since they 
claim the same names like QtCore.framework. We decided early on in the Qt 5.0 
cycle that we wouldn't fix this, as most of OS X development had moved on to 
having separate project roots for everything and applications bundled the 
frameworks they needed.

Therefore, you need to install them in separate prefixes.

> I haven't found a lot of information about qtchooser, so I'm hoping I can
> get some advice on here on how best to proceed. If in anyway possible, I'd
> like to do this in a way that doesn't force me to rebuild all my Qt4 (and
> KDE4) applications at once. I suppose that would oblige me to put symlinks
> from the current shared libraries' install locations in ${prefix} to
> wherever I decide to put the new version - can that be automated? I also
> presume that one cannot have that kind of symlinks for both Qt4 and Qt5, or
> can the library files actually live together in the same directory
> (regardless of whether they're frameworks or ".dylibs")?

qtchooser will help you. Your $PATH should contain only qtchooser, like so:

$ ls -l =qmake =moc =designer
lrwxrwxrwx 1 thiago users 9 Mai  1  2014 /home/thiago/bin/designer -> 
qtchooser
lrwxrwxrwx 1 thiago users 9 Mai  1  2014 /home/thiago/bin/moc -> qtchooser
lrwxrwxrwx 1 thiago users 9 Mai  1  2014 /home/thiago/bin/qmake -> qtchooser

But it does not help for the libraries. It will only help the executables. 
Then qmake takes over and uses the right paths to the libraries when linking.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list