Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Trouble building PySide for Maya 2016 on Windows 7

Trouble building PySide for Maya 2016 on Windows 7

Anonymous
Not applicable
876 Views
2 Replies
Message 1 of 3

Trouble building PySide for Maya 2016 on Windows 7

Anonymous
Not applicable

Hi!

 

I downloaded Qt 4.8.6 modified for Maya 2016 from http://www.autodesk.com/company/legal-notices-trademarks/open-source-distribution.  I was able to build Qt.

 

I went back to the earlier site.  I could not find PySide for Maya 2016.  I did find PySide 1.2.2 for Maya 2014.  Since I know 1.2.2 is the most recent version of PySide, I decided to try that version.  I consulted this link on building PySide for Windows: https://wiki.qt.io/Building_PySide_on_Windows.

 

I had to download copies of libxml2 and libxslt too.  I ended up making some changes inside of the setup.py script that came with PySide, so the setup script would actually see those libraries.

 

cmake_cmd = [
            OPTION_CMAKE,
            "-G", self.make_generator,
            "-DQT_QMAKE_EXECUTABLE=%s" % self.qmake_path,
            "-DBUILD_TESTS=%s" % self.build_tests,
            "-DDISABLE_DOCSTRINGS=True",
            "-DQT_RCC_EXECUTABLE=%s\\bin\\rcc.exe" % self.qt_path,
            "-DQT_QTCORE_INCLUDE_DIR=%s\\include\\QtCore" % self.qt_path,
            "-DQT_QTGUI_INCLUDE_DIR=%s\\include\\QtGui" % self.qt_path,
            "-DQT_QTXML_INCLUDE_DIR=%s\\include\\QtXml" % self.qt_path,
            "-DQT_UIC_EXECUTABLE=%s\\bin\\uic.exe" % self.qt_path,
            "-DQT_MOC_EXECUTABLE=%s\\bin\\moc.exe" % self.qt_path,
            "-DQT_INCLUDE_DIR=%s\\include" % self.qt_path,
            "-DQT_LIBRARY_DIR=%s\\lib" % self.qt_path,
            "-DQT_QTCORE_LIBRARY=%s\\bin\\QtCore4.dll" % self.qt_path,
            "-DCMAKE_BUILD_TYPE=%s" % self.build_type,
            "-DCMAKE_INSTALL_PREFIX=%s" % self.install_dir,
            "-DLIBXML2_LIBRARIES=D:\PySide_Maya2016\libxml2\lib",
            "-DLIBXML2_INCLUDE_DIR=D:\PySide_Maya2016\libxml2\include",
            "-DLIBXSLT_LIBRARIES=D:\PySide_Maya2016\libxslt\lib",
            "-DLIBXSLT_INCLUDE_DIR=D:\PySide_Maya2016\libxslt\include",
            module_src_dir
        ]

 

This is the command I used to do the build:

 

D:\PySide_Maya2016\PySide-1.2.2>setup.py bdist_wininst 

--qmake=D:\PySide_Maya2016\qt\4.8.6\bin\qmake.exe 

--openssl=..\qt\openssl\1.0.1g\x64 

--cmake="C:\Program Files (x86)\CMake\bin\cmake.exe" 

--qt="D:\PySide_Maya2016\qt\4.8.6"

 

Shiboken built correctly.  However, I got a linking error when I tried to build Pyside itself:

 

Linking CXX shared module ..\QtCore.pyd
   Creating library QtCore.lib and object QtCore.exp

qtcore_module_wrapper.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl QString::toWCharArray(unsigned short *)cons
t " (__imp_?toWCharArray@QString@@QEBAHPEAG@Z) referenced in function "struct _object * __cdecl QStringRef_CppToPython_QStringRef(void const *)" (?QStringRef_Cp
pToPython_QStringRef@@YAPEAU_object@@PEBX@Z)

..\QtCore.pyd : fatal error LNK1120: 1 unresolved externals

LINK failed. with 1120
NMAKE : fatal error U1077: '"C:\Program Files (x86)\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
error: Error compiling pyside

Has anyone else come across this issue?

 

0 Likes
877 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Hi cspears2002,

 

I came across this problem last week, when I tried to test the new PySide2 for Qt5 on Windows.
The problem seems to be the sabe, and the solution is this:

MSVC 2010 (and up) has some option that by default makes certain functions into intrinsics.
Unfortunately, the available builds of Qt (4 or 5) never care about this unfortunate default,
but in order to linkt with PySide, the Qt build muast be with that flag disabled.

The huge drawback is: you need to build your own Qt for windows, which is a major undertaking.
Before building, you need to edit the configuration and set the option "/Zc:wchar_t-".

Here my change for qtbase/mkspecs/win32-msvc2010/qmake.conf:

##########
# Compiling PySide2 on Windows 7 with VS2010
# this one was crucial:
# QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t
# change to

QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t-

# and run configure
##########


I'd be happy if I had a better solution that works without this huge effort.
Maybe I can come up with something.

cheers - Chris

 

0 Likes
Message 3 of 3

Anonymous
Not applicable

Hi,

 

I worked a bit on this, and here is a solution without rebuilding.

 

The setting

 

QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t

can stay as it is. Instead, you find similar settings in the CMake files of pyside and shiboken.

They contain the crucial "-" setting. Search the text files for 'Zc:wchar_t' and edit.

Change it to the value as above, and things will build, smoothley.

 

cheers - Chris

 

p.s.: I will automate that setting for Qt5...

0 Likes