472,353 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

xmingw and f2py

Hi,

has anyone tried to build extensions for win32 on Linux using xmingw?

I need to use f2py to compile code for the win32 platform and I want to
do this in Linux. I googled aroung but could not find any documentation
on this.

For those who dont know xmingw is a port to linux of mingw.

any help is appreciated.

Flávio

Sep 7 '06 #1
5 2213

Flavio wrote:
Hi,

has anyone tried to build extensions for win32 on Linux using xmingw?

I need to use f2py to compile code for the win32 platform and I want to
do this in Linux. I googled aroung but could not find any documentation
on this.

For those who dont know xmingw is a port to linux of mingw.

any help is appreciated.

Flávio
Since no one has responded so far, I decide to put some more data in
this thread to encourage some comments.

I have tried to compile the fortran code with the following line:

f2py -c --compiler=/opt/xmingw/bin/i386-mingw32msvc-gcc
--f77exec=opt/xmingw/bin/i386-mingw32msvc-g77 -m flib flib.f

the error I get is like so:

error: don't know how to compile C/C++ code on platform 'posix' with
'/opt/xmingw/bin/i386-mingw32msvc-gcc' compiler

any comments?

Flávio

Sep 7 '06 #2
Flavio <fc******@gmail.comwrote:
has anyone tried to build extensions for win32 on Linux using
xmingw?
I don't know about xmingw, but we use mingw on linux to compile stuff
for windows all the time. (We use the mingw package under debian)

We build extensions using mingw but linked to the link library of the
official python2.4 build.

Here are some instructions which you'll need to adapt to your setup

/misc/windows is a smb mounted windows machine

# Linking with the distributed python
#
# http://bonsai.ims.u-tokyo.ac.jp/~mde...on/cygwin.html
#
# On a windows machine
# install the latest windows python (2.4.3.msi) from www.python.org
# Copy the header files into the mingw installation
cp -av /misc/windows/Python24/include /usr/i586-mingw32msvc/include/python2.4
# Download pexports from here
# http://www.emmestech.com/software/cy..._pexports.html
# unpack pexports.exe
unzip pexports-0.43.zip
# Fetch python dll from the windows machine
cp -av /misc/windows/WINNT/system32/python24.dll .
# Extract the exported symbols
wine pexports python24.dll python24.def
# Create the link library
/usr/i586-mingw32msvc/bin/dlltool --dllname python24.dll --def python24.def --output-lib libpython2.4.a
# Move the files into the correct place
mv -i python24.dll python24.def libpython2.4.a /usr/i586-mingw32msvc/lib/

After that lot you can build python extensions with mingw under linux,
using -lpython2.4

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Sep 8 '06 #3
Thanks Nick,

It seems that xmingw package in gentoo is the same as the mingw on
debian, from the directory structure and executables you mention.

I'll give it a try and if works with f2py, I'll post a complete
tutorial after I am done for other people to follow.

Thanks a lot.
Nick Craig-Wood wrote:
Flavio <fc******@gmail.comwrote:
has anyone tried to build extensions for win32 on Linux using
xmingw?

I don't know about xmingw, but we use mingw on linux to compile stuff
for windows all the time. (We use the mingw package under debian)

We build extensions using mingw but linked to the link library of the
official python2.4 build.

Here are some instructions which you'll need to adapt to your setup

/misc/windows is a smb mounted windows machine

# Linking with the distributed python
#
# http://bonsai.ims.u-tokyo.ac.jp/~mde...on/cygwin.html
#
# On a windows machine
# install the latest windows python (2.4.3.msi) from www.python.org
# Copy the header files into the mingw installation
cp -av /misc/windows/Python24/include /usr/i586-mingw32msvc/include/python2.4
# Download pexports from here
# http://www.emmestech.com/software/cy..._pexports.html
# unpack pexports.exe
unzip pexports-0.43.zip
# Fetch python dll from the windows machine
cp -av /misc/windows/WINNT/system32/python24.dll .
# Extract the exported symbols
wine pexports python24.dll python24.def
# Create the link library
/usr/i586-mingw32msvc/bin/dlltool --dllname python24.dll --def python24.def --output-lib libpython2.4.a
# Move the files into the correct place
mv -i python24.dll python24.def libpython2.4.a /usr/i586-mingw32msvc/lib/

After that lot you can build python extensions with mingw under linux,
using -lpython2.4

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Sep 8 '06 #4
Hi Nick,

I followed the steps you describe exactly and I am still gettin this
error message when i try to compile.

here is the command I give:

f2py -c --compiler=/opt/xmingw/bin/i386-mingw32msvc-gcc
--f77exec=opt/xmingw/bi
n/i386-mingw32msvc-g77 -L /opt/xmingw/i386-mingw32msvc/lib/ -lpython2.4
-m flib flib.f

and this is the error:

