On Wed, Sep 30, 2009 at 3:52 PM, Stuart Axon <[email protected]> wrote:
> I might give this a go if I can't do it manually, I was hoping to avoid 
> changing
> the setup.py of the project until I had got some part of it working with
> cython already.
>

Stuart, you likely have to add a single line (perhaps two) when the
setup() function is called inside your setup.py...


Please see how distutils is invoking the compiler and linker for my code:

C:\GCC\4.4.1\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-IC:\Program
Files\MPICH2\include" -IC:\Python26\include -IC:\Python26\PC -c
src/MPI.c -o build\temp.win32-2.6\Release\src\mpi.o

C:\GCC\4.4.1\bin\gcc.exe -mno-cygwin -shared -s
build\temp.win32-2.6\Release\src\mpi.o
build\temp.win32-2.6\Release\src\MPI.def "-LC:\Program
Files\MPICH2\lib" -LC:\Python26\libs -LC:\Python26\PCbuild -lmpi
-lpython26 -lmsvcr90 -o build\lib.win32-2.6\mpi4py\MPI.pyd

Do you know what all these flags are there for? I do not know for
certain, though I can guess, but anyway I do not bother.. I just
always follow a basic rule: until something new, better, portable AND
standard (in Py stdlib terms) appears, I use plain distutils (not even
setuptools)...



>
> ----- Original Message ----
> From: Lisandro Dalcin <[email protected]>
> To: [email protected]
> Sent: Wednesday, September 30, 2009 4:03:19 AM
> Subject: Re: [Cython] Manual gcc compile, can't find libpython25.a (I think)
>
> I do not have too much experience on Windows, but I think your should
> REALLY use a distutils's setup.py ... take a look here:
> http://www.python.org/doc/2.6.2/distutils/setupscript.html#describing-extension-modules
> ... You should might need to add stuff to the Extension constructor,
> like kw args include_dirs, library_dirs and libraries.
>
> Optionally, you can make distutils to default to use MinGW adding  a
> setup.cfg file alongside your setup.py with this content:
>
> [build]
> compiler=mingw32
>
> If you follow my advice and next run "python setup.py build", the
> output in you console will show you that building ext modules on Win
> (actually, in any platfom) is not so easy, and special flags are
> needed...
>
> On Tue, Sep 29, 2009 at 11:38 PM, Stuart Axon <[email protected]> wrote:
>> Using the windows install and msys, I'm getting errors that look like
>>
>> This bit works fine
>> [C:\usr\shoebot\shoebot\core] set PINCLUDE=c:\usr\Python25\include\
>> [C:\usr\shoebot\shoebot\core] gcc -c -Ic:\usr\Python25\include\ 
>> cairo_canvas.c
>>
>>
>> I get errors here, how do I tell gcc that libpyt
>> [C:\usr\shoebot\shoebot\core]gcc -shared cairo_canvas.o 
>> -Lc:\usr\Python25\libs\libpython25.a -o cairo_canvas.dll
>> cairo_canvas.o:cairo_canvas.c:(.text+0x21): undefined reference to 
>> `_imp__PyObject_GetItem'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x63): undefined reference to 
>> `_imp__PyList_Type'
>> cairo_canvas.o:cairo_canvas.c:(.text+0xb3): undefined reference to 
>> `_imp__PyTuple_Type'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x12a): undefined reference to 
>> `_imp__PySequence_GetItem'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x142): undefined reference to 
>> `_imp__PyInt_FromLong'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x156): undefined reference to 
>> `_imp__PyLong_FromLongLong'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x1eb): undefined reference to 
>> `_imp__PyDict_Size'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x205): undefined reference to 
>> `_imp___Py_NoneStruct'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x20d): undefined reference to 
>> `_imp___Py_NoneStruct'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x215): undefined reference to 
>> `_imp___Py_NoneStruct'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x21d): undefined reference to 
>> `_imp___Py_NoneStruct'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x2a2): undefined reference to 
>> `_imp__PyDict_GetItem'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x2d7): undefined reference to 
>> `_imp__PyDict_GetItem'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x30d): undefined reference to 
>> `_imp__PyDict_GetItem'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x343): undefined reference to 
>> `_imp__PyDict_GetItem'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x379): undefined reference to 
>> `_imp__PyDict_GetItem'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x3af): more undefined references to 
>> `_imp__PyDict_GetItem' follow
>> cairo_canvas.o:cairo_canvas.c:(.text+0x467): undefined reference to 
>> `_imp___Py_NoneStruct'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x46f): undefined reference to 
>> `_imp___Py_NoneStruct'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x477): undefined reference to 
>> `_imp___Py_NoneStruct'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x47f): undefined reference to 
>> `_imp___Py_NoneStruct'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x5a6): undefined reference to 
>> `_imp__PyObject_GetAttr'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x618): undefined reference to 
>> `_imp__PyTuple_New'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x6ee): undefined reference to 
>> `_imp__PyObject_Call'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x7cb): undefined reference to 
>> `_imp__PyObject_SetAttr'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x814): undefined reference to 
>> `_imp__PyObject_SetAttr'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x8a7): undefined reference to 
>> `_imp__PyObject_GetAttr'
>> cairo_canvas.o:cairo_canvas.c:(.text+0x8eb): undefined reference to 
>> `_imp__PyTuple_New'
>> [....snipped]
>>
>>
>> Any idea what I'm doing wrong.
>>
>> Much obliged.
>>
>> S++
>>
>>
>>
>>
>> _______________________________________________
>> Cython-dev mailing list
>> [email protected]
>> http://codespeak.net/mailman/listinfo/cython-dev
>>
>
>
>
> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>
>
>
>
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to