[Samba] Python UCS2 vs UCS4 issue on latest git: ImportError: ....undefined symbol: PyUnicodeUCS2_Decode (NOT SOLVED)

Phil Quesinberry philq at qsystemsengineering.com
Thu Apr 4 19:16:56 MDT 2013

I forgot to remove 'solved' from the title after the fix I thought I had
discovered didn't work.  I was going to post anyway in hopes of helping
someone else but that didn't quite work out the way I'd planned.  I'll use
the lateness of the hour as an excuse.
Ok, so after digging further into this problem, it's getting weird:

I decided to manually do the configure>make>make install on Samba's private
Python build that's normally done in the 'install_with_python' shell script
and configure it with --enable-unicode=ucs2 but even though it built
successfully, executing /usr/local/samba/python/bin/python and doing an
import sys followed by print sys.maxunicode gives a value of 1114111.  So
either my config command was ignored completely or there's something else
going on that I just don't understand.  If that's the case and someone in
here knows enough to enlighten the new guy on what's happening or at least
direct me to some relevant info, I'd really appreciate it.

Also, if there's a way to "un-provision" Samba in order to join an existing
domain as a DC without wiping it out and re-installing, I'd like to know how
to do that too.  I see where others have asked the same question but each
time it has gone unanswered so I'm assuming that there's no practical way to
do it at the moment.  That's actually what got me into this mess.

I'll try reverting to the latest stable version, this last pull from
v4-0-test appears to be broken, at least for my environment.

- Phil

From: Phil Quesinberry
Sent: Thursday, April 04, 2013 1:48 AM
To: 'samba at lists.samba.org'
Subject: Python UCS2 vs UCS4 issue on latest git: ImportError: ....undefined
symbol: PyUnicodeUCS2_Decode [SOLVED]
I'm getting the following error attempting to run samba-tool after
installing the latest git using the install_with_python script to use Python
[root at Server1 dcerpc]# samba-tool
Traceback (most recent call last):
  File "/usr/local/samba/bin/samba-tool", line 33, in <module>
    from samba.netcmd.main import cmd_sambatool
line 20, in <module>
    from samba import getopt as options
  File "/usr/local/samba/lib/python2.6/site-packages/samba/getopt.py", line
30, in <module>
    from samba.hostconfig import Hostconfig
  File "/usr/local/samba/lib/python2.6/site-packages/samba/hostconfig.py",
line 20, in <module>
    from samdb import SamDB
  File "/usr/local/samba/lib/python2.6/site-packages/samba/samdb.py", line
32, in <module>
    from samba.dcerpc import drsblobs, misc
undefined symbol: PyUnicodeUCS2_Decode
Samba-tool was working with the previous git, so I'm not certain if this is
a problem with the latest build or a problem with Python in my environment.
If I understand this correctly, Samba was compiled with a Python version
using 2-byte Unicode characters but my Python version is using 4-byte
Unicode characters.  If that is indeed the case, why was it changed and what
would be the best way to go about fixing this problem?  I tried adding
-enable-unicode=ucs2 to the configure options in the 'install_with_python'
script but that had no effect so now I wonder if somehow a different version
of Python on the system is being referenced instead of the one included with
Any suggestions here would be greatly appreciated, even if it's only to tell
me whether or not I'm on the right track.  Thanks!
Version is 4.0.5-GIT-20b0adc.  CentOS 5.9.
Phil Quesinberry
Q Systems Engineering, Inc.
Electronic Controls and Embedded Systems Development
(410) 969-8002

More information about the samba mailing list