3

I am developing a Qt application that I need to distribute. I need to ensure that the distributed application links at runtime against Qt version 4.8.1, but my application binary always depends on Qt 4, which points to a different version on my machine.

I have installed on my machine both Qt 4.6.2 (default Qt version installed for my Linux distribution) and Qt 4.8.1 (the one I need for my application), both in /usr/lib. The ideal solution I am searching for is specifying somehow in my CMakeLists.txt that I need my binary needs a specific Qt version to work. I tried with

find_package(Qt4 4.8.1 COMPONENTS QtCore QtGui REQUIRED)

but my output for

ldd executableName

is still

libQtOpenGL.so.4 => /usr/lib/libQtOpenGL.so.4

which points to the default (wrong) 4.6.2 Qt version. I would like to get if possible

libQtOpenGL.so.4.8.1 => /usr/lib/libQtOpenGL.so.4.8.1

So my binary can run properly and the default Qt version installed remains untouched.

Thank you.

chorch
  • 163
  • 1
  • 7
  • [similar problem](http://stackoverflow.com/q/11934147/1387438), but without solution :( – Marek R Jan 13 '14 at 10:44
  • I wouldn't install Qt manually to /usr/lib, especially not if you have another distro-managed Qt in there (actually, I'd never install anything manually to /usr/lib). If you want a specified Qt version, install it to a custom path and build against that. – Frank Osterfeld Jan 13 '14 at 13:12
  • I use a different path for building the application, but, what about runtime? Do you suggest to use also a different path and make use of rpath? – chorch Jan 13 '14 at 13:16
  • Yes, rpath is the way to go. – László Papp Jan 13 '14 at 21:04

0 Answers0