Running Qt C++ Programs on the XGrid

From dftwiki3
Revision as of 10:45, 3 June 2010 by Thiebaut (talk | contribs) (The solution)
Jump to: navigation, search
XgridLogo.png

This short How-To page shows how to deploy a Qt3 C++ application on the XGrid. The problem addressed is that the Qt libraries might not be installed on the XGrid client, which will make the application fail when it starts running on a client.

The Problem

  • We have an executable generated by compiling a C++ program using the Qt 3.6 libraries.
  • Want to run the Qt executable on the XGrid.
  • Qt 3.6 is not installed on the XGrid clients
  • Qt was installed assuming its libraries would be loaded dynamically.
  • We don't want to reinstall or reconfigure Qt.

The solution

  • Use otool to find all the libraries that are not standard (we assume they are all in /opt/local/lib) and assume that they will not be on the client.
  • Copy all these libraries next to the executable, and modify the executable with install_name_tool such that the path of the libraries as it wants to refer to them is not absolute, but becomes whatever the executable path is.
For example, if the executable contains a reference to /opt/local/lib/libqt-mt.3.dylib, it should be changed to @executable_path/libqt-mt.3.dylib.
  • This process is repeated for all the libraries brought in, so that if they too rely on non-system libraries, they will be modified to have a new path to them, and these libraries will be brought in in turn.
  • makeStaticPackage.py must be started in an empty directory and copies into it the original executable, as well as all the non-system libraries, one after the other. It then generates a text file that can be used by another Python script for creating an XGrid batch file.