MinGW and Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Srijit Kumar Bhadra

    MinGW and Python

    Is there any specific reason for not using MinGW to build the official
    distribution of Python for Win32?
    A quick Google search did not reveal the answer to my question. If a
    link is available, please post it.

    Best Regards,
    Srijit

  • Martin v. Löwis

    #2
    Re: MinGW and Python

    Srijit Kumar Bhadra wrote:[color=blue]
    > Is there any specific reason for not using MinGW to build the official
    > distribution of Python for Win32?[/color]

    What could be the reasons to use MinGW?

    As for reasons not to do that:
    - there is no build process available to do that
    - people building extensions to Python must be able to do so with
    Microsoft C++, since some of these extensions are written using MFC.
    - developing Python itself in Visual Studio is quite convenient; in
    particular, the debugger works "better" than gdb.

    Regards,
    Martin

    Comment

    • Josef Meile

      #3
      Re: MinGW and Python

      > Is there any specific reason for not using MinGW to build the official[color=blue]
      > distribution of Python for Win32?
      > A quick Google search did not reveal the answer to my question. If a
      > link is available, please post it.[/color]
      You may look at this thread:

      * E02 - Support for MinGW Open Source Compiler


      There was a big polemic and it is really long, but there are some useful
      posts there.

      Regards,
      Josef

      Comment

      • Robert Kern

        #4
        Re: MinGW and Python

        Martin v. Löwis wrote:[color=blue]
        > Srijit Kumar Bhadra wrote:
        >[color=green]
        >>Is there any specific reason for not using MinGW to build the official
        >>distributio n of Python for Win32?[/color]
        >
        > What could be the reasons to use MinGW?
        >
        > As for reasons not to do that:
        > - there is no build process available to do that
        > - people building extensions to Python must be able to do so with
        > Microsoft C++, since some of these extensions are written using MFC.
        > - developing Python itself in Visual Studio is quite convenient; in
        > particular, the debugger works "better" than gdb.[/color]

        - gcc does not optimize particularly well.

        --
        Robert Kern
        robert.kern@gma il.com

        "I have come to believe that the whole world is an enigma, a harmless enigma
        that is made terrible by our own mad attempt to interpret it as though it had
        an underlying truth."
        -- Umberto Eco

        Comment

        • Brian Elmegaard

          #5
          Re: MinGW and Python

          Robert Kern <robert.kern@gm ail.com> writes:
          [color=blue]
          > - gcc does not optimize particularly well.[/color]

          But well enough for other platforms.

          --
          Brian (remove the sport for mail)


          Comment

          • Robert Kern

            #6
            Re: MinGW and Python

            Brian Elmegaard wrote:[color=blue]
            > Robert Kern <robert.kern@gm ail.com> writes:
            >[color=green]
            >>- gcc does not optimize particularly well.[/color]
            >
            > But well enough for other platforms.[/color]

            Well, it tends to optimize just as poorly for other platforms, too. It's just
            frequently the only compiler widely available on those platforms. The goal of
            the gcc project is to provide a portable compiler, not one that generates the
            best code for any given platform. And in that goal, it succeeds remarkably well.

            --
            Robert Kern
            robert.kern@gma il.com

            "I have come to believe that the whole world is an enigma, a harmless enigma
            that is made terrible by our own mad attempt to interpret it as though it had
            an underlying truth."
            -- Umberto Eco

            Comment

            • Brian Elmegaard

              #7
              Re: MinGW and Python

              Robert Kern <robert.kern@gm ail.com> writes:
              [color=blue]
              > the gcc project is to provide a portable compiler, not one that
              > generates the best code for any given platform. And in that goal, it
              > succeeds remarkably well.[/color]

              Will a python program be slower on the same machine running windows
              compared to linux?

              What I don't understand is that it is not possible to distribute a
              python compiled with gcc for windows. The main reason I saw in this
              thread is that python uses mfc. So python requires api access, I
              guess.

              Once I asked about distutils here. The answer was that I had access to
              the source so I could just extend it. After messing around I found I
              couldn't because I don't have msvc.
              --
              Brian (remove the sport for mail)


              Comment

              • Martin v. Löwis

                #8
                Re: MinGW and Python

                Brian Elmegaard wrote:[color=blue]
                > What I don't understand is that it is not possible to distribute a
                > python compiled with gcc for windows. The main reason I saw in this
                > thread is that python uses mfc. So python requires api access, I
                > guess.[/color]

                You misunderstood. Python does not use MFC. PythonWin (for example)
                does. That has a lot of implications which are hard to understand
                if you are not familiar with Windows programming and the C library
                mess on Windows.

                It would certainly be possible to distribute a gcc-compiled python.
                However, what is the point in doing so? Cygwin already includes
                a gcc-compiled Python, for Windows:


                [color=blue]
                > Once I asked about distutils here. The answer was that I had access to
                > the source so I could just extend it. After messing around I found I
                > couldn't because I don't have msvc.[/color]

                That is simply not true. You can build the entire Python interpreter
                with Cygwin (but you don't need to, because there is a precompiled
                version), and you can build extensions for the python.org binary
                using MingW.

                Regards,
                Martin

                Comment

                • Robert Kern

                  #9
                  Re: MinGW and Python

                  Brian Elmegaard wrote:[color=blue]
                  > Robert Kern <robert.kern@gm ail.com> writes:
                  >[color=green]
                  >>the gcc project is to provide a portable compiler, not one that
                  >>generates the best code for any given platform. And in that goal, it
                  >>succeeds remarkably well.[/color]
                  >
                  > Will a python program be slower on the same machine running windows
                  > compared to linux?[/color]

                  Dunno. Depends on the machine. Depends on the program. Depends on how the
                  interpreter and any extension modules and underlying libraries were built.
                  Depends on which Linux and which Windows.

                  I'm sorry, but your question is a non sequitur. I don't understand its relevance
                  to this thread.
                  [color=blue]
                  > What I don't understand is that it is not possible to distribute a
                  > python compiled with gcc for windows. The main reason I saw in this
                  > thread is that python uses mfc. So python requires api access, I
                  > guess.[/color]

                  It is possible. People have done it.


                  [color=blue]
                  > Once I asked about distutils here.[/color]

                  Okay. Again, what's the relevance here?
                  [color=blue]
                  > The answer was that I had access to
                  > the source so I could just extend it. After messing around I found I
                  > couldn't because I don't have msvc.[/color]

                  I'm not sure why this matters since distutils is pure Python.

                  If you meant writing extension modules for Python instead of extending
                  distutils, then you're in luck! You can indeed build extension modules with
                  mingw for the standard Python distribution. Please see my post in the thread "MS
                  VC++ Toolkit 2003, where?".

                  --
                  Robert Kern
                  robert.kern@gma il.com

                  "I have come to believe that the whole world is an enigma, a harmless enigma
                  that is made terrible by our own mad attempt to interpret it as though it had
                  an underlying truth."
                  -- Umberto Eco

                  Comment

                  • Fredrik Lundh

                    #10
                    Re: MinGW and Python

                    Brian Elmegaard wrote
                    [color=blue][color=green]
                    > > the gcc project is to provide a portable compiler, not one that
                    > > generates the best code for any given platform. And in that goal, it
                    > > succeeds remarkably well.[/color]
                    >
                    > Will a python program be slower on the same machine running windows
                    > compared to linux?[/color]

                    a better optimizer usually results in programs that run faster, not slower.

                    </F>



                    Comment

                    • Brian Elmegaard

                      #11
                      Re: MinGW and Python

                      "Martin v. Löwis" <martin@v.loewi s.de> writes:
                      [color=blue]
                      > It would certainly be possible to distribute a gcc-compiled python.
                      > However, what is the point in doing so? Cygwin already includes
                      > a gcc-compiled Python, for Windows:[/color]

                      Interesting.
                      [color=blue]
                      > That is simply not true.[/color]

                      Actually, you answered me then too. I misunderstood after reading
                      http://sebsauvage.net/python/mingw.html.

                      Is the information on that page not correct? Has it never been?
                      [color=blue]
                      > You can build the entire Python interpreter with Cygwin (but you
                      > don't need to, because there is a precompiled version), and you can
                      > build extensions for the python.org binary using MingW.[/color]

                      Great, then I tend to agree that there is no reason for building it
                      with mingw.


                      --
                      Brian (remove the sport for mail)


                      Comment

                      • Brian Elmegaard

                        #12
                        Re: MinGW and Python

                        Robert Kern <robert.kern@gm ail.com> writes:
                        [color=blue]
                        > If you meant writing extension modules for Python instead of extending
                        > distutils,[/color]

                        I thought about extending distutils to make non-python installers. I
                        may have misunderstood the answers I got.


                        [color=blue]
                        > mingw for the standard Python distribution. Please see my post in the thread "MS
                        > VC++ Toolkit 2003, where?".[/color]

                        Thanks, I will.
                        --
                        Brian (remove the sport for mail)


                        Comment

                        • Brian Elmegaard

                          #13
                          Re: MinGW and Python

                          "Fredrik Lundh" <fredrik@python ware.com> writes:
                          [color=blue]
                          > a better optimizer usually results in programs that run faster, not slower.[/color]

                          Got it the wrong after some editing ;-(
                          --
                          Brian (remove the sport for mail)


                          Comment

                          • sturlamolden

                            #14
                            Re: MinGW and Python


                            Martin v. Löwis wrote:
                            [color=blue]
                            > - there is no build process available to do that[/color]

                            In MSYS:

                            $ ./configure --prefix=/c/mingw
                            $ make
                            $ make install

                            This should be obvious to any with Unix experience.

                            MinGW actually distribute precompiled Python binaries as well (in
                            MSYS-DTK).
                            [color=blue]
                            > - people building extensions to Python must be able to do so with
                            > Microsoft C++, since some of these extensions are written using MFC.[/color]

                            MinGW can compile MFC. Download Windows Platform SDK and you get the
                            MFC source.
                            [color=blue]
                            > - developing Python itself in Visual Studio is quite convenient; in
                            > particular, the debugger works "better" than gdb.[/color]

                            Eclipse is an excellent IDE that works with MinGW.

                            Comment

                            • sturlamolden

                              #15
                              Re: MinGW and Python


                              Robert Kern wrote:
                              [color=blue]
                              > - gcc does not optimize particularly well.[/color]

                              That is beyond BS. The more recent gcc releases optimize as well as any
                              commercial compiler. GCC 4 may even optimize better than MSVC.

                              GCC is the compiler used to build the Linux kernel and MacOSX. If it
                              can deal with this I say it can handle Python as well. My guess is you
                              will not notice any performance difference for the Python interpreter.
                              Doesn't Python run well on Linux? GCC is used to build Python on Linux.
                              MinGW is GCC. MinGW on Windows creates the same binary code as GCC on
                              Linux.

                              Comment

                              Working...