petsc4py compilation fails on OS X 10.8 with macports python

Issue #1 resolved
Former user created an issue

Hi,

I'm trying to compile petsc4py (revision 5841c049684401e9d80f65af8340272aa2dd0666) on my up-to-date OS X 10.8 with python installed via macports.

The compilation fails (see below). I'm not sure if this is the main culprit: For some reason, petsc4py includes numpy from the Apple python, as seen here "-I/Library/Python/2.7/site-packages/numpy-override/numpy/core/include" instead of numpy installed via macports. Nonetheless, petsc4py includes the path to the correct python installation "-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7". I'm assuming this causes trouble?

I don't really want to remove the numpy of Apple python as the QGIS software depends on it.

Any ideas?

Thanks,

Andy

python setup.py build
running build
running build_src
cythonizing 'petsc4py.PETSc.pyx' -> 'petsc4py.PETSc.c'
cythonizing 'libpetsc4py/libpetsc4py.pyx' -> 'libpetsc4py/libpetsc4py.c'
running build_py
creating build
creating build/lib.macosx-10.8-x86_64-2.7
creating build/lib.macosx-10.8-x86_64-2.7/petsc4py
copying src/__init__.py -> build/lib.macosx-10.8-x86_64-2.7/petsc4py
copying src/__main__.py -> build/lib.macosx-10.8-x86_64-2.7/petsc4py
copying src/help.py -> build/lib.macosx-10.8-x86_64-2.7/petsc4py
copying src/PETSc.py -> build/lib.macosx-10.8-x86_64-2.7/petsc4py
creating build/lib.macosx-10.8-x86_64-2.7/petsc4py/lib
copying src/lib/__init__.py -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/lib
creating build/lib.macosx-10.8-x86_64-2.7/petsc4py/include
creating build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/include/petsc4py/numpy.h -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.h -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc.h -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc_api.h -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.i -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pxd -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/include/petsc4py/PETSc.pxd -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pyx -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/include/petsc4py
copying src/lib/petsc.cfg -> build/lib.macosx-10.8-x86_64-2.7/petsc4py/lib
running build_ext
PETSC_DIR:   /Users/andy/petsc
PETSC_ARCH:  macosx
scalar-type: real
precision:   double
language:    CXXONLY
compiler:    /opt/local/bin/openmpic++
linker:      /opt/local/bin/openmpic++
building 'PETSc' extension
creating build/temp.macosx-10.8-x86_64-2.7
creating build/temp.macosx-10.8-x86_64-2.7/macosx
creating build/temp.macosx-10.8-x86_64-2.7/macosx/src
/opt/local/bin/openmpic++ -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -O -fPIC -fno-strict-aliasing -fno-common -dynamic -pipe -Os -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -DPETSC_DIR=/Users/andy/petsc -D__INSDIR__=petsc4py-3.4/ -I/opt/local/include/openmpi -I/opt/local/include -I/opt/X11/include -I/Users/andy/petsc/macosx/include -I/Users/andy/petsc/include -Isrc/include -I/Library/Python/2.7/site-packages/numpy-override/numpy/core/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/PETSc.c -o build/temp.macosx-10.8-x86_64-2.7/macosx/src/PETSc.o
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
In file included from src/PETSc.c:3:
In file included from src/petsc4py.PETSc.c:315:
In file included from src/include/petsc4py/numpy.h:11:
In file included from /Library/Python/2.7/site-packages/numpy-override/numpy/core/include/numpy/arrayobject.h:15:
In file included from /Library/Python/2.7/site-packages/numpy-override/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Library/Python/2.7/site-packages/numpy-override/numpy/core/include/numpy/ndarraytypes.h:1728:
/Library/Python/2.7/site-packages/numpy-override/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: "Using deprecated NumPy API, disable it by
      #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
 ^
