ImportError: /usr/lib/panda3d/libpandaexpress.so: undefined symbol: PyUnicodeUCS4_AsWideChar



Code:

DirectStart: Starting the game.
Traceback (most recent call last):
  File "Tut-Asteroids.py", line 16, in <module>
    import direct.directbase.DirectStart
  File "linuxroot/usr/share/panda3d/direct/src/directbase/DirectStart.py", line 3, in <module>
  File "linuxroot/usr/share/panda3d/direct/src/showbase/ShowBase.py", line 10, in <module>
  File "/usr/share/panda3d/pandac/PandaModules.py", line 1, in <module>
    from libpandaexpressModules import *
  File "/usr/share/panda3d/pandac/libpandaexpressModules.py", line 1, in <module>
    from extension_native_helpers import *
  File "/usr/share/panda3d/pandac/extension_native_helpers.py", line 38, in <module>
    from libpandaexpress import *
ImportError: /usr/lib/panda3d/libpandaexpress.so: undefined symbol: PyUnicodeUCS4_AsWideChar
Panda3D uses the function 'PyUnicode_AsWideChar'. This function is supposed to be supplied by the python library.

In my copy of ubuntu gutsy, there's a configuration file called "/usr/include/python2.5/pyconfig.h" which contains this line:

#define Py_UNICODE_SIZE 4

This, in turn, causes Py_UNICODE_WIDE to be defined. That, in turn, causes this to happen:

#ifndef Py_UNICODE_WIDE
#define PyUnicode_AsWideChar PyUnicodeUCS2_AsWideChar
#else
#define PyUnicode_AsWideChar PyUnicodeUCS4_AsWideChar
#endif

Since the ubuntu gutsy Panda3D distribution was compiled using this copy of python, when it calls PyUnicode_AsWideChar, it's really calling PyUnicodeUCS4_AsWideChar.

My theory is this: your copy of python was compiled with Py_UNICODE_SIZE 2. You can probably check this by looking in your copy of pyconfig.h. If that's the case, then that would explain why your copy of python isn't providing this function.

I deleted my Python installation in /usr/local, downloaded the newest stable (2.5.2), ran ./configure --enable-unicode=ucs4 then make and make install. After this, run "python" and see if the version/date built make sense. Then, do the following

Code:
import sys
if sys.maxunicode > 65535:
    print 'UCS4 build'
else:
    print 'UCS2 build'

If this comes out to UCS4, you're good. Then create /usr/local/lib/python2.5/site-packages/panda3d.pth with the two lines "/usr/share/panda3d" and "/usr/lib/panda3d". Then go back to an interpreter and do sys.path and make sure they're there. Then the demos worked.

Finding the problem was difficult, but the solution is simple. So this error really, as far as I can tell, isn't that big a deal. ./configure --enable-unicode=ucs4 is the answer.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值