xmingw and f2py

F

Flavio

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
 
F

Flavio

Flavio said:
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
 
N

Nick Craig-Wood

Flavio said:
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/~mdehoon/software/python/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/cygwin/pexports-0.43/download_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
 
F

Flavio

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.
 
F

Flavio

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?
 
N

Nick Craig-Wood

Flavio said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top