[petsc-users] Build error: vecimpl.h:124:98: error: expected declaration specifiers or '...' before string constant
Satish Balay
balay at mcs.anl.gov
Tue Apr 18 08:09:31 CDT 2023
Does this change work?
diff --git a/include/petsc/private/vecimpl.h b/include/petsc/private/vecimpl.h
index dd75dbbc00b..168540b546e 100644
--- a/include/petsc/private/vecimpl.h
+++ b/include/petsc/private/vecimpl.h
@@ -110,7 +110,7 @@ struct _VecOps {
PetscErrorCode (*setvaluescoo)(Vec, const PetscScalar[], InsertMode);
};
-#if defined(offsetof) && (defined(__cplusplus) || (PETSC_C_VERSION >= 11))
+#if defined(offsetof) && (defined(__cplusplus) || (PETSC_C_VERSION >= 17))
#if (PETSC_C_VERSION >= 11) && (PETSC_C_VERSION < 23)
// static_assert() is a keyword since C23, before that defined as macro in assert.h
#include <assert.h>
Satish
On Tue, 18 Apr 2023, Zongze Yang wrote:
> Hi, I am building petsc using gcc at 9.5.0, and found the following error:
>
> ```
> In file included from /usr/include/alloca.h:25,
> from /usr/include/stdlib.h:497,
> from
> /home/lrtfm/opt/firedrake/complex-int32/petsc/include/petscsys.h:1395,
> from
> /home/lrtfm/opt/firedrake/complex-int32/petsc/include/petscsf.h:7,
> from
> /home/lrtfm/opt/firedrake/complex-int32/petsc/src/vec/is/sf/interface/vscat.c:1:
> /home/lrtfm/opt/firedrake/complex-int32/petsc/include/petsc/private/vecimpl.h:124:15:
> error: expected declaration specifiers or '...' before '__builtin_offsetof'
> 124 | static_assert(offsetof(struct _VecOps, loadnative) == sizeof(void
> (*)(void)) * VECOP_LOADNATIVE, "");
> | ^~~~~~~~
> In file included from
> /home/lrtfm/opt/firedrake/complex-int32/petsc/src/vec/is/sf/interface/vscat.c:7:
> /home/lrtfm/opt/firedrake/complex-int32/petsc/include/petsc/private/vecimpl.h:124:98:
> error: expected declaration specifiers or '...' before string constant
> 124 | static_assert(offsetof(struct _VecOps, loadnative) == sizeof(void
> (*)(void)) * VECOP_LOADNATIVE, "");
> |
> ^~
> ```
>
> Could someone give me some hints to fix it? The configure.log and make.log
> are attached.
>
>
> Best wishes,
> Zongze
>
More information about the petsc-users
mailing list