> mingw_helpers.o): In function `_encode_pointer':
> c:\bb\vista64-mingw32\mingw-x86-x86_64\build\build\mingw\obj/../../../
> build/mingw/mingw-w64-crt/crt/mingw_helpers.c:26: multiple definition
> of `_encode_pointer'
> c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-
> w64-mingw32/lib/../lib/libmsvcr90.a(dwpfs00311.o):(.text+0x0): first
> defined
> here
> collect2: ld returned 1 exit status
> error: command 'gcc' failed with exit status 1
>
> Any hint is appreciated
please don't download the .def files linked from the cython wiki. use
gendef[1] instead (i.e. your libpython26.a is currently broken).
I also had to adapt cygwinccompiler to *not* link with MSVCRT90. Our
tests did fail intermittently when linking with that, importing a mingw
compiled c extension did fail immediately when running under gdb.
However we did use tdm gcc 4.5.1, YMMV.
[1] http://sourceforge.net/apps/trac/mingw-w64/wiki/gendef
Hope that's enough to get you started,
Cheers,
- Ralf
> Thanks for your help.
>
> I installed tdm64-gcc-4.5.2.exe for 64-bit compilation
> I prepared a new .def file with 'gendef.exe python26.dll' and produced
> a new libpython26.a, that I placed in the python26/libs folder.
> I eliminated the link to MSVCRT90, as you indicated, by returning an
> empty list from the get_msvcr() function in cygwinccompiler (although
> I do not understand what the implications of this action are for the
> extension...)
>
> Then I ran python setup.py build_ext --inplace with no errors, and my
> hello2.pyd file was produced!
> However when I try to import it I get:
>
>>>> from mython import hello2
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: DLL load failed: No se encontr¾ el proceso especificado.
>
> (in english: ImportError: DLL load failed: specified procedure could
> not be found.)
>
> Any hint?
yes: apply the patch from http://bugs.python.org/issue4709
(sorry, I did forget that one).
Cheers,
- Ralf
> Thanks for your help.
>
> I installed tdm64-gcc-4.5.2.exe for 64-bit compilation
> I prepared a new .def file with 'gendef.exe python26.dll' and produced
> a new libpython26.a, that I placed in the python26/libs folder.
> I eliminated the link to MSVCRT90, as you indicated, by returning an
> empty list from the get_msvcr() function in cygwinccompiler (although
> I do not understand what the implications of this action are for the
> extension...)
Start gdb with with "gdb python", then start python inside gdb with "r",
then import your c extension with "import my_extension".
Doing that without linking with MSVCRT90 works flawlessly.
Doing that with the extension linked with MSVCRT90 results in a
segmentation fault. If you use extension linked with MSVCRT90 you will
get intermittent segfaults (at least we did get them). It's no fun.
Cheers,
- Ralf
> I understand from your answer that I should apply the patch for pyconfig.h
> and compile python26 from source.
> Is this right?
no, just patch the file in your python installation directory. Or you
could compile with MS_WIN64 defined on the command line.
Could you update the wiki to point to this (with the relevant
instructions) instead? Thanks.