Re: problem compiling extensions with mingw

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eliben

    Re: problem compiling extensions with mingw

    On Jun 27, 3:10 pm, eliben <eli...@gmail.c omwrote:
    Hello,
    I'm trying to compile the minimal example fromhttp://en.wikibooks.or g/wiki/Python_Programm ing/Extending_with_ Cwith
    MinGW (latest version) and Python 2.5 (latest ActiveState binary
    install). When running the setup file, the following happens:
    >
    running build
    running build_ext
    building 'hello' extension
    writing build\temp.win3 2-2.5\Release\hel lo.def
    d:\mingw\bin\gc c.exe -mno-cygwin -shared -s build
    \temp.win32-2.5\Release\hel lomo
    dule.o build\temp.win3 2-2.5\Release\hel lo.def -LC:\Python25\li bs -LC:
    \Python25\P
    Cbuild -lpython25 -lmsvcr71 -o build\lib.win32-2.5\hello.pyd
    build\temp.win3 2-2.5\Release\hel lomodule.o:hell omodule.c:(.tex t+0x3e):
    undefined
    reference to `_imp___Py_None Struct'
    build\temp.win3 2-2.5\Release\hel lomodule.o:hell omodule.c:(.tex t+0x46):
    undefined
    reference to `_imp___Py_None Struct'
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    >
    What's more, compiling the same extension with Visual Studio 2005
    (without using distutils) works fine, the extension is loaded and ran
    successfully from Python. Any ideas about this error ?
    >
    Eli
    Problem solved:

  • John Machin

    #2
    Re: problem compiling extensions with mingw

    On Jun 28, 3:41 pm, eliben <eli...@gmail.c omwrote:
    On Jun 27, 3:10 pm, eliben <eli...@gmail.c omwrote:
    >
    >
    >
    Hello,
    I'm trying to compile the minimal example fromhttp://en.wikibooks.or g/wiki/Python_Programm ing/Extending_with_ Cwith
    MinGW (latest version) and Python 2.5 (latest ActiveState binary
    install). When running the setup file, the following happens:
    >
    running build
    running build_ext
    building 'hello' extension
    writing build\temp.win3 2-2.5\Release\hel lo.def
    d:\mingw\bin\gc c.exe -mno-cygwin -shared -s build
    \temp.win32-2.5\Release\hel lomo
    dule.o build\temp.win3 2-2.5\Release\hel lo.def -LC:\Python25\li bs -LC:
    \Python25\P
    Cbuild -lpython25 -lmsvcr71 -o build\lib.win32-2.5\hello.pyd
    build\temp.win3 2-2.5\Release\hel lomodule.o:hell omodule.c:(.tex t+0x3e):
    undefined
    reference to `_imp___Py_None Struct'
    build\temp.win3 2-2.5\Release\hel lomodule.o:hell omodule.c:(.tex t+0x46):
    undefined
    reference to `_imp___Py_None Struct'
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    >
    What's more, compiling the same extension with Visual Studio 2005
    (without using distutils) works fine, the extension is loaded and ran
    successfully from Python. Any ideas about this error ?
    >
    Eli
    >
    Problem solved:http://eli.thegreenplace.net/2008/06...n-extensions-w...
    libpython2?.a is now *supplied* with the official CPython distribution
    from www.python.org.

    The procedure that you followed is described in the manual:


    Cheers,
    John

    Comment

    • eliben

      #3
      Re: problem compiling extensions with mingw

      On Jun 28, 8:20 am, John Machin <sjmac...@lexic on.netwrote:
      On Jun 28, 3:41 pm, eliben <eli...@gmail.c omwrote:
      >
      >
      >
      On Jun 27, 3:10 pm, eliben <eli...@gmail.c omwrote:
      >
      Hello,
      I'm trying to compile the minimal example fromhttp://en.wikibooks.or g/wiki/Python_Programm ing/Extending_with_ Cwith
      MinGW (latest version) and Python 2.5 (latest ActiveState binary
      install). When running the setup file, the following happens:
      >
      running build
      running build_ext
      building 'hello' extension
      writing build\temp.win3 2-2.5\Release\hel lo.def
      d:\mingw\bin\gc c.exe -mno-cygwin -shared -s build
      \temp.win32-2.5\Release\hel lomo
      dule.o build\temp.win3 2-2.5\Release\hel lo.def -LC:\Python25\li bs -LC:
      \Python25\P
      Cbuild -lpython25 -lmsvcr71 -o build\lib.win32-2.5\hello.pyd
      build\temp.win3 2-2.5\Release\hel lomodule.o:hell omodule.c:(.tex t+0x3e):
      undefined
      reference to `_imp___Py_None Struct'
      build\temp.win3 2-2.5\Release\hel lomodule.o:hell omodule.c:(.tex t+0x46):
      undefined
      reference to `_imp___Py_None Struct'
      collect2: ld returned 1 exit status
      error: command 'gcc' failed with exit status 1
      >
      What's more, compiling the same extension with Visual Studio 2005
      (without using distutils) works fine, the extension is loaded and ran
      successfully from Python. Any ideas about this error ?
      >
      Eli
      >>
      libpython2?.a is now *supplied* with the official CPython distribution
      fromwww.python. org.
      >
      I'm using ActiveState's distribution, because I was told that it comes
      with more precompiled win32 goodies out of the box.
      The procedure that you followed is described in the manual:http://docs.python.org/inst/tweak-fl...62200000000000...
      >
      Thanks, I didn't notice it :-)

      Eli



      Comment

      Working...