Maybe it is not processing the #include <petsc/finclude/petscdm.h>
as expected? Could you run with the -E option to see what it puts in for the include file? Barry > On Jan 18, 2018, at 9:56 AM, Aurelien Ponte <[email protected]> wrote: > > Hi, > I am trying to speed up with f2py part of a python code that depends on > petsc4py > and cannot compile the fortran library. > The error message are at the end of this message. > The code is found here: > https://github.com/apatlpo/qgsolver/tree/fwrapping/qgsolver > This attempt borrows heavily from petsc4py/demo/wrap-f2py. > The error 'Unexpected MODULE statement' does not get lot's of replies on > google unfortunately > Would you have any suggestions? > > thanks > aurélien > > > (petsc) br146-244:qgsolver aponte$ make > PYTHON=/Users/aponte/.miniconda3/envs/petsc/bin/python build > /Users/aponte/.miniconda3/envs/petsc/bin:/opt/local/bin:/opt/local/sbin:/Users/aponte/.miniconda3/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Library/TeX/texbin:/usr/local/bin:/Users/aponte/Installed/f90tohtml:/usr/local/mysql/bin:/Users/aponte/Tools/ftagshtml-0.520/bin:/usr/local/ferret/bin:/usr/local/bin:/Users/aponte/Installed/f90tohtml:/usr/local/mysql/bin:/Users/aponte/Tools/ftagshtml-0.520/bin:/usr/local/ferret/bin > /Users/aponte/.miniconda3/envs/petsc/bin/python > /bin/sh > env \ > F77="/opt/local/bin/mpif90-openmpi-gcc49" F77FLAGS="-Os -Os > -I/opt/local/include" \ > F90="/opt/local/bin/mpif90-openmpi-gcc49" F90FLAGS="-Os -Os > -I/opt/local/include" \ > LDSHARED="/opt/local/bin/mpif90-openmpi-gcc49" \ > /Users/aponte/.miniconda3/envs/petsc/bin/python setup.py -q build_ext > --inplace > Reading .f2py_f2cmap ... > Mapping "integer(kind=HANDLE_KIND)" to "long" > Mapping "integer(kind=handle_kind)" to "long" > Successfully applied user defined changes from .f2py_f2cmap > In file included from > /Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0, > from > /Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18, > from > /Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4, > from build/src.macosx-10.9-x86_64-3.6/./fortranobject.h:13, > from ./timestepper_advmodule.c:18: > /Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: > warning: #warning "Using deprecated NumPy API, disable it by " "#defining > NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] > #warning "Using deprecated NumPy API, disable it by " \ > ^ > In file included from > /Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0, > from > /Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18, > from > /Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4, > from build/src.macosx-10.9-x86_64-3.6/./fortranobject.h:13, > from build/src.macosx-10.9-x86_64-3.6/./fortranobject.c:2: > /Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: > warning: #warning "Using deprecated NumPy API, disable it by " "#defining > NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] > #warning "Using deprecated NumPy API, disable it by " \ > ^ > build/src.macosx-10.9-x86_64-3.6/./fortranobject.c: In function 'format_def': > build/src.macosx-10.9-x86_64-3.6/./fortranobject.c:138:18: warning: > comparison between signed and unsigned integer expressions [-Wsign-compare] > if (size < sizeof(notalloc)) { > ^ > ./timestepper_adv.F90:9.22: > > module timestepper_adv > 1 > Error: Unexpected MODULE statement at (1) > ./timestepper_adv.F90:11.11: > > use petsc > 1 > Error: Unexpected USE statement at (1) > ./timestepper_adv.F90:12.15: > > implicit none > 1 > Error: Unexpected IMPLICIT NONE statement at (1) > ./timestepper_adv.F90:14.15: > > type gridinfo > 1 > > ... > > Error: Symbol 'grd' at (1) has no IMPLICIT type > ./timestepper_adv.F90:59.18: > > type(gridinfo) grd > 1 > Error: Derived type 'gridinfo' at (1) is being used before it is defined > Fatal Error: Error count reached limit of 25. > error: Command "/opt/local/bin/mpif90-openmpi-gcc49 -Os -Os > -I/opt/local/include -arch x86_64 -fPIC -O3 -funroll-loops > -DF2PY_REPORT_ON_ARRAY_COPY=1 -I/opt/local/lib/petsc/include > -I/Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/petsc4py/include > -I. -Ibuild/src.macosx-10.9-x86_64-3.6/. > -I/Users/aponte/.miniconda3/envs/petsc/lib/python3.6/site-packages/numpy/core/include > -I/Users/aponte/.miniconda3/envs/petsc/include/python3.6m -c -c > ./timestepper_adv.F90 -o build/temp.macosx-10.9-x86_64-3.6/timestepper_adv.o > -Jbuild/temp.macosx-10.9-x86_64-3.6/ -Ibuild/temp.macosx-10.9-x86_64-3.6/" > failed with exit status 1 > make: *** [timestepper_adv.so] Error 1 > > -- > Aurélien Ponte > Tel: (+33) 2 98 22 40 73 > Fax: (+33) 2 98 22 44 96 > UMR 6523, IFREMER > ZI de la Pointe du Diable > CS 10070 > 29280 Plouzané >
