djhenderson / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Do not build for ubuntu 11.10 32 bit #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Get latest source:
$ hg clone https://code.google.com/p/pymssql/
...
$ hg summary 
parent: 219:281a613b6f82tip
 MANIFEST.in changes to get correct files in source distribution
branch: default
...
2. Try build:
$ ./setup.py build
Traceback (most recent call last):
  File "./setup.py", line 291, in <module>
    entry_points = {}
  File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 221, in __init__
    self.fetch_build_eggs(attrs.pop('setup_requires'))
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 245, in fetch_build_eggs
    parse_requirements(requires), installer=self.fetch_build_egg
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 556, in resolve
    raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (Cython 0.14.1 (/usr/lib/pymodules/python2.7), 
Requirement.parse('Cython>=0.15.1'))

3. If change requered Cython version to 1.14.1 recive next error:
$ ./setup.py build
running build
running build_ext
cythoning _mssql.pyx to _mssql.c
building '_mssql' extension
creating build
creating build/temp.linux-i686-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall 
-Wstrict-prototypes -fPIC -I./freetds/nix_32/include -I/usr/include/python2.7 
-c _mssql.c -o build/temp.linux-i686-2.7/_mssql.o -DMSDBLIB
_mssql.c: В функции «__pyx_f_6_mssql_clr_err»:
_mssql.c:2720:8: предупреждение: variable 
«__pyx_v__mssql_last_msg_state» set but not used [-Wunused-but-set-variable]
_mssql.c:2719:8: предупреждение: variable 
«__pyx_v__mssql_last_msg_severity» set but not used 
[-Wunused-but-set-variable]
_mssql.c:2718:8: предупреждение: variable 
«__pyx_v__mssql_last_msg_no» set but not used [-Wunused-but-set-variable]
_mssql.c: В функции «__pyx_f_6_mssql__tds_ver_str_to_constant»:
_mssql.c:13610:15: ошибка: «DBVERSION_71» undeclared (first use in this 
function)
_mssql.c:13610:15: замечание: each undeclared identifier is reported 
only once for each function it appears in
_mssql.c:13633:15: ошибка: «DBVERSION_72» undeclared (first use in this 
function)
error: command 'gcc' failed with exit status 1

My system: Kubuntu 11.10 32 bit with all updates and default ubuntu packages:
Python - 2.7.2
Cython - 1.14.1
FreeTDS - 0.82

Original issue reported on code.google.com by tonal.pr...@gmail.com on 19 Oct 2011 at 4:41

GoogleCodeExporter commented 9 years ago
Thanks for the report.  I noticed in the source package that I forgot to add 
the pre-built libary and header for 32 bit systems.  I have pushed the changes 
to HG and uploaded a new source package:

http://code.google.com/p/pymssql/downloads/detail?name=pymssql-2.0.0b1-dev-20111
019.tar.gz&can=2&q=#makechanges

A few other thoughts:

* I'd recommend that you use the latest Cython version.  If you are concerned 
about conflicts with other projects, use a virtualenv.
* The fact that you have FreeTDS 0.82 installed may be a problem when building 
from source.  The library from your installed version of FreeTDS may be used 
instead of the one packaged with pymssql.  If that is the case, then you will 
continue to receive "DBVERSION_71 undeclared" references because 0.82 didn't 
have those symbols defined.

Original comment by rsyr...@gmail.com on 19 Oct 2011 at 5:26

GoogleCodeExporter commented 9 years ago
[root@ris pymssql-2.0.0b1-dev-20111019]# PATH=/opt/python2.7/bin:$PATH python
Python 2.6.7 (r267:88850, Oct 21 2011, 13:39:51)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_mssql.pxd", line 10, in init pymssql (pymssql.c:8589)
    cdef class MSSQLConnection:
ImportError: 
/opt/python2.7/lib/python2.6/site-packages/pymssql-2.0.0b1_dev_20111019-py2.6-li
nux-i686.egg/_mssql.so: undefined symbol: __asprintf_chk

