Ticket #438 (closed defect: fixed)
extension modules on x86_64 fail, march is set to i686
| Reported by: | tovrstra | Owned by: | cookedm |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0.2 Release |
| Component: | numpy.f2py | Version: | 1.0.1 |
| Keywords: | Cc: |
Description
When trying to compile this fortran example module into a python module:
MODULE test
IMPLICIT NONE
CONTAINS
FUNCTION add(a,b)
REAL(8),INTENT(IN) :: a,b
REAL(8) :: add
add = a+b
END FUNCTION
END MODULE
with f2py:
f2py -c test.f90
on my x86-64 box, I get the following output:
toon@dropklop:~/$ f2py -c test.f90
running build
running config_fc
running build_src
building extension "untitled" sources
f2py options: []
f2py:> /tmp/tmpus7JnZ/src.linux-x86_64-2.4/untitledmodule.c
creating /tmp/tmpus7JnZ
creating /tmp/tmpus7JnZ/src.linux-x86_64-2.4
Reading fortran codes...
Reading file 'test.f90' (format:free)
Post-processing...
Block: untitled
Block: test
Block: add
Post-processing (stage 2)...
Block: untitled
Block: unknown_interface
Block: test
Block: add
Building modules...
Building module "untitled"...
Constructing F90 module support for "test"...
Creating wrapper for Fortran function "add"("add")...
Constructing wrapper function "test.add"...
add = add(a,b)
Wrote C/API module "untitled" to file "/tmp/tmpus7JnZ/src.linux-x86_64-2.4/untitledmodule.c"
Fortran 90 wrappers are saved to "/tmp/tmpus7JnZ/src.linux-x86_64-2.4/untitled-f2pywrappers2.f90"
adding '/tmp/tmpus7JnZ/src.linux-x86_64-2.4/fortranobject.c' to sources.
adding '/tmp/tmpus7JnZ/src.linux-x86_64-2.4' to include_dirs.
copying /usr/lib/python2.4/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmpus7JnZ/src.linux-x86_64-2.4
copying /usr/lib/python2.4/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmpus7JnZ/src.linux-x86_64-2.4
adding '/tmp/tmpus7JnZ/src.linux-x86_64-2.4/untitled-f2pywrappers2.f90' to sources.
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
Could not locate executable g77
Could not locate executable f77
customize GnuFCompiler
Could not locate executable ifort
Could not locate executable ifc
Could not locate executable ifort
Could not locate executable efort
Could not locate executable efc
Could not locate executable ifort
Could not locate executable efort
Could not locate executable efc
customize IntelFCompiler
customize LaheyFCompiler
customize PGroupFCompiler
customize AbsoftFCompiler
customize NAGFCompiler
customize VastFCompiler
customize GnuFCompiler
customize CompaqFCompiler
customize IntelItaniumFCompiler
customize IntelEM64TFCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'untitled' extension
compiling C sources
C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC
creating /tmp/tmpus7JnZ/tmp
creating /tmp/tmpus7JnZ/tmp/tmpus7JnZ
creating /tmp/tmpus7JnZ/tmp/tmpus7JnZ/src.linux-x86_64-2.4
compile options: '-I/tmp/tmpus7JnZ/src.linux-x86_64-2.4 -I/usr/lib/python2.4/site-packages/numpy/core/include -I/usr/include/python2.4 -c'
gcc: /tmp/tmpus7JnZ/src.linux-x86_64-2.4/untitledmodule.c
gcc: /tmp/tmpus7JnZ/src.linux-x86_64-2.4/fortranobject.c
compiling Fortran 90 module sources
Fortran f77 compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops -march=i686 -mmmx -msse2 -msse -fomit-frame-pointer
Fortran f90 compiler: /usr/bin/gfortran -Wall -fno-second-underscore -fPIC -O3 -funroll-loops -march=i686 -mmmx -msse2 -msse -fomit-frame-pointer
Fortran fix compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -Wall -fno-second-underscore -fPIC -O3 -funroll-loops -march=i686 -mmmx -msse2 -msse -fomit-frame-pointer
compile options: '-I/tmp/tmpus7JnZ/src.linux-x86_64-2.4 -I/usr/lib/python2.4/site-packages/numpy/core/include -I/usr/include/python2.4 -c'
extra options: '-J/tmp/tmpus7JnZ/ -I/tmp/tmpus7JnZ/'
gfortran:f90: test.f90
test.f90:0: error: CPU you selected does not support x86-64 instruction set
test.f90:0: error: CPU you selected does not support x86-64 instruction set
test.f90:0: error: CPU you selected does not support x86-64 instruction set
test.f90:0: error: CPU you selected does not support x86-64 instruction set
error: Command "/usr/bin/gfortran -Wall -fno-second-underscore -fPIC -O3 -funroll-loops -march=i686 -mmmx -msse2 -msse -fomit-frame-pointer -I/tmp/tmpus7JnZ/src.linux-x86_64-2.4 -I/usr/lib/python2.4/site-packages/numpy/core/include -I/usr/include/python2.4 -c -c test.f90 -o /tmp/tmpus7JnZ/test.o -J/tmp/tmpus7JnZ/ -I/tmp/tmpus7JnZ/" failed with exit status 1
It seems that f2py is not correctly recognizing the cpu architecture. i.e. the compiler option -march=i686 is wrong. As a workaround, one can simply disable the architecture optimization:
FARCH='' f2py -c test.f90
Change History
Note: See
TracTickets for help on using
tickets.
