jam4375 / plasmatic-cpp

Multiphysics Finite Element Simulation
GNU General Public License v2.0
0 stars 0 forks source link

Cmake says it found PETSc, but the compiler cannot find the headers #2

Open gtheler opened 9 months ago

gtheler commented 9 months ago
gtheler@tom:~/codigos/plasmatic-cpp/build-opt$ cmake -DCMAKE_PREFIX_PATH=$PETSC_DIR/$PETSC_ARCH ..
-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.39.2") 
-- Loading GCC cmake settings
CMake Deprecation Warning at build-opt/_deps/googletest-src/CMakeLists.txt:4 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Deprecation Warning at build-opt/_deps/googletest-src/googlemock/CMakeLists.txt:45 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at build-opt/_deps/googletest-src/googletest/CMakeLists.txt:56 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Found PythonInterp: /usr/bin/python (found version "3.11.2") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- cxxopts version 2.2.0
-- Version: 10.1.2
-- Build type: Release
-- Performing Test EIGEN_COMPILER_SUPPORT_CPP11
-- Performing Test EIGEN_COMPILER_SUPPORT_CPP11 - Success
-- Performing Test COMPILER_SUPPORT_std=cpp03
-- Performing Test COMPILER_SUPPORT_std=cpp03 - Success
-- Performing Test standard_math_library_linked_to_automatically
-- Performing Test standard_math_library_linked_to_automatically - Success
-- Standard libraries to link to explicitly: none
-- Performing Test COMPILER_SUPPORT_WERROR
-- Performing Test COMPILER_SUPPORT_WERROR - Success
-- Performing Test COMPILER_SUPPORT_pedantic
-- Performing Test COMPILER_SUPPORT_pedantic - Success
-- Performing Test COMPILER_SUPPORT_Wall
-- Performing Test COMPILER_SUPPORT_Wall - Success
-- Performing Test COMPILER_SUPPORT_Wextra
-- Performing Test COMPILER_SUPPORT_Wextra - Success
-- Performing Test COMPILER_SUPPORT_Wundef
-- Performing Test COMPILER_SUPPORT_Wundef - Success
-- Performing Test COMPILER_SUPPORT_Wcastalign
-- Performing Test COMPILER_SUPPORT_Wcastalign - Success
-- Performing Test COMPILER_SUPPORT_Wcharsubscripts
-- Performing Test COMPILER_SUPPORT_Wcharsubscripts - Success
-- Performing Test COMPILER_SUPPORT_Wnonvirtualdtor
-- Performing Test COMPILER_SUPPORT_Wnonvirtualdtor - Success
-- Performing Test COMPILER_SUPPORT_Wunusedlocaltypedefs
-- Performing Test COMPILER_SUPPORT_Wunusedlocaltypedefs - Success
-- Performing Test COMPILER_SUPPORT_Wpointerarith
-- Performing Test COMPILER_SUPPORT_Wpointerarith - Success
-- Performing Test COMPILER_SUPPORT_Wwritestrings
-- Performing Test COMPILER_SUPPORT_Wwritestrings - Success
-- Performing Test COMPILER_SUPPORT_Wformatsecurity
-- Performing Test COMPILER_SUPPORT_Wformatsecurity - Success
-- Performing Test COMPILER_SUPPORT_Wshorten64to32
-- Performing Test COMPILER_SUPPORT_Wshorten64to32 - Failed
-- Performing Test COMPILER_SUPPORT_Wlogicalop
-- Performing Test COMPILER_SUPPORT_Wlogicalop - Success
-- Performing Test COMPILER_SUPPORT_Wenumconversion
-- Performing Test COMPILER_SUPPORT_Wenumconversion - Success
-- Performing Test COMPILER_SUPPORT_Wcpp11extensions
-- Performing Test COMPILER_SUPPORT_Wcpp11extensions - Success
-- Performing Test COMPILER_SUPPORT_Wdoublepromotion
-- Performing Test COMPILER_SUPPORT_Wdoublepromotion - Success
-- Performing Test COMPILER_SUPPORT_Wshadow
-- Performing Test COMPILER_SUPPORT_Wshadow - Success
-- Performing Test COMPILER_SUPPORT_Wnopsabi
-- Performing Test COMPILER_SUPPORT_Wnopsabi - Success
-- Performing Test COMPILER_SUPPORT_Wnovariadicmacros
-- Performing Test COMPILER_SUPPORT_Wnovariadicmacros - Success
-- Performing Test COMPILER_SUPPORT_Wnolonglong
-- Performing Test COMPILER_SUPPORT_Wnolonglong - Success
-- Performing Test COMPILER_SUPPORT_fnochecknew
-- Performing Test COMPILER_SUPPORT_fnochecknew - Success
-- Performing Test COMPILER_SUPPORT_fnocommon
-- Performing Test COMPILER_SUPPORT_fnocommon - Success
-- Performing Test COMPILER_SUPPORT_fstrictaliasing
-- Performing Test COMPILER_SUPPORT_fstrictaliasing - Success
-- Performing Test COMPILER_SUPPORT_wd981
-- Performing Test COMPILER_SUPPORT_wd981 - Failed
-- Performing Test COMPILER_SUPPORT_wd2304
-- Performing Test COMPILER_SUPPORT_wd2304 - Failed
-- Performing Test COMPILER_SUPPORT_STRICTANSI
-- Performing Test COMPILER_SUPPORT_STRICTANSI - Failed
-- Performing Test COMPILER_SUPPORT_Qunusedarguments
-- Performing Test COMPILER_SUPPORT_Qunusedarguments - Failed
-- Performing Test COMPILER_SUPPORT_ansi
-- Performing Test COMPILER_SUPPORT_ansi - Success
-- Performing Test COMPILER_SUPPORT_OPENMP
-- Performing Test COMPILER_SUPPORT_OPENMP - Success
-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - /usr/bin/f95
-- The Fortran compiler identification is GNU 12.2.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
qmake: could not exec '/usr/lib/qt5/bin/qmake': No such file or directory
-- Found unsuitable Qt version "" from NOTFOUND
-- Qt4 not found, so disabling the mandelbrot and opengl demos
-- Found CHOLMOD: /usr/include/suitesparse  
-- Found UMFPACK: /usr/include/suitesparse  
-- Found KLU: /usr/include/suitesparse  
-- Performing Test SUPERLU_HAS_GLOBAL_MEM_USAGE_T
-- Performing Test SUPERLU_HAS_GLOBAL_MEM_USAGE_T - Failed
-- Performing Test SUPERLU_HAS_CLEAN_ENUMS
-- Performing Test SUPERLU_HAS_CLEAN_ENUMS - Success
-- Performing Test SUPERLU_HAS_GLOBALLU_T
-- Performing Test SUPERLU_HAS_GLOBALLU_T - Failed
-- Found SuperLU: /usr/include/superlu (found suitable version "4.3", minimum required is "4.0") 
-- Checking for one of the modules 'hwloc'
-- Performing Test HAVE_HWLOC_PARENT_MEMBER
-- Performing Test HAVE_HWLOC_PARENT_MEMBER - Success
-- Performing Test HAVE_HWLOC_CACHE_ATTR
-- Performing Test HAVE_HWLOC_CACHE_ATTR - Success
-- Performing Test HAVE_HWLOC_OBJ_PU
-- Performing Test HAVE_HWLOC_OBJ_PU - Success
-- Looking for hwloc_bitmap_free in hwloc
-- Looking for hwloc_bitmap_free in hwloc - found
-- A version of Pastix has been found but pastix_nompi.h does not exist in the include directory. Because Eigen tests require a version without MPI, we disable the Pastix backend.
-- 
-- Configured Eigen 3.4.0
-- 
-- Available targets (use: make TARGET):
-- ---------+--------------------------------------------------------------
-- Target   |   Description
-- ---------+--------------------------------------------------------------
-- install  | Install Eigen. Headers will be installed to:
--          |     <CMAKE_INSTALL_PREFIX>/<INCLUDE_INSTALL_DIR>
--          |   Using the following values:
--          |     CMAKE_INSTALL_PREFIX: /usr/local
--          |     INCLUDE_INSTALL_DIR:  include/eigen3
--          |   Change the install location of Eigen headers using:
--          |     cmake . -DCMAKE_INSTALL_PREFIX=yourprefix
--          |   Or:
--          |     cmake . -DINCLUDE_INSTALL_DIR=yourdir
-- doc      | Generate the API documentation, requires Doxygen & LaTeX
-- blas     | Build BLAS library (not the same thing as Eigen)
-- uninstall| Remove files installed by the install target
-- ---------+--------------------------------------------------------------
-- 
CMake Warning (dev) at /usr/share/cmake-3.25/Modules/FetchContent.cmake:1279 (message):
  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
  not set.  The policy's OLD behavior will be used.  When using a URL
  download, the timestamps of extracted files should preferably be that of
  the time of extraction, otherwise code that depends on the extracted
  contents might not be rebuilt if the URL changes.  The OLD behavior
  preserves the timestamps from the archive instead, but this is usually not
  what you want.  Update your project to the NEW behavior or specify the
  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
  robustness issue.
