First time here? Checkout the FAQ!
x
0 votes
by (120 points)
I have this problem when execute the next command build for generate the executable

cmake --build _build

version used

1 - mpirun (Open MPI) 4.1.2

2 - petsc-v3.21.3

Text error

/home/davecode/Documents/install/petsc/include/petscdt.h:541:3: error: ‘PETSC_FUNCTION_NAME_CXX’ was not declared in this scope; did you mean ‘PETSC_FUNCTION_NAME_C’?

  541 |   PetscCall(PetscDTBinomialInt(n, k, &Nk));

      |   ^~~~~~~~~

/home/davecode/Documents/install/petsc/include/petscdt.h:541:3: error: ‘PETSC_FUNCTION_NAME_CXX’ was not declared in this scope; did you mean ‘PETSC_FUNCTION_NAME_C’?

  541 |   PetscCall(PetscDTBinomialInt(n, k, &Nk));

      |   ^~~~~~~~~

/home/davecode/Documents/install/petsc/include/petscdt.h:558:3: error: ‘PETSC_FUNCTION_NAME_CXX’ was not declared in this scope; did you mean ‘PETSC_FUNCTION_NAME_C’?

  558 |   PetscFunctionReturn(PETSC_SUCCESS);

      |   ^~~~~~~~~~~~~~~~~~~

In file included from /home/davecode/Documents/install/petsc/include/petscsys.h:20,

                 from /home/davecode/Documents/install/openCARP/numerics/basics.h:40,

                 from /home/davecode/Documents/install/openCARP/numerics/basics.cc:27:

/home/davecode/Documents/install/petsc/include/petscdt.h:558:3: error: ‘PETSC_FUNCTION_NAME_CXX’ was not declared in this scope; did you mean ‘PETSC_FUNCTION_NAME_C’?

  558 |   PetscFunctionReturn(PETSC_SUCCESS);

      |   ^~~~~~~~~~~~~~~~~~~

In file included from /home/davecode/Documents/install/petsc/include/petscsys.h:20,

                 from /home/davecode/Documents/install/openCARP/numerics/basics.h:40,

                 from /home/davecode/Documents/install/openCARP/numerics/basics.cc:27:

/home/davecode/Documents/install/petsc/include/petscspace.h: In function ‘PetscErrorCode PetscSpacePolynomialSetSymmetric(PetscSpace, PetscBool)’:

/home/davecode/Documents/install/petsc/include/petscspace.h:74:3: error: ‘PETSC_FUNCTION_NAME_CXX’ was not declared in this scope; did you mean ‘PETSC_FUNCTION_NAME_C’?

   74 |   PetscCheck(!s, PetscObjectComm((PetscObject)sp), PETSC_ERR_SUP, "PETSCSPACEPOLYNOMIAL does not support symmetric polynomials");

      |   ^~~~~~~~~~

/home/davecode/Documents/install/openCARP/numerics/basics.cc: In function ‘opencarp::file_desc* opencarp::f_open(const char*, const char*)’:

/home/davecode/Documents/install/openCARP/numerics/basics.cc:150:39: warning: ignoring return value of ‘char* getcwd(char*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]

  150 |     char current_workdir[2048]; getcwd(current_workdir, 2048);

      |                                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

/home/davecode/Documents/install/openCARP/numerics/basics.cc: In function ‘void opencarp::f_read_par(void*, size_t, size_t, opencarp::FILE_SPEC, MPI_Comm)’:

/home/davecode/Documents/install/openCARP/numerics/basics.cc:174:10: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]

  174 |     fread(ptr, size, nmemb, stream->fd);

      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/davecode/Documents/install/openCARP/numerics/basics.cc: In function ‘char* opencarp::f_gets_par(char*, int, opencarp::FILE_SPEC, MPI_Comm)’:

/home/davecode/Documents/install/openCARP/numerics/basics.cc:208:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]

  208 |     fgets(s, size, stream->fd);

      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~

/home/davecode/Documents/install/openCARP/numerics/basics.cc: In function ‘char* opencarp::read_bin_string(opencarp::FILE_SPEC)’:

/home/davecode/Documents/install/openCARP/numerics/basics.cc:231:8: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]

  231 |   fread( &len, sizeof(int), 1, in->fd );

      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/davecode/Documents/install/openCARP/numerics/basics.cc:233:8: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]

  233 |   fread( s, sizeof(char), len, in->fd );

      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gmake[2]: *** [numerics/CMakeFiles/numerics.dir/build.make:76: numerics/CMakeFiles/numerics.dir/basics.cc.o] Error 1

gmake[1]: *** [CMakeFiles/Makefile2:460: numerics/CMakeFiles/numerics.dir/all] Error 2

gmake: *** [Makefile:156: all] Error 2

I will be atented for any question and possible solution.

thanks.

1 Answer

0 votes
by (8.1k points)
It looks like your petsc was built without C++ support. Check https://opencarp.org/download/installation#building-from-source for how to build PETSc to be compatible with openCARP.
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...