Bug 7236 - Python Interpreter Version Mismatch
Python Interpreter Version Mismatch
Product: Samba 4.0
Classification: Unclassified
Component: Build
x86 Linux
: P3 normal
: ---
Assigned To: Jelmer Vernooij
Depends on:
  Show dependency treegraph
Reported: 2010-03-10 15:12 UTC by Stuart Wehrly
Modified: 2010-03-30 19:16 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Wehrly 2010-03-10 15:12:49 UTC
We have two version of python install on our system. In /usr/bin we have python 2.4.3 and in /usr/local/bin we have python 2.5. Many of the scripts are hardcoded to use /usr/bin/python.

 make quicktest
Samba will be compiled with flags:
  CPP        = gcc -E
  CPPFLAGS   = -I./include -I. -I./lib -I./../lib/replace -I./../lib/talloc -I./.. -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H 
  CC         = gcc
  CFLAGS     = -g -DDEBUG_PASSWORD -DDEVELOPER -Wall -Wshadow -Werror-implicit-function-declaration -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wmissing-format-attribute -Wformat=2 -Wdeclaration-after-statement -Wunused-macros -Wno-format-y2k -Wno-unused-parameter
  PICFLAG    = -fPIC
  BNLD       = gcc
  BNLD_FLAGS =  -Wl,--export-dynamic
  STLD       = /usr/local/bin/ar
  STLD_FLAGS = -rcs
  SHLD       = gcc
  SHLD_FLAGS = -shared -Wl,-Bsymbolic 
  MDLD       = gcc
  MDLD_FLAGS = -shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined
  SHLIBEXT   = so
  srcdir     = .
  builddir   = .
  pwd        = /storage/LSP4/contrib/samba/samba-alpha12/source4
( rm -f ./st/st_done &&  LD_LIBRARY_PATH=./bin/shared:$LD_LIBRARY_PATH PYTHON=/usr/local/bin/python2.5 /usr/local/bin/perl -W ./../selftest/selftest.pl --prefix=./st --builddir=. --srcdir=. --exclude=./selftest/skip --testlist="./selftest/tests.sh|"  --exclude=./selftest/slow --quick --include=./selftest/quick --socket-wrapper  && touch ./st/st_done )  | /usr/local/bin/perl -W ./../selftest/filter-subunit.pl --expected-failures=./selftest/knownfail | /usr/local/bin/perl -W ./../selftest/format-subunit.pl --prefix=./st --format=plain --immediate
Version 4.0.0alpha12-GIT-UNKNOWN
OPTIONS  --configfile=$SMB_CONF_PATH --maximum-runtime=1200 --target=samba4 --basedir=/storage/LSP4/contrib/samba/samba-alpha12/source4/st/s4client --option=torture:progress=no --format=subunit --option=torture:quick=yes
Fatal Python error: Interpreter not initialized (version mismatch?)
Unable to provision: 
NSS_WRAPPER_PASSWD="/storage/LSP4/contrib/samba/samba-alpha12/source4/st/dc/etc/passwd" NSS_WRAPPER_GROUP="/storage/LSP4/contrib/samba/samba-alpha12/source4/st/dc/etc/group" /usr/local/bin/python2.5 ./setup/provision --configfile=/storage/LSP4/contrib/samba/samba-alpha12/source4/st/dc/etc/smb.conf --host-name=localdc1 --host-ip= --quiet --domain=SAMBADOMAIN --realm=SAMBA.EXAMPLE.COM --adminpass=localdcpass --krbtgtpass=krbtgtlocaldcpass --machinepass=machinelocaldcpass --root=wehrly --server-role="domain controller"
A summary with detailed information can be found in:

ALL OK (0 tests in 0 testsuites)
make: *** [quicktest] Error 1
Comment 1 Jelmer Vernooij 2010-03-10 16:21:52 UTC
in this case the script is being run explicitly by /usr/local/bin/python2.5 if I read the error message correctly, so the shebang lines shouldn't be relevant.
Comment 2 Jelmer Vernooij 2010-03-10 16:22:33 UTC
What are the python modules linked against ? (e.g. "ldd bin/python/ldb.so")
Comment 3 Matthias Dieter Wallnöfer 2010-03-10 16:37:34 UTC
Well, to start scripts with Python 2.5 when it isn't the default one in "/usr/bin" you should use the full path name of the binary in front of the script. This isn't very nice but it is needed (otherwise you get always in conflict with the different environments). So you might consider to make the newer release the default one (probably through a symbolic link under "/usr/bin").

Regarding your problem: Did "configure" choose Python 2.5 as the preferred environment? It might has chosen the other one and then you fell into this issue.

Other possible error: did you compile Python 2.5 on your own? Then you have to make sure to create the standard library as shared object (libpython2.5.so). This is doable with a "configure" option ("--enable-shared" or something like this) before the build. We don't support linking against a static standard library.
Comment 4 Stuart Wehrly 2010-03-11 09:32:00 UTC
Yes, the python scripts are linked against bin/python/ldb.so.

Here are my configure options:
PYTHON_VER=2.5 ./configure.developer --prefix=/usr/local --enable-fhs

Python in /usr/bin is installed via yum. Python in /usr/local/bin is compiled from source.

libpython2.5.so exists in /usr/local/lib.
Comment 5 Matthias Dieter Wallnöfer 2010-03-14 13:32:25 UTC
One question: do you really need the Python 2.5 installation? Since s4 supports also Python 2.4. And we would recommend to use always the system provided version since as you see it's a pain to get this working with two different releases.

We only dropped Python 2.3 support a month ago or so.
Comment 6 Matthias Dieter Wallnöfer 2010-03-14 13:36:45 UTC
Forgot one comment: sometimes developers add accidentally Python 2.4 incompatible code to our source. If you realize such a problem (you can prove that by looking at the source code on the specified line and then do a lookup in the Python reference guide) write us at "samba-technical@samba.org".
Comment 7 Stuart Wehrly 2010-03-16 07:18:18 UTC
We have several libraries in /usr/local/lib linked against python 2.5. These include dbus-python, gnome-python, libxml2-python, libxslt-python, pycairo, ... any a couple more. We have /usr/local/bin before /usr/bin in the path. We would like to compile samba against python 2.5 as well.
Comment 8 Matthias Dieter Wallnöfer 2010-03-18 03:16:18 UTC
Btw did you try once the python 2.4 compilation? I would strongly suggest to use that, so you don't need to call all scripts using the python2.5 binary as prefix and there shouldn't be needed any configurations settings at all.
Comment 9 Matthias Dieter Wallnöfer 2010-03-25 06:10:35 UTC
Any updates?
Comment 10 Matthias Dieter Wallnöfer 2010-03-30 07:43:32 UTC
Jelmer (our python specialist) has tested this on his own computer where it works and answered your email. So please discuss your problem with him on the mailing list which fits better.

Closing this with "INVALID" here.
Comment 11 Jelmer Vernooij 2010-03-30 19:16:31 UTC
This appears to be a problem in the merged build, not in Samba 4 itself. We don't appear to have a product for that in bugzilla though.