Call Stack (most recent call first):
  config/external/nlohmann_json.cmake:1 (FetchContent_Declare)
  config/external/external.cmake:11 (include)
  config/config.cmake:36 (include)
  CMakeLists.txt:6 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Using the multi-header code from /home/gtheler/codigos/plasmatic-cpp/build-opt/_deps/json-src/include/
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring executable plasmatic with target "plasmatic" and alias "plasmatic::plasmatic"
-- Configuring library Utility with target "plasmatic_Utility" and alias "plasmatic::Utility"
-- Configuring test executable UtilityTest with target "plasmatic_UtilityTest" and alias "plasmatic::UtilityTest"
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") 
-- Checking for one of the modules 'PETSc>3.5.0'
-- PETSc include directory: /home/gtheler/libs/petsc-3.20.0/double-int32-release/include
-- PETSc library directory: /home/gtheler/libs/petsc-3.20.0/double-int32-release/lib
-- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/libmpichcxx.so (found version "4.0") 
-- Found MPI: TRUE (found version "4.0")  
-- Configuring library LinearAlgebra with target "plasmatic_LinearAlgebra" and alias "plasmatic::LinearAlgebra"
-- Configuring test executable LinearAlgebraTest with target "plasmatic_LinearAlgebraTest" and alias "plasmatic::LinearAlgebraTest"
-- Configuring library Mesh with target "plasmatic_Mesh" and alias "plasmatic::Mesh"
-- Configuring test executable MeshTest with target "plasmatic_MeshTest" and alias "plasmatic::MeshTest"
-- Configuring library ProblemTypes with target "plasmatic_ProblemTypes" and alias "plasmatic::ProblemTypes"
-- Configuring test executable ProblemTypesTest with target "plasmatic_ProblemTypesTest" and alias "plasmatic::ProblemTypesTest"
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gtheler/codigos/plasmatic-cpp/build-opt
gtheler@tom:~/codigos/plasmatic-cpp/build-opt$ make
[  4%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[  4%] Linking CXX static library ../../../lib/libgtest.a
[  4%] Built target gtest
[  9%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[  9%] Linking CXX static library ../../../lib/libgmock.a
[  9%] Built target gmock
[ 14%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[ 14%] Linking CXX static library ../../../lib/libgmock_main.a
[ 14%] Built target gmock_main
[ 19%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 19%] Linking CXX static library ../../../lib/libgtest_main.a
[ 19%] Built target gtest_main
[ 19%] Building CXX object libs/Utility/CMakeFiles/plasmatic_Utility.dir/Utility.cpp.o
[ 23%] Building CXX object libs/Utility/CMakeFiles/plasmatic_Utility.dir/ExecutablePath.cpp.o
[ 23%] Linking CXX static library ../../lib/libplasmatic_Utility.a
[ 23%] Built target plasmatic_Utility
[ 28%] Building CXX object libs/Mesh/CMakeFiles/plasmatic_Mesh.dir/Mesh.cpp.o
[ 28%] Building CXX object libs/Mesh/CMakeFiles/plasmatic_Mesh.dir/Element.cpp.o
[ 33%] Building CXX object libs/Mesh/CMakeFiles/plasmatic_Mesh.dir/Triangle.cpp.o
[ 33%] Building CXX object libs/Mesh/CMakeFiles/plasmatic_Mesh.dir/Line.cpp.o
[ 38%] Building CXX object libs/Mesh/CMakeFiles/plasmatic_Mesh.dir/Tetrahedron.cpp.o
[ 38%] Building CXX object libs/Mesh/CMakeFiles/plasmatic_Mesh.dir/LineOrder2.cpp.o
[ 42%] Building CXX object libs/Mesh/CMakeFiles/plasmatic_Mesh.dir/TriangleOrder2.cpp.o
[ 42%] Building CXX object libs/Mesh/CMakeFiles/plasmatic_Mesh.dir/TetrahedronOrder2.cpp.o
[ 47%] Linking CXX static library ../../lib/libplasmatic_Mesh.a
[ 47%] Built target plasmatic_Mesh
[ 52%] Building CXX object libs/LinearAlgebra/CMakeFiles/plasmatic_LinearAlgebra.dir/Vector.cpp.o
In file included from /home/gtheler/codigos/plasmatic-cpp/libs/LinearAlgebra/Vector.cpp:1:
/home/gtheler/codigos/plasmatic-cpp/libs/LinearAlgebra/interface/LinearAlgebra/Vector.h:5:10: fatal error: petscvec.h: No such file or directory
    5 | #include <petscvec.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [libs/LinearAlgebra/CMakeFiles/plasmatic_LinearAlgebra.dir/build.make:76: libs/LinearAlgebra/CMakeFiles/plasmatic_LinearAlgebra.dir/Vector.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1085: libs/LinearAlgebra/CMakeFiles/plasmatic_LinearAlgebra.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
gtheler@tom:~/codigos/plasmatic-cpp/build-opt$ 
jam4375 commented 9 months ago

It looks like it is identifying your PETSc include directory as /home/gtheler/libs/petsc-3.20.0/double-int32-release/include. If you look in that directory do you see a petscvec.h file? If you do it is probably a problem with the CMake configuration.

I'm telling CMake to use this directory as one of the search directories for include files here: https://github.com/jam4375/plasmatic-cpp/blob/4cb9eb12419ed289d01b35cc64bc1ecf434535c3/libs/LinearAlgebra/CMakeLists.txt#L32

gtheler commented 9 months ago

It looks like it is identifying your PETSc include directory as /home/gtheler/libs/petsc-3.20.0/double-int32-release/include. If you look in that directory do you see a petscvec.h file? If you do it is probably a problem with the CMake configuration.

The PETSc includes are in $PETSC_DIR/include, not $PETSC_DIR/$PETSC_ARCH/include.

I'm telling CMake to use this directory as one of the search directories for include files here:

https://github.com/jam4375/plasmatic-cpp/blob/4cb9eb12419ed289d01b35cc64bc1ecf434535c3/libs/LinearAlgebra/CMakeLists.txt#L32

Again, I'm not sure about CMake (I don't know if I am not sure because I don't like it or I don't like it because I'm not sure), but what I do in FeenoX is

include $(PETSC_DIR)/lib/petsc/conf/variables

in Makefile.am (https://github.com/seamplex/feenox/blob/main/src/Makefile-base.am#L5) and that takes care of everything.

Maybe this section of the PETSc manual helps? https://petsc.org/release/manual/getting_started/#sec-writing-application-codes