To complete the article written by Kristine last month, I could not resist to go through the process of building these libraries myself on the 3 platforms Windows x64, Linux and MacOS (I tend not to work on win32 anymore). Unfortunately, the documentation provided by Autodesk isn't always very clear. Not I mean it is wrong or incorrect, but sometimes assumes you either know these Qt underneath requirements and/or Autodesk internal build procedures.
Whatever you decide to do, you will need to build Qt using the Autodesk modified version of Qt. Many time people ask if they can upgrade the Maya Qt to a newer version. The answer is unfortunately NO. You can modify and backport Qt fix into the Maya modified version, but unfortunately you need to use Qt 4.7.1 base for Maya 2013. A copy of the customized Qt 4.7.1 source is available from Autodesk's Open Source web-site (http://www.autodesk.com/lgplsource) and includes text files describing how to configure, build and install Qt for each platform supported by Maya.
You will also need to set up your environment accordingly to the API docs (Developer Resources > API Guide > Setting up your build environment in the Maya Documentation). And use the correct compilers.
And follow the instructions for building Qt coming from the following files included in qt-4.7.1-modified_for_maya_2013.zip:
- howToBuildQtOnMac_m2013.txt for MacOs
- howToBuildQtOnLinux_m2013.txt for Linux x64
- howToBuildQtOnWindows_m2013.txt for Windows win32 and x64
howToBuildQtOnMac_m2013.txt - Let's start with Mac. First, it is important to use the Snow Leopard 10.6 SDK, but if like me you already upgraded to the Lion version, you will need to modify the build configuration instructions like below. Instead of
./configure -prefix /Users/myHomeDir/qt-4.7.1 -arch x86_64 -debug-and-release -no-rpath -silent -no-qt3support
./configure -prefix /Users/myHomeDir/qt-4.7.1 -arch x86_64 -debug-and-release -no-rpath -silent -no-qt3support -sdk /Developer/SDKs/MacOSX10.6.sdk
If you do not do this, not only the Qt build will fail, but you would use the wrong SDK version. You could eventually decide you prefer to change the Qt source code like on this Qt patch post to build on Lion, but remember that you should be using the 10.6 SDK version to build Maya 2013 plug-ins. And in case you decide to use the 10.7 SDK version anyway, you'll probably have other issue later in Maya and/or build Qt/PyQt.
Other than this SDK issue, the instructions for building Qt on the Mac are ok.
For the rest of the post, we will assume Qt is installed on /Users/myHomeDir/qt-4.7.1
howToBuildQtOnLinux_m2013.txt - Linux is another story. Not only Linux exists on many different distributions, but all the tools / libraries you need aren't necessarily present on your distribution. The Maya documentation is telling you all you need to know in case the machine is setup as a developer machine already with all the GCC, Qt, Maya requirements present.
The first thing described in the Maya 2013 documentation for building on Linux is that you need the GCC 4.1.2 compiler. See here. While the Maya documentation is saying all you need to build GCC, there are few things which aren't mentioned which can cause you problems if you aren't familiar with Linux.
First compiling GCC has some prerequisites which require you to install couple of packages. If you unsure of what you are doing, the simplest would be to log as superuser and install this two group packages. Probably more than what you strictly need, but an easy way to get it right :)
yum groupinstall "Developer Tools"
yum groupinstall "Developer Libraries"
While we are at yum'ing, you will also need 2 other packages for building Qt, so let's do it now
yum install libXext-devel
Now, while you build GCC, you may got an error about MAKEINFO not present on your machine even if it is installed properly. In that case, the simplest is to go in the gcc-build directory and edit the Makefile file in 'vi' or any text editor. Search for MAKEINFO in that file, and a replace the long line with missing information by:
MAKEINFO = /usr/bin/makeinfo
After that follow the instructions, everything should be ok from there.
For the rest of the post, we will assume Qt is installed on /usr/local/Trolltech/Qt‐4.7.1
howToBuildQtOnWindows_m2013.txt - While for Windows everything looks straight forward, I mean the only important thing is to have Visual Studio 2010 Service Pack 1 (or the Visual C++ Express 2010 Edition with Service Pack 1), it is not entirely true.
Linux and Mac instructions just tell you to install openssl or verify it is present on your machine. For Windows, the instructions to build Qt mention that you need to download a file named openssl-1.0.0e.zip - but no mention where that file is, and why it is needed.
The OpenSSL modified source is supposed to be included in the Maya modified archive or on the LPGL Autodesk page but at the time of this post it isn't. I am not sure of the exact reason, but the fact it is isn't posted makes impossible for someone outside Autodesk to rebuild a modified version of Qt for Windows that can be used safely in Maya. As far I know the OpenSSL modified source code is required for the Autodesk SyncHub module used for Autodesk' Cloud solutions and interrop operations between Maya, Mudbox, etc... It affects directly QtNetwork.dll, and you would need this modified OpenSSL source if you want to recompile this DLL and post it into Maya bin directory. If you just need to build Qt for compiling other modules, but do not need to post a modified version or QtNetwork.dll, then you do not need that OpenSSL modified version. You can simply ignore the instructions about OpenSSL as I did for the rest of the post.
As a side note, I also wanted to mention that I did not use the JOM tools as specified in the instructions to avoid to use the Nokia Qt SDK, but instead stick using nmake. Making use of JOM speed up the build process, but this is extra few steps which aren't really needed. You can find JOM here as well in case you want. In any case, the Windows instructions make mention of a 2010.05 version, but the URL mentioned in the document does not work. Visit http://qt.digia.com/Product/Qt-SDK/ for more details if you interested using it. I did not,
Now that we decided not to use JOM but nmake and that we know that the OpenSSL modified source aren't available, you can follow the instructions in the document and skip the ones which make reference to either both of JOM and OpenSSL. Note the documentation does not say to install Qt like for the Mac and Linux intructions, so do not forget that step by doing a 'nmake install' at the end of the build. Otherwise you'll get error in the PyQt build.
For the rest of the post, we will assume Qt is installed on c:\qt-adsk-4.7.1
(It is always a good idea to use a subst drive rather than c: but this is a detail)
Rather than duplicating the required modified instructions here and in the PDF document available here on the Autodesk WEB site, I updated the instructions directly in the PDF document.
One last minute update - the Maya 2013 Extension includes qmake.exe in its bin folder (I.e.: 'C:\Program Files\Autodesk\Maya2013.5\bin'), so delete or rename it while you rebuild PyQt or you'll get strange errors.
Meet in our next post for building PySide - Building Qt, PyQt, PySide for Maya 2013 - Part 2