Compiling libMesh

Compiling libMesh requires a proper environment. Lets verify a few things before attempting to build it (or possibly re-build it in your case):

  • Verify you have a proper compiler present:

    • Linux:

      which $CC
      /opt/moose/mpich-4.0.2/gcc-12.2.1/bin/mpicc
      
      mpicc -show
      gcc -I/opt/moose/mpich-4.0.2/gcc-12.2.1/include -L/opt/moose/mpich-4.0.2/gcc-12.2.1/lib -Wl,-rpath -Wl,/opt/moose/mpich-4.0.2/gcc-12.2.1/lib -Wl,--enable-new-dtags -lmpi
      
      which gcc
      /opt/moose/gcc-12.2.1/bin/gcc
      

    • Macintosh:

      which $CC
      /opt/moose/mpich-4.0.2/clang-__LLVM__/bin/mpicc
      
      mpicc -show
      clang -Wl,-commons,use_dylibs -I/opt/moose/mpich-4.0.2/clang-__LLVM__/include -L/opt/moose/mpich-4.0.2/clang-__LLVM__/lib -lmpi -lpmpi
      
      which clang
      /opt/moose/llvm-__LLVM__/bin/clang
      

    What you are looking for is that which and mpicc -show are returning proper paths. If these paths are not set, or which is not returning anything, see Modules for help on setting up a proper environment. Once set up, return here and verify the above commands return the proper messages.

  • Check that PETSC_DIR is set and does exist:

    • Linux:

      echo $PETSC_DIR
      /opt/moose/petsc-__PETSC_DEFAULT__/mpich-__MPICH___gcc-12.2.1-opt
      
      file $PETSC_DIR
      /opt/moose/petsc-__PETSC_DEFAULT__/mpich-__MPICH___gcc-12.2.1-opt: directory
      

    • Macintosh:

      echo $PETSC_DIR
      /opt/moose/petsc-__PETSC_DEFAULT__/mpich-__MPICH___clang-__LLVM__-opt
      
      file $PETSC_DIR
      /opt/moose/petsc-__PETSC_DEFAULT__/mpich-__MPICH___clang-__LLVM__-opt: directory
      

    • If echo $PETSC_DIR returns nothing, this would indicate your environment is not complete. See Modules for help on setting up a proper environment. Once set up, return here and verify the above commands return the proper messages.

    • If file $PETSC_DIR returns an error (possible if you are performing a Manual Install), it would appear you have not yet ran configure. Configure builds this directory.

  • With the above all taken care of, try to build libMesh:

    
    cd moose/scripts
    ./update_and_rebuild_libmesh.sh
    

    If you encounter errors during this step, we would like to hear from you! Please seek help on the MOOSE Discussion forum. Provide the diagnostic and libMesh configure logs. Those two files can be found in the following locations:

    • moose/libmesh/build/config.log

    • moose/scripts/libmesh_diagnostic.log

  • If libMesh built successfully, return to the beginning of the step that lead you here, and try that step again.