[CentOS] python-sybase on Centos 5 x86_64

Mon Oct 6 04:03:20 UTC 2008
Michael Best <mbest at pendragon.org>

Installed the freetds rpms from centos-extras, also tried the ones in 
rpmforge
http://mirror.centos.org/centos/5/extras/x86_64/RPMS/freetds-0.64-11.el5.centos.x86_64.rpm
http://mirror.centos.org/centos/5/extras/x86_64/RPMS/freetds-devel-0.64-11.el5.centos.x86_64.rpm

Compiled python-sybase-0.39 by hand, and also via rpm.

http://www.redhat.com/archives/fedora-package-review/2008-August/msg01790.html

This spec file modified to compile on x86_64:
http://gohanman.com/rpm/Fedora9/freetds-devel/freetds-devel.spec

--- python-sybase.spec  2008-10-05 21:53:49.000000000 -0600
+++ python-sybase.spec.new      2008-10-05 21:53:36.000000000 -0600
@@ -27,6 +27,6 @@
  %install
  rm -rf $RPM_BUILD_ROOT
-PYVERSION=`python --version 2>&1 | sed -e "s/.* 
\([0-9]*\.[0-9]*\)\.[0-9]*/\1/g"`
-export PYTHONPATH="$RPM_BUILD_ROOT/usr/lib/python$PYVERSION/site-packages"
+PYVERSION=`python -V 2>&1 | sed -e "s/.* \([0-9]*\.[0-9]*\)\.[0-9]*/\1/g"`
+export 
PYTHONPATH="$RPM_BUILD_ROOT/usr/lib64/python$PYVERSION/site-packages"
  mkdir -p $PYTHONPATH
  export SYBASE="/usr"

Both the source version and the rpm are built basically the same way, 
and the final result after installation is something like:

# python
Python 2.4.3 (#1, Mar 14 2007, 19:01:42)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import Sybase
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "build/bdist.linux-x86_64/egg/Sybase.py", line 11, in ?
   File "build/bdist.linux-x86_64/egg/sybasect.py", line 7, in ?
   File "build/bdist.linux-x86_64/egg/sybasect.py", line 6, in __bootstrap__
ImportError: 
/home/mbest/.python-eggs/python_sybase-0.39-py2.4-linux-x86_64.egg-tmp/sybasect.so: 
undefined symbol: blk_alloc

As per this thread:
http://mlblog.osdir.com/python.sybase/2004-03/

Something may be going wrong in linking, as the sybasect.so doesn't seem 
to be linked to the sybase libraries.

$ ldd 
~/.python-eggs/python_sybase-0.39-py2.4-linux-x86_64.egg-tmp/sybasect.so
         libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aaaaacdf000)
         libc.so.6 => /lib64/libc.so.6 (0x00002aaaaaef9000)
         /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

Suggestions, comments, fixes, would all be useful.

-Mike