On Mon, Sep 8, 2008 at 4:05 PM, Roy Stogner <[EMAIL PROTECTED]> wrote: > On Mon, 8 Sep 2008, John Peterson wrote: > >> On Sun, Sep 7, 2008 at 7:47 PM, Derek Gaston <[EMAIL PROTECTED]> wrote: >>> >>>> If anyone following the >>>> SVN head suddenly sees PETSc-related compilation errors, let me know. >> >> That last change broke my build: apparently you can't include >> <petscversion.h> without including <petsc.h> first? > > Not with 2.3.0 or 2.3.1 you can't, apparently. I saw a nice > dependency-free petscversion.h file in 2.3.3 and just assumed it had > always been that way. > >> Compiling C++ (in development mode) src/numerics/linear_solver.C... >> /usr/local/petsc/petsc-2.3.1/include/petscversion.h:4: error: >> 'PETSC_EXTERN_CXX_BEGIN' does not name a type >> /usr/local/petsc/petsc-2.3.1/include/petscmath.h:274: error: >> 'PetscErrorCode' does not name a type >> >> (and a bunch more similar errors) >> >> Do we have a chicken-and-egg problem here? What necessitated the >> change to petsc_macro.h? > > The fact that the previous version didn't correctly detect newer PETSc > versions: we can't test PETSC_VERSION_LESS_THAN if we haven't yet > included the PETSc header where PETSC_VERSION_* is defined! > > I think I've got a (kludgy) fix for it: to include petscversion.h in > petsc_macro.h: > > #ifndef PETSC_EXTERN_CXX_BEGIN > # define PETSC_EXTERN_CXX_BEGIN > # define PETSC_EXTERN_CXX_END > # define LIBMESH_PETSC_EXTERN_C_WORKAROUND > #endif > #include <petscversion.h> > #ifdef LIBMESH_PETSC_EXTERN_C_WORKAROUND > # undef PETSC_EXTERN_CXX_BEGIN > # undef PETSC_EXTERN_CXX_END > #endif > > Can you test that out locally before we commit it? More importantly, > got any better ideas?
Unless there is a way to "un-include" something after you've included it, then I like your hax. Otherwise I would nakedly #include <petsc.h>, figure out if we need the extern "C" wrapping from the version, "uninclude" petsc.h, and then include it again with the right wrapping... I'm testing your fix now, will check in if it works. -- John ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Libmesh-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-devel