python setup.py build and install ok, but when I try to import pymssql I 
receive those errors :(

Original comment by VL.Var...@gmail.com on 21 Oct 2011 at 11:15

GoogleCodeExporter commented 9 years ago
you say your are building it, but you are actually installing the egg, is that 
correct?  You are on an older version of Red Hat, so my guess is that its a GCC 
incompatibility.  Have you tried building from source?

Original comment by randy.sy...@lev12.com on 21 Oct 2011 at 4:15

GoogleCodeExporter commented 9 years ago
1. Centos 5.7 have very old python - 2.4, so I download latest 2.6 release
2. Compile him from sources, add easy_install, add cython
3. If I try to compile pymssql-2.0.0b1-dev-20111019 from tarball from this 
site, I have error messages written above (ImportError: 
/opt/python2.7/lib/python2.6/site-packages/pymssql-2.0.0b1_dev_20111019-py2.6-li
nux-i686.egg/_mssql.so: undefined symbol: __asprintf_chk) after import pymssql.
4. If I compile freetds latest version from source and symlinked their include 
and lib to freetds/unix_32/lib and include - I compile pymssql okay, import 
pymssql okay, but have trouble with execute stored procedure:

Traceback (most recent call last):
  File "testpymssql.py", line 3, in <module>
    conn  = pymssql.connect(server='dbsocial', user='user', password='************',as_dict=True)
  File "pymssql.pyx", line 552, in pymssql.connect (pymssql.c:7162)
    raise InterfaceError(e[0])
pymssql.InterfaceError: Connection to the database failed for an unknown reason.
[root@ris adm]# joe testpymssql.py
Processing '/etc/joe/joerc'...Processing '/etc/joe/ftyperc'...done
done

import pymssql

conn=pymssql.connect(host='dbsocial',user='user',password='****',database='gamed
ata',as_dict=True)
cur = conn.cursor()
cur.callproc('gamedata.dbo.usp_GetBSStats')

Original comment by VL.Var...@gmail.com on 24 Oct 2011 at 11:23

GoogleCodeExporter commented 9 years ago
tsql connects and return data okay with this creditionals

Original comment by VL.Var...@gmail.com on 24 Oct 2011 at 11:38

GoogleCodeExporter commented 9 years ago
Unfortunately, I'm going to need someone to help with issues related to the 
static library builds.  I'm really not sure what is going on there, I don't do 
that much C programming.

Concerning your attempt to connect after compiling from source:

A) make sure you delete the pre-compiled libraries in the source archive, just 
to avoid conflics
B) please use FreeTDS config logging to make sure you are connecting with the 
credentials you think you are connecting with:

www.freetds.org/userguide/logging.htm

Original comment by rsyr...@gmail.com on 24 Oct 2011 at 2:11

GoogleCodeExporter commented 9 years ago
subject: my issue fixed

problem was: old lib found in /usr/lib/libsybdb.so.5 (old freetds lib version  
0.64)

how it may discovered: enable freetds logging by $ export 
TDSDUMP=/tmp/freetds.log and very carefully examine results. In my case I 
wondered that freetds says me my server not found even its have in freetds.conf 
file, and first line of trace file says what freetds version used

How to fix: carefully remove old freetds version (e.g. /usr/lib/libsybdb.so.5 
file), 
compile last freetds (I use ./configure --with-tdsver=7.1 --enable-msdblib)
ensure resulting lib be found in ldconfig path ( I symlinked 
/usr/local/lib/libsybdb.so.5 to /usr/lib/libsybdb.so.5 ( command is "ln -s 
/usr/local/lib/libsybdb.so.5 /usr/lib/libsybdb.so.5" and rerun ldconfig). Check 
ldconfig cache for currect lib:
 ldconfig -p | grep  libsybdb.so.5
        libsybdb.so.5 (libc6) => /usr/lib/libsybdb.so.5
Grab last pymssql tarball, untar it
cd to freetds/nix_(your arch) in my case  - 
pymssql-2.0.0b1-dev-20111019/freetds/nix_32
remove include and lib dirs, create symlinks to include and lib directory to 
freetds source dir. In my case result sounds like:
# ls -la
lrwxrwxrwx 1 root root   18 Oct 24 18:27 include -> /usr/local/include
lrwxrwxrwx 1 root root   14 Oct 24 18:27 lib -> /usr/local/lib
(I compile freetds without any --predix options)
Ensure you using correct python, cyphon and easy install modules
I use:
PATH=/opt/python2.7/bin:$PATH python setup.py clean
PATH=/opt/python2.7/bin:$PATH python setup.py build
PATH=/opt/python2.7/bin:$PATH python setup.py install

After that import pymssql and other code works fine. As additional you can set 
TDSVER and FREETDS enviroment variable as explained at 
http://www.freetds.org/userguide/envvar.htm for ensure using correct 
freetds.conf file (my freetds.conf located in /usr/local/etc directory)

Original comment by VL.Var...@gmail.com on 25 Oct 2011 at 9:44

GoogleCodeExporter commented 9 years ago
Thanks for the follow-up report, glad you got it fixed.  FYI, w/ pymssql you 
should not need a freetds.conf file.

Resolving as fixed since we pushed new source to address the missing x86 
pre-compiled libraries. 

Original comment by rsyr...@gmail.com on 25 Oct 2011 at 2:47

GoogleCodeExporter commented 9 years ago
In tarball pymssql-2.0.0b1-dev-20111019.tar.gz, 64-bit build still has this 
problem. Possibly files in freetds/nix_64/* were not updated:

nix_32/lib:
-rw-r--r-- 1 1000 1000 1528394 Oct 18 06:21 libsybdb.a

nix_64/lib:
-rw-r--r-- 1 1000 1000 2169356 Oct 17 06:49 libsybdb.a

What worked for me (I have freetds 0.91-1.el5 installed):
1. rm freetds/nix_64/lib/libsybdb.a
2. ln -s /usr/lib64/libsybdb.so.5.0.0 /usr/lib64/libsybdb.so
3. python26 setup.py clean
4. python26 setup.py build
5. python26 setup.py install

Original comment by m.maly...@gmail.com on 6 Dec 2011 at 12:18