1

I've spent most of the day on this, and it is driving me absolutely insane. On all other Unixes I've used, this is a walk in the park, but SLES 11 has me dumbfounded.

I need to build Zope on SLES 11 64 bit:

Linux <name> 2.6.27.45-0.1-default #1 SMP 2010-02-22 16:49:47 +0100 x86_64 x86_64 x86_64 GNU/Linux

I first tried to just use the YaST-installed Python 2.6. I've also installed python-devel, libjpeg-devel, readline-devel, libopenssl-devel, libz2-devel, zlib-devel, and libgcrypt-devel.

The global python2.6 has a lot of cruft in it, and seems to execute stuff in /etc/pythonstart when I use it, which doesn't help. However, the error I get is this:

Getting distribution for 'Zope2==2.12.3'.
src/AccessControl/cAccessControl.c:596: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:598: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:598: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:599: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:599: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:600: warning: ‘intintargfunc’ is deprecated
src/AccessControl/cAccessControl.c:600: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:601: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:602: warning: initialization from incompatible pointer type
src/AccessControl/cAccessControl.c:606: warning: ‘intargfunc’ is deprecated
src/AccessControl/cAccessControl.c:606: warning: initialization from incompatible pointer type
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libpython2.6.so when searching for -lpython2.6
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lpython2.6
collect2: ld returned 1 exit status
error: Setup script exited with error: command 'gcc' failed with exit status 1
An error occured when trying to install Zope2 2.12.3. Look above this message for any errors that were output by easy_install.

I don't know what "incompatible" is referring to here; my guess would be the hardware architecture, but I'm not sure what's incompatible with what in the statement above.

I've had problems with system-installed Pythons before, so I tried to compile my own (hence the list of -devel packages above), downloading the Python 2.6 tarball and running:

./configure --disable-tk --prefix=${HOME}/python
make
make install

This installs, but it seems to be unable to find any system-wide libraries. Here's a sample interpreter session:

Python 2.6.5 (r265:79063, Mar 29 2010, 17:04:12) 
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "/etc/pythonstart", line 7, in <module>
    import readline
ImportError: No module named readline
>>> from hashlib import md5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/osc/python-2.6/lib/python2.6/hashlib.py", line 136, in <module>
    md5 = __get_builtin_constructor('md5')
  File "/home/osc/python-2.6/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
    import _md5
ImportError: No module named _md5

Both readline and hashlib (via libgrypt) should be installed, and the relevant -devel packages are also installed. On Ubuntu or OS X, this works just fine. On SuSE, no luck.

Any help greatly appreciated!

Martin

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
optilude
  • 131
  • 1
  • 4
  • Another interesting note: I tried to build the egg directly (with python setup.py build_ext). The output is: building 'AccessControl.cAccessControl' extension gcc -pthread -shared build/temp.linux-x86_64-2.6/src/AccessControl/cAccessControl.o -L/usr/lib64 -lpython2.6 -o build/lib.linux-x86_64-2.6/AccessControl/cAccessControl.so /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lpython2.6 collect2: ld returned 1 exit status Note the -L/usr/lib64 in there. Somehow, that makes gcc happy, but not ld. – optilude Mar 30 '10 at 04:33

4 Answers4

2

After an awful lot of pain, the missing piece was this: /usr/lib64/libpython2.6.so was missing. It should be a symlink to /usr/lib64/libpython2.6.so.1.0, but somehow it got lost or was never installed.

A custom-built python still failed to find certain libraries (e.g. libgcrypto or libopenssl), but I managed to get a good python using the SuSE-provided one, coupled with virtualenv --no-site-packages to get a pristine environment.

Thanks to all those who helped, especially Wichert on IRC who explained the .so symlink thing. ;-)

optilude
  • 131
  • 1
  • 4
0

Martin, tried to Tweet it but of course mine do not show on yours, put your python libs in a directory (or symlink) that you then add to your python path IE PYTHONPATH "/home/osc/pythonstuff/extra_python_lib_15.6.3"

Or #adjust as needed you can append / add to $HOME/.bashrc or $HOME/.profile
PYTHONPATH=$PYTHONPATH=/usr/lib64/python2.6/somelib/

export $PYTHONPATH

it will then find them.

Using YuM is also a good idea as Yast can be sucky but you need to download and install using these instructions (good .spec file moved over from Fedora) http://ivan.kartik.sk/ as the OPenSuse package is not 2.6 compatible.

Im betting a clean install using YuM will work fine, YasT can be a little strange like that and also I have noticed /lib and /lib64 getting mixed up solved by simply symlinking /usr/lib64 to /usr/lib or apro location

Peace

Asigottech

  • Thanks for the reply! It didn't work, though. The problem is not in getting somethign to link to a custom python lib, but rather to get C extensions to buid. The closest I've come is to do this: 0. Uninstall libpython-32bit, so there's no longer a /usr/lib/libpython2.6.so.1.0 (but there's one in /usr/lib64) 1. Create a --no-site-packages virtualenv 2. Use this python to do "python setup.py build_ext", which just builds the C extensions This still fails with: ld: cannot find -lpython2.6 as shown in more detail above. – optilude Mar 30 '10 at 04:32
0

Download readline, compile from the source code then re-compile python from the source code.

Peace

Asigottech

http://www.linuxforums.org/forum/suse-linux-help/156619-python-error-sles-no-module-name-readline.html

PS - Gentoo is your friend : )

  • Yes, that may get me a sane python with readline; not sure about the md5 stuff, or openssl or other system-libraries it can't link to, though. :-/ And even then, I'm not convinced it'll build C extensions properly (see my comment above). – optilude Mar 30 '10 at 08:44
0

Oh well, getting OLD I guess : ) thought you had that .so under /usr/lib64 though ?

Glad its sorted, remeber Gentoo is coooler