In file included from src/PETSc.c:3:
src/petsc4py.PETSc.c:39452:21: error: assigning to 'PetscErrorHandlerFunction' (aka 'PetscErrorCode (*)(MPI_Comm, int, const char *, const char *,
      PetscErrorCode, PetscErrorType, const char *, void *)') from incompatible type 'PetscErrorCode (MPI_Comm, int, const char *, const char *, const
      char *, PetscErrorCode, PetscErrorType, const char *, void *)': different number of parameters (8 vs 9)
    __pyx_v_handler = PetscAttachDebuggerErrorHandler;
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/petsc4py.PETSc.c:39475:21: error: assigning to 'PetscErrorHandlerFunction' (aka 'PetscErrorCode (*)(MPI_Comm, int, const char *, const char *,
      PetscErrorCode, PetscErrorType, const char *, void *)') from incompatible type 'PetscErrorCode (MPI_Comm, int, const char *, const char *, const
      char *, PetscErrorCode, PetscErrorType, const char *, void *)': different number of parameters (8 vs 9)
    __pyx_v_handler = PetscEmacsClientErrorHandler;
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/petsc4py.PETSc.c:39498:21: error: assigning to 'PetscErrorHandlerFunction' (aka 'PetscErrorCode (*)(MPI_Comm, int, const char *, const char *,
      PetscErrorCode, PetscErrorType, const char *, void *)') from incompatible type 'PetscErrorCode (MPI_Comm, int, const char *, const char *, const
      char *, PetscErrorCode, PetscErrorType, const char *, void *)': different number of parameters (8 vs 9)
    __pyx_v_handler = PetscTraceBackErrorHandler;
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
src/petsc4py.PETSc.c:39521:21: error: assigning to 'PetscErrorHandlerFunction' (aka 'PetscErrorCode (*)(MPI_Comm, int, const char *, const char *,
      PetscErrorCode, PetscErrorType, const char *, void *)') from incompatible type 'PetscErrorCode (MPI_Comm, int, const char *, const char *, const
      char *, PetscErrorCode, PetscErrorType, const char *, void *)': different number of parameters (8 vs 9)
    __pyx_v_handler = PetscIgnoreErrorHandler;
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~
src/petsc4py.PETSc.c:39544:21: error: assigning to 'PetscErrorHandlerFunction' (aka 'PetscErrorCode (*)(MPI_Comm, int, const char *, const char *,
      PetscErrorCode, PetscErrorType, const char *, void *)') from incompatible type 'PetscErrorCode (MPI_Comm, int, const char *, const char *, const
      char *, PetscErrorCode, PetscErrorType, const char *, void *)': different number of parameters (8 vs 9)
    __pyx_v_handler = PetscMPIAbortErrorHandler;
                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
src/petsc4py.PETSc.c:39567:21: error: assigning to 'PetscErrorHandlerFunction' (aka 'PetscErrorCode (*)(MPI_Comm, int, const char *, const char *,
      PetscErrorCode, PetscErrorType, const char *, void *)') from incompatible type 'PetscErrorCode (MPI_Comm, int, const char *, const char *, const
      char *, PetscErrorCode, PetscErrorType, const char *, void *)': different number of parameters (8 vs 9)
    __pyx_v_handler = PetscAbortErrorHandler;
                    ^ ~~~~~~~~~~~~~~~~~~~~~~
src/petsc4py.PETSc.c:39602:47: error: no matching function for call to 'PetscPushErrorHandler'
  __pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPushErrorHandler(__pyx_v_handler, NULL)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename =...
                                              ^~~~~~~~~~~~~~~~~~~~~
/Users/andy/petsc/include/petscerror.h:362:29: note: candidate function not viable: no known conversion from 'PetscErrorHandlerFunction' (aka
      'PetscErrorCode (*)(MPI_Comm, int, const char *, const char *, PetscErrorCode, PetscErrorType, const char *, void *)') to 'PetscErrorCode
      (*)(MPI_Comm, int, const char *, const char *, const char *, PetscErrorCode, PetscErrorType, const char *, void *)' for 1st argument
PETSC_EXTERN PetscErrorCode PetscPushErrorHandler(PetscErrorCode (*handler)(MPI_Comm,int,const char*,const char*,const...
                            ^
In file included from src/PETSc.c:3:
src/petsc4py.PETSc.c:111599:51: error: use of undeclared identifier 'KSPConvergedDefaultCreate'
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPConvergedDefaultCreate((&__pyx_v_cctx))); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename =...
                                                  ^
src/petsc4py.PETSc.c:111608:92: error: use of undeclared identifier 'KSPConvergedDefault'; did you mean 'SNESConvergedDefault'?
  ...= __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetConvergenceTest(__pyx_v_self->ksp, KSPConvergedDefault, __pyx_v_cctx, KSPConvergedDefaultDestroy)); if...
                                                                                ^~~~~~~~~~~~~~~~~~~
                                                                                SNESConvergedDefault
