Linking issues when building cython

1,006 views
Skip to first unread message

Corrin Meyer

unread,
May 26, 2015, 12:46:22 PM5/26/15
to cython...@googlegroups.com
I am having an issue when trying to install Cython on Windows 7.

I have a fresh install of Python 2.7.10, open a 'cmd' window and then try to install cython using the command 'pip install cython'.  It tries to build and apparently link the C-extensions but ends with the following error:

C:\Programs\mingw-w64\i686-4.9.2-posix-dwarf-rt_v4-rev2\mingw32\bin\gcc.exe -shared -s c:\users\corrin~1\appdata\local\temp\pip-build-srrbvr\cython\cython\plex\scanners.o c:\users\corrin~1\appdata\local\temp\pip-build-srrbvr\cython\cython\plex\Scanners.def -LC:\Python27\libs -LC:\Python27\PCbuild -lpython27 -lmsvcr90 -o build\lib.win32-2.7\Cython\Plex\Scanners.pyd
C:\Python27\libs/libpython27.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\Programs\\mingw-w64\\i686-4.9.2-posix-dwarf-rt_v4-rev2\\mingw32\\bin\\gcc.exe' failed with exit status 1

I am using the 32-bit version of Python 2.7.10 and the 32-bit mingw-builds version of mingw-w64 (GCC 4.9.2 for i686, posix threads, dwarf exception handling, build revision 2).  I have created a 'C:\Python27\Libs\distutils\distutils.cfg' file with the contents:

[build]
compiler=mingw32

I have also tried the vanilla MinGW compiler and several different version of the mingw-build compiler for GCC 4.9.2. with varying results.  Of particular interest, with vanilla MinGW it skips 'libpython27.a' as incompatible and tries 'python27.lib' instead.  At this point I am at a loss for what is going on or wrong here.  Additionally, there doesn't seem to be any relatively current information on building Cython for windows (or for python c-extensions in general).

Chris Barker

unread,
May 26, 2015, 1:02:54 PM5/26/15
to cython-users
On Tue, May 26, 2015 at 9:05 AM, Corrin Meyer <corrin...@gmail.com> wrote:
 Additionally, there doesn't seem to be any relatively current information on building Cython for windows (or for python c-extensions in general).

the current state of affairs is that it's easiest to use the MS compiler -- specifically the one here:


then make sure to use setuptools, rather than raw distutils (or pip) to compile, and you should be good to go.

And yes, you should be able to use mingw -- particularly for 32 bit, but that is a bit of a moving target...

-CHB


 

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
0 new messages