[PyQt] Deploying PyQt4 on Linux

Hans-Peter Jansen hpj at urpla.net
Thu Jun 25 10:04:30 BST 2009

Am Donnerstag, 25. Juni 2009 schrieb ion vasilief:
> Hello everybody,
> I'm trying to deploy an application ("my_app")
> that uses Qt, Python, PyQt4 and SIP on Linux in a distribution
> independent way (meaning that even if there are other default versions
> of these libraries installed on the system, my_app will load at run
> time the symbols from the libraries I have built it against).
> My idea was to deploy all the necesarry dependencies in the
> /usr/local/my_app/lib folder.
> Therefore
> I have compiled Qt 4.5.1 and Python 2.6 with the
> --prefix=/usr/local/my_app option. After that I have built SIP and
> PyQt4 using Qt/Python versions previousely built. Finally I have
> compiled my application against all these libraries. At run time, PyQt4
> still loads the default Qt 4.5.0 installed on the system (in /usr/lib),
> instead of the Qt 4.5.1 version from the /usr/local/my_app/lib folder.
> The only solution I have found is to modify the QTDIR environement
> variable, but I don't want to mess with that when I deploy my
> application.
> My question: is there a way to force PyQt4 to load the symbols from the
> Qt version it was built against?

That's gonna be tough. You WILL have to fiddle with QTDIR and most probably 
with LD_LIBRARY_PATH, but just do it in a shell wrapper. You need to build 
on the oldest distribution, you're targeting, because glibc is backward but 
not forward compatible (huu, can't they predict the future..). You have to 
take care of dependant libs of ALL components, and need to test it on all 
targeted distributions. At the end, it may be easier to write an installer, 
that installs the necessary packages in a distribution coherent way. 

Good luck,

More information about the PyQt mailing list