/Users/andy/petsc/include/petscsnes.h:312:29: note: 'SNESConvergedDefault' declared here
PETSC_EXTERN PetscErrorCode SNESConvergedDefault(SNES,PetscInt,PetscReal,PetscReal,PetscReal,SNESConvergedReason*,void*);
                            ^
In file included from src/PETSc.c:3:
src/petsc4py.PETSc.c:111608:127: error: use of undeclared identifier 'KSPConvergedDefaultDestroy'
  ...= __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetConvergenceTest(__pyx_v_self->ksp, KSPConvergedDefault, __pyx_v_cctx, KSPConvergedDefaultDestroy)); if...
                                                                                                                   ^
src/petsc4py.PETSc.c:111620:92: error: use of undeclared identifier 'KSPConvergedSkip'; did you mean 'KSPConvergedLSQR'?
      __pyx_t_3 = __pyx_f_8petsc4py_5PETSc_CHKERR(KSPSetConvergenceTest(__pyx_v_self->ksp, KSPConvergedSkip, NULL, NULL)); if...
                                                                                           ^~~~~~~~~~~~~~~~
                                                                                           KSPConvergedLSQR
/Users/andy/petsc/include/petscksp.h:512:29: note: 'KSPConvergedLSQR' declared here
PETSC_EXTERN PetscErrorCode KSPConvergedLSQR(KSP,PetscInt,PetscReal,KSPConvergedReason*,void *);
                            ^
In file included from src/PETSc.c:3:
src/petsc4py.PETSc.c:145043:47: error: no matching function for call to 'DMCreateMatrix'
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMCreateMatrix(__pyx_v_self->dm, (&__pyx_v_mat->mat))); if (unlikely(__pyx_t_2 == -1))...
                                              ^~~~~~~~~~~~~~
/Users/andy/petsc/include/petscdm.h:62:29: note: candidate function not viable: requires 3 arguments, but 2 were provided
PETSC_EXTERN PetscErrorCode DMCreateMatrix(DM,MatType,Mat*);
                            ^
In file included from src/PETSc.c:3:
src/petsc4py.PETSc.c:160297:15: error: no matching function for call to 'PetscTraceBackErrorHandler'
    __pyx_r = PetscTBEH(__pyx_v_comm, __pyx_v_line, __pyx_v_cfun, __pyx_v_cfile, __pyx_v_n, __pyx_v_p, __pyx_v_mess, __pyx_v_ctx);
              ^~~~~~~~~
src/include/custom.h:32:19: note: expanded from macro 'PetscTBEH'
#define PetscTBEH PetscTraceBackErrorHandler
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/andy/petsc/include/petscerror.h:354:29: note: candidate function not viable: requires 9 arguments, but 8 were provided
PETSC_EXTERN PetscErrorCode PetscTraceBackErrorHandler(MPI_Comm,int,const char*,const char*,const char*,PetscErrorCode,PetscErrorType,const...
                            ^
In file included from src/PETSc.c:3:
src/petsc4py.PETSc.c:161068:47: error: no matching function for call to 'PetscPushErrorHandler'
  __pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscPushErrorHandler(__pyx_v_handler, NULL)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename =...
                                              ^~~~~~~~~~~~~~~~~~~~~
/Users/andy/petsc/include/petscerror.h:362:29: note: candidate function not viable: no known conversion from 'PetscErrorHandlerFunction' (aka
      'PetscErrorCode (*)(MPI_Comm, int, const char *, const char *, PetscErrorCode, PetscErrorType, const char *, void *)') to 'PetscErrorCode
      (*)(MPI_Comm, int, const char *, const char *, const char *, PetscErrorCode, PetscErrorType, const char *, void *)' for 1st argument
PETSC_EXTERN PetscErrorCode PetscPushErrorHandler(PetscErrorCode (*handler)(MPI_Comm,int,const char*,const char*,const...
                            ^
1 warning and 14 errors generated.
error: command '/opt/local/bin/openmpic++' failed with exit status 1

Comments (2)

  1. Log in to comment