copying
/usr/lib/python2.4/site-packages/numpy-1.0b5-py2.4-linux-i686.egg/numpy/f2py/src/fortranobject.c
-/tmp/tmpIkxhAr/src.linux-i686-2.4
copying
/usr/lib/python2.4/site-packages/numpy-1.0b5-py2.4-linux-i686.egg/numpy/f2py/src/fortranobject.h
-/tmp/tmpIkxhAr/src.linux-i686-2.4
adding '/tmp/tmpIkxhAr/src.linux-i686-2.4/flib-f2pywrappers.f' to
sources.
running build_ext
error: don't know how to compile C/C++ code on platform 'posix' with
'/opt/xmingw/bin/i386-mingw32msvc-gcc' compiler

any further suggestions?

Nick Craig-Wood wrote:
Flavio <fc******@gmail.comwrote:
has anyone tried to build extensions for win32 on Linux using
xmingw?

I don't know about xmingw, but we use mingw on linux to compile stuff
for windows all the time. (We use the mingw package under debian)

We build extensions using mingw but linked to the link library of the
official python2.4 build.

Here are some instructions which you'll need to adapt to your setup

/misc/windows is a smb mounted windows machine

# Linking with the distributed python
#
# http://bonsai.ims.u-tokyo.ac.jp/~mde...on/cygwin.html
#
# On a windows machine
# install the latest windows python (2.4.3.msi) from www.python.org
# Copy the header files into the mingw installation
cp -av /misc/windows/Python24/include /usr/i586-mingw32msvc/include/python2.4
# Download pexports from here
# http://www.emmestech.com/software/cy..._pexports.html
# unpack pexports.exe
unzip pexports-0.43.zip
# Fetch python dll from the windows machine
cp -av /misc/windows/WINNT/system32/python24.dll .
# Extract the exported symbols
wine pexports python24.dll python24.def
# Create the link library
/usr/i586-mingw32msvc/bin/dlltool --dllname python24.dll --def python24.def --output-lib libpython2.4.a
# Move the files into the correct place
mv -i python24.dll python24.def libpython2.4.a /usr/i586-mingw32msvc/lib/

After that lot you can build python extensions with mingw under linux,
using -lpython2.4

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Sep 8 '06 #5
Flavio <fc******@gmail.comwrote:
I followed the steps you describe exactly and I am still gettin this
error message when i try to compile.

here is the command I give:

f2py -c --compiler=/opt/xmingw/bin/i386-mingw32msvc-gcc
n/i386-mingw32msvc-g77 -L /opt/xmingw/i386-mingw32msvc/lib/ -lpython2.4
-m flib flib.f

and this is the error:

copying
/usr/lib/python2.4/site-packages/numpy-1.0b5-py2.4-linux-i686.egg/numpy/f2py/src/fortranobject.c
-/tmp/tmpIkxhAr/src.linux-i686-2.4
copying
/usr/lib/python2.4/site-packages/numpy-1.0b5-py2.4-linux-i686.egg/numpy/f2py/src/fortranobject.h
-/tmp/tmpIkxhAr/src.linux-i686-2.4
adding '/tmp/tmpIkxhAr/src.linux-i686-2.4/flib-f2pywrappers.f' to
sources.
running build_ext
error: don't know how to compile C/C++ code on platform 'posix' with
'/opt/xmingw/bin/i386-mingw32msvc-gcc' compiler

any further suggestions?
That looks like a distutils error.

We don't use distutils to build our stuff and I haven't really used it
before so I can't help you there.

You want to tell distutils that the compiler is just gcc somehow and
takes the same options. Not sure how you do that.

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Sep 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Markus Faust | last post by:
Hi, I'm trying to link Fortran files generated with “Compaq Visual Fortran Optimizing Compiler Version 6.6 (Update B)” under “Enthought Edition...
6
by: M. Faust | last post by:
Hi, after having installed F2PY-2.43.239_1806 I get the following error when trying to run the hello.f example from the /docs directory: ...
0
by: Carl | last post by:
I have been experimenting with f2py and some fortran code that I want to port to Python. I have the following fortran file (TEST_00.f): C...
6
by: Sile | last post by:
Hello, I'm trying to get f2py working from the command line on windows XP. I have mingw32 as my C complier (after some advice on a previous thread)...
5
by: Tyler | last post by:
Hello All: Since my last post I have attempted to use the f2py program which comes with numpy. I am able to create a <module_name>.so file fine;...
1
by: Blubaugh, David A. | last post by:
Pauli, Yes, I am utilizing the windows environment. I cannot install f2py. I obtain the following error when I try to execute the...
0
by: Blubaugh, David A. | last post by:
Sir, Thank you for your reply. This is as to how I developed my .pyd file. I entered the following commands within my MS-DOS prompt within...
0
by: Gabriel Genellina | last post by:
En Sun, 21 Sep 2008 19:42:10 -0300, Blubaugh, David A. <dblubaugh@belcan.comescribió: Below there is a transcript of a compile session. I've...
1
by: bkamrani | last post by:
Hi Python gurus, I have installed numpy and interested in testing f2py module using the first example in the documentation. First I tried: ...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.