|
From: Francisco D. S. <fra...@ho...> - 2011-10-25 13:19:28
|
From: dikshie <dikshie@gm...> - 2011-08-17 11:57
>Hi,
>I got this error message when compile python-sybase with mingw32.
>
>"-LC:\Program Files\Python27\PCbuild" -lblk -lct -lcs -lpython27
>-lmsvcr90 -o bu ild\lib.win32-2.7\sybasect.pyd
>//mfauzie1$/personal/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lblk
>//mfauzie1$/personal/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lct
>//mfauzie1$/personal/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lcs
>collect2: ld returned 1 exit status
>error: command 'gcc' failed with exit status 1
>I tried with
> syb_libs = ['libblk', 'libct', 'libcs']
>and
> syb_libs = ['blk', 'ct', 'cs']
>get same error messages.
>I am using python-sybase-0.40pre1.tar.gz on windows xp.
Here my quick and dirty hack to build python-sybase-0.40pre1 with mingw32 for Sybase OCS-15_0 and Python 2.7.2 on windows 7 :-)
1) Make mingw the default compiler.
In your Python installation directory change in Lib\distutils\ccompiler.py (tuple _default_compilers around line 952)
# OS name mappings
('nt', 'mingw32')
2) The sybase library name have changed to avoid possible name conflict, they have a syb prefixe in their name.
In python-sybase-0.40 directory change the setup.py file (line 110)
syb_libs = ['libsybblk', 'libsybct', 'libsybcs']
3) Now the compilation work but link fails with unresolved symbol, I must add the sybase dll directory for setup.py to work.
I made a dirty change on setup.py, there's probably a better and more elegant solution but it works for me ;-)
I added line 124 a new directory variable :
syb_dlldir = os.path.join(sybase, 'dll')
And I changed near the end (line 267) and added this variable :
library_dirs=[syb_libdir, syb_dlldir],
Hope that's will help others.
Francisco.
|