Building external c modules with mingw64 / numpy
![](https://secure.gravatar.com/avatar/0a09c521207a69414a3b61fc73002fe8.jpg?s=120&d=mm&r=g)
Dear all, I built an external c-module (pygsl) using mingw 64 from msys2 mingw64-gcc compiler. This built required some changes to numpy.distutils to get the “python setup.py config” and “python setup.py build” working. In this process I replaced 2 files in numpy.distutils from numpy git repository: - numpy.dist_utils.misc_utils.py version ec0e046 <https://github.com/numpy/numpy/commit/ec0e04694278ef9ea83537d308b07fc27c1b5f...> on 14 Dec 2016 - numpy.dist_utils. mingw32ccompiler.py version ec0e046 <https://github.com/numpy/numpy/commit/ec0e04694278ef9ea83537d308b07fc27c1b5f...> on 14 Dec 2016 mingw32ccompiler.py required to be modified to get it work n preprocessor had to be defined as I am using setup.py config n specifying the runtime library search path to the linker n include path of the vcrtruntime I attached a patch reflecting the changes I had to make to file mingw32ccompile.py If this information is useful I am happy to answer questions Sincerely yours Pierre PS Version infos: Python: Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Numpy:
gcc.exe (Rev2, Built by MSYS2 project) 6.2.0 ________________________________ Helmholtz-Zentrum Berlin für Materialien und Energie GmbH Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V. Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking Sitz Berlin, AG Charlottenburg, 89 HRB 5583 Postadresse: Hahn-Meitner-Platz 1 D-14109 Berlin http://www.helmholtz-berlin.de
![](https://secure.gravatar.com/avatar/5f88830d19f9c83e2ddfd913496c5025.jpg?s=120&d=mm&r=g)
On Sat, Jan 21, 2017 at 9:23 PM, Schnizer, Pierre < pierre.schnizer@helmholtz-berlin.de> wrote:
Thanks for the patch Pierre. For future reference: a pull request on GitHub or a link to a Gist is preferred for us and usually gets you a response quicker. Regarding your question in the patch on including Python's install directory: that shouldn't be necessary, and I'd be wary of applying your patch without understanding why the current numpy.distutils code doesn't work for you. But if your patch works for you then it can't hurt I think. Cheers, Ralf
![](https://secure.gravatar.com/avatar/0a09c521207a69414a3b61fc73002fe8.jpg?s=120&d=mm&r=g)
Dear Ralf, I made some further improvements as one problem was related to my setup file. I will use numpy git repository to cross check it and then report again. Sincerely yours Pierre Von: NumPy-Discussion [mailto:numpy-discussion-bounces@scipy.org] Im Auftrag von Ralf Gommers Gesendet: Dienstag, 14. Februar 2017 11:00 An: Discussion of Numerical Python <numpy-discussion@scipy.org> Betreff: Re: [Numpy-discussion] Building external c modules with mingw64 / numpy On Sat, Jan 21, 2017 at 9:23 PM, Schnizer, Pierre <pierre.schnizer@helmholtz-berlin.de<mailto:pierre.schnizer@helmholtz-berlin.de>> wrote: Dear all, I built an external c-module (pygsl) using mingw 64 from msys2 mingw64-gcc compiler. This built required some changes to numpy.distutils to get the “python setup.py config” and “python setup.py build” working. In this process I replaced 2 files in numpy.distutils from numpy git repository: - numpy.dist_utils.misc_utils.py<http://numpy.dist_utils.misc_utils.py> version ec0e046 <https://github.com/numpy/numpy/commit/ec0e04694278ef9ea83537d308b07fc27c1b5f...> on 14 Dec 2016 - numpy.dist_utils. mingw32ccompiler.py version ec0e046 <https://github.com/numpy/numpy/commit/ec0e04694278ef9ea83537d308b07fc27c1b5f...> on 14 Dec 2016 mingw32ccompiler.py required to be modified to get it work • preprocessor had to be defined as I am using setup.py config • specifying the runtime library search path to the linker • include path of the vcrtruntime I attached a patch reflecting the changes I had to make to file mingw32ccompile.py If this information is useful I am happy to answer questions Thanks for the patch Pierre. For future reference: a pull request on GitHub or a link to a Gist is preferred for us and usually gets you a response quicker. Regarding your question in the patch on including Python's install directory: that shouldn't be necessary, and I'd be wary of applying your patch without understanding why the current numpy.distutils code doesn't work for you. But if your patch works for you then it can't hurt I think. Cheers, Ralf Sincerely yours Pierre PS Version infos: Python: Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Numpy:
gcc.exe (Rev2, Built by MSYS2 project) 6.2.0 ________________________________ Helmholtz-Zentrum Berlin für Materialien und Energie GmbH Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V. Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking Sitz Berlin, AG Charlottenburg, 89 HRB 5583 Postadresse: Hahn-Meitner-Platz 1 D-14109 Berlin http://www.helmholtz-berlin.de _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org<mailto:NumPy-Discussion@scipy.org> https://mail.scipy.org/mailman/listinfo/numpy-discussion ________________________________ Helmholtz-Zentrum Berlin für Materialien und Energie GmbH Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V. Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking Sitz Berlin, AG Charlottenburg, 89 HRB 5583 Postadresse: Hahn-Meitner-Platz 1 D-14109 Berlin http://www.helmholtz-berlin.de
![](https://secure.gravatar.com/avatar/5f88830d19f9c83e2ddfd913496c5025.jpg?s=120&d=mm&r=g)
On Sat, Jan 21, 2017 at 9:23 PM, Schnizer, Pierre < pierre.schnizer@helmholtz-berlin.de> wrote:
Thanks for the patch Pierre. For future reference: a pull request on GitHub or a link to a Gist is preferred for us and usually gets you a response quicker. Regarding your question in the patch on including Python's install directory: that shouldn't be necessary, and I'd be wary of applying your patch without understanding why the current numpy.distutils code doesn't work for you. But if your patch works for you then it can't hurt I think. Cheers, Ralf
![](https://secure.gravatar.com/avatar/0a09c521207a69414a3b61fc73002fe8.jpg?s=120&d=mm&r=g)
Dear Ralf, I made some further improvements as one problem was related to my setup file. I will use numpy git repository to cross check it and then report again. Sincerely yours Pierre Von: NumPy-Discussion [mailto:numpy-discussion-bounces@scipy.org] Im Auftrag von Ralf Gommers Gesendet: Dienstag, 14. Februar 2017 11:00 An: Discussion of Numerical Python <numpy-discussion@scipy.org> Betreff: Re: [Numpy-discussion] Building external c modules with mingw64 / numpy On Sat, Jan 21, 2017 at 9:23 PM, Schnizer, Pierre <pierre.schnizer@helmholtz-berlin.de<mailto:pierre.schnizer@helmholtz-berlin.de>> wrote: Dear all, I built an external c-module (pygsl) using mingw 64 from msys2 mingw64-gcc compiler. This built required some changes to numpy.distutils to get the “python setup.py config” and “python setup.py build” working. In this process I replaced 2 files in numpy.distutils from numpy git repository: - numpy.dist_utils.misc_utils.py<http://numpy.dist_utils.misc_utils.py> version ec0e046 <https://github.com/numpy/numpy/commit/ec0e04694278ef9ea83537d308b07fc27c1b5f...> on 14 Dec 2016 - numpy.dist_utils. mingw32ccompiler.py version ec0e046 <https://github.com/numpy/numpy/commit/ec0e04694278ef9ea83537d308b07fc27c1b5f...> on 14 Dec 2016 mingw32ccompiler.py required to be modified to get it work • preprocessor had to be defined as I am using setup.py config • specifying the runtime library search path to the linker • include path of the vcrtruntime I attached a patch reflecting the changes I had to make to file mingw32ccompile.py If this information is useful I am happy to answer questions Thanks for the patch Pierre. For future reference: a pull request on GitHub or a link to a Gist is preferred for us and usually gets you a response quicker. Regarding your question in the patch on including Python's install directory: that shouldn't be necessary, and I'd be wary of applying your patch without understanding why the current numpy.distutils code doesn't work for you. But if your patch works for you then it can't hurt I think. Cheers, Ralf Sincerely yours Pierre PS Version infos: Python: Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Numpy:
gcc.exe (Rev2, Built by MSYS2 project) 6.2.0 ________________________________ Helmholtz-Zentrum Berlin für Materialien und Energie GmbH Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V. Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking Sitz Berlin, AG Charlottenburg, 89 HRB 5583 Postadresse: Hahn-Meitner-Platz 1 D-14109 Berlin http://www.helmholtz-berlin.de _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org<mailto:NumPy-Discussion@scipy.org> https://mail.scipy.org/mailman/listinfo/numpy-discussion ________________________________ Helmholtz-Zentrum Berlin für Materialien und Energie GmbH Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V. Aufsichtsrat: Vorsitzender Dr. Karl Eugen Huthmacher, stv. Vorsitzende Dr. Jutta Koch-Unterseher Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking Sitz Berlin, AG Charlottenburg, 89 HRB 5583 Postadresse: Hahn-Meitner-Platz 1 D-14109 Berlin http://www.helmholtz-berlin.de
participants (2)
-
Ralf Gommers
-
Schnizer, Pierre