[PySide] --enable-unicode=ucs4 on Mac fails to import shiboken

101 views
Skip to first unread message

Blair Zajac

unread,
Mar 15, 2012, 6:19:48 PM3/15/12
to pys...@qt-project.org
For consistency with our Linux distro's, I've built Python 2.7 in
MacPorts using the --enable-unicode=ucs4 flag, but with this flag, the
import fails with:

>>> from PySide import QtGui
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError:
dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so,
2): Symbol not found: _PyUnicodeUCS2
Referenced from: /opt/local/lib/libshiboken-python2.7.1.1.dylib
Expected in: flat namespace
in /opt/local/lib/libshiboken-python2.7.1.1.dylib

Any idea why this would be the case? There's no code in PySide that
explicitly lists PyUnicodeUCS2.

Doing a fresh build of everything without --enable-unicode=ucs4 works fine.

Could it be related to this difference when compiling Python:

Without --enable-unicode=ucs4:

-checking what type to use for unicode... unsigned short

With --enable-unicode=ucs4:

+checking what type to use for unicode... no type found

Thanks,
Blair
_______________________________________________
PySide mailing list
PyS...@qt-project.org
http://lists.qt-project.org/mailman/listinfo/pyside

Sebastian Wiesner

unread,
Mar 16, 2012, 5:05:14 AM3/16/12
to Blair Zajac, pys...@qt-project.org
Am 15. März 2012 23:19 schrieb Blair Zajac <bl...@orcaware.com>:
> For consistency with our Linux distro's, I've built Python 2.7 in
> MacPorts using the --enable-unicode=ucs4 flag, but with this flag, the
> import fails with:
>
>  >>> from PySide import QtGui
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError:
> dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so,
> 2): Symbol not found: _PyUnicodeUCS2
>   Referenced from: /opt/local/lib/libshiboken-python2.7.1.1.dylib
>   Expected in: flat namespace
>  in /opt/local/lib/libshiboken-python2.7.1.1.dylib
>
> Any idea why this would be the case?  There's no code in PySide that
> explicitly lists PyUnicodeUCS2.

UCS2 vs. UCS4 changes the ABI of the CPython library, hence extension
modules built against an UCS2 build of CPython will not work in an
UCS4 build of CPython and vice versa.

Re-build shiboken against the UCS 4 build and everything should work
as expected.

Blair Zajac

unread,
Mar 16, 2012, 1:19:26 PM3/16/12
to Sebastian Wiesner, pys...@qt-project.org
On 03/16/2012 02:05 AM, Sebastian Wiesner wrote:
> Am 15. März 2012 23:19 schrieb Blair Zajac<bl...@orcaware.com>:
>> For consistency with our Linux distro's, I've built Python 2.7 in
>> MacPorts using the --enable-unicode=ucs4 flag, but with this flag, the
>> import fails with:
>>
>> >>> from PySide import QtGui
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>
>> ImportError:
>> dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PySide/QtGui.so,
>> 2): Symbol not found: _PyUnicodeUCS2
>> Referenced from: /opt/local/lib/libshiboken-python2.7.1.1.dylib
>> Expected in: flat namespace
>> in /opt/local/lib/libshiboken-python2.7.1.1.dylib
>>
>> Any idea why this would be the case? There's no code in PySide that
>> explicitly lists PyUnicodeUCS2.
>
> UCS2 vs. UCS4 changes the ABI of the CPython library, hence extension
> modules built against an UCS2 build of CPython will not work in an
> UCS4 build of CPython and vice versa.
>
> Re-build shiboken against the UCS 4 build and everything should work
> as expected.

Right, I'm aware that you need to recompile everything. This failure is
after a complete recompile. Here are the commands I ran:

$ sudo port uninstall -v --follow-dependents python27
$ sudo port install -v py27-pyside

And then I get the link error.

Blair

Sebastian Wiesner

unread,
Mar 17, 2012, 6:03:31 AM3/17/12
to Blair Zajac, pys...@qt-project.org

Did you make sure that you really used the ports python, and not
accidentally the system python?

Blair Zajac

unread,
Mar 17, 2012, 2:15:58 PM3/17/12
to Sebastian Wiesner, pys...@qt-project.org

I did some follow up work at the MacPorts compile and it did pick up the
system's Python at compile time, so it used UCS2. I'm working with the
port maintainer to fix it.

Sorry for the noise.

Blair

Reply all
Reply to author
Forward
0 new messages