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.

Building Qt
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
do
./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
glibc-devel.i686
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)

Building SIP and PyQt
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.
Building PySide
Meet in our next post for building PySide - Building Qt, PyQt, PySide for Maya 2013 - Part 2
What are the chances Autodesk will provide pre-compiled versions for users for future releases of Maya? I got about as far as this post on my own before giving up (hit too many snags, the open ssl thing threw me for a loop) and just found a pre-compiled version online (2013 x64 win). I'm reluctant to start authoring production-sensitive ui's that won't work in the next version of Maya until someone recompiles this stuff. Thoughts?
Posted by: Eric Pavey | October 03, 2012 at 09:05 AM
Hi Eric,
I know what you mean, that whole thing isn't an easy process for everyone. The main important point here is to remember you only need to recompile Qt source if you want to modify Qt source on your side which in this case Autodesk cannot provide you with your modified binaries. Maya ships Qt binaries and libraries that you can use directly. So the openssl comment is only relevant for those who wants to recompile Qt itself.
Now I guess your comment was on providing PyQt or PySide binaries (may be both ;) - We survey developers on our annual API survey for the last 2 years (i.e.: http://around-the-corner.typepad.com/adn/2012/06/api-wishlist-surveys.html) and we saw a fair amount of people using either PyQt and/or PySide, so we are thinking about it...
I did not posted the binaries here for legal implication in doing that, but I am ready to share my scripts on the 3 platforms for those interested.
Posted by: Cyrille Fauvel | October 03, 2012 at 09:20 AM
Hello,
I'm trying to install pyqt but when I'm in the step to build SIP I get some errors like this:
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
I use maya 2013 without the extension. And i don't have qmake.exe inside the folder: ..\maya2013\bin
can you help me?
Thank you.
Posted by: Lluis | October 03, 2012 at 02:17 PM
Hi Luis
you do not need Qt to build SIP, so in theory it should work fine with this
subst v: whateverrootfolderyouwant
rem ex: subst v: e:\Users\cyrille\QtBuild
v:
cd \sip-4.13.3
SET MSVC_DIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0
call "%MSVC_DIR%\VC\vcvarsall" amd64
set MAYA_LOCATION=C:\Program Files\Autodesk\Maya2013
set INCLUDE=%INCLUDE%;%MAYA_LOCATION%\include\python2.6;%MAYA_LOCATION%\Python\include
set LIB=%LIB%;%MAYA_LOCATION%\lib
"%MAYA_LOCATION%\bin\mayapy" configure.py
nmake
nmake install
Let me know if any problem
Posted by: Cyrille Fauvel | October 03, 2012 at 11:37 PM
Hi!
Thank you, it worked.
But now when I try to test I get another error:
My command is:
from PyQt4 import QtGui,QtCore, uic
import maya.cmds as cmds
uifile = '$d+"/test.ui"'
form, base = uic.loadUiType(uifile)
Error:
# Error: IOError: file C:\Program Files\Autodesk\Maya2013\bin\python26.zip\xml\etree\ElementTree.py line 579: 22 #
Do You know why it happend?
The error is when execute the step: "form, base = uic.loadUiType(uifile)"
Thank you very much!
Posted by: Lluis | October 04, 2012 at 01:04 AM
Hi Luis
without seeing the ui file, I can't really tell. I tried a simple ui file and it worked fine for me. Please copy me your code and I'll try. Contact me by email (email in my profile - http://around-the-corner.typepad.com/adn/cyrille-fauvel.html)
Posted by: Cyrille Fauvel | October 04, 2012 at 01:51 AM
Ok I will send you an e-mail.
Thank you.
Posted by: Lluis | October 04, 2012 at 02:18 AM
Thank you for your help,
it is working now!
Posted by: Lluis | October 04, 2012 at 07:37 AM
Hello thanks for the great post ,I didn't test it yet but i will do that tonight , so far I used other tutorial.
Honestly is quite a pain to compile pyqt or pyside ( I am running into tons of errors and when i fix them other rises and so on ). I really hope autodesk will provide asap binaries at least for pyside for all platform (since pyside doesn't have license problems for distributing).It would be so nice from autodesk :)
Posted by: Marco Giordano | October 08, 2012 at 05:42 AM
I'm fairly certain that PySide can be shipped pre-compiled without any legal issues. I know for a fact that Nuke ships with them.
Posted by: Jimmy Christensen | October 08, 2012 at 10:18 PM
Actually, I've tested using Nuke's PySide in Maya and it seems to work fairly well (just remember to copy over the libshiboken-python2.6 library aswell).
Posted by: Jimmy Christensen | October 08, 2012 at 10:20 PM
Hello,
I am wondering if you can provide information about getting PyQt built for MotionBuilder?
Thanks!
Posted by: Andrew Grant | October 12, 2012 at 09:28 AM
Hi Cyrille,
First, thanks for the post. I'm attempting to build Qt for Maya on OS X-Lion. The instructions for building the configuration using the -sdk switch if running Lion helped me over my first roadblock.
I'm still having trouble and was hoping that you could help.
I built the configuration using:
./configure -prefix-install -arch x86_64 -debug-and-release -no-rpath -silent -no-qt3support -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -platform macx-g++
Then "make" ended with the following:
-----
linking ../../../../plugins/phonon_backend/libphonon_qt7.dylib
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks//QuickTime.framework/QuickTi\
me, missing required architecture x86_64 in file
mv -f libphonon_qt7_debug.dylib ../../../../plugins/phonon_backend/
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks//QuickTime.framework/QuickTi\
me, missing required architecture x86_64 in file
mv -f libphonon_qt7.dylib ../../../../plugins/phonon_backend/
make: *** [sub-plugins-make_default-ordered] Error 2
-----
Subsequently, after cleaning up ( make clean, make confclean ), I re-built the configuration with the change "-arch x_86"
This time, "make" ended with:
-----
linking ../../../../../../imports/QtWebKit/libqmlwebkitplugin.dylib
ld: file not found: phonon.framework/Versions/4/phonon for architecture i386
collect2: ld returned 1 exit status
make[2]: *** [../../../../../../imports/QtWebKit/libqmlwebkitplugin.dylib] Error 1
make[1]: *** [release-all] Error 2
make[1]: *** Waiting for unfinished jobs....
rm -f libqmlwebkitplugin_debug.dylib
linking ../../../../../../imports/QtWebKit/libqmlwebkitplugin_debug.dylib
ld: file not found: phonon.framework/Versions/4/phonon for architecture i386
collect2: ld returned 1 exit status
make[2]: *** [../../../../../../imports/QtWebKit/libqmlwebkitplugin_debug.dylib] Error 1
make[1]: *** [debug-all] Error 2
make: *** [sub-webkitdeclarative-make_default-ordered] Error 2
-----
Any suggestions would be greatly appreciated.
Thanks!
Posted by: Ken Mohamed | October 27, 2012 at 04:21 PM
Hi Ken
You cannot use x_86, it should be x86_64.
and because you do not point to the 10.6.sdk, you are using the Lion 10.7 SDK which is the one by default on Lion.
It also means you are using Xcode 4 vs Xcode 3.2.1 as it is specified in the Maya document. I know it is not always obvious what happens during compilation but you have to follow the exact steps to get it working.
./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 the /Developer/SDKs/MacOSX10.6.sdk does not exist on your system, that means you do not have the Xcode 3.2.1 compiler, nor the 10.6 SDK which are required. In that case please install them - they can be installed side by side to Xcode 4 and the 10.7 SDK.
Hope that will help,
Posted by: Cyrille Fauvel | October 28, 2012 at 04:18 AM