Installing preCICE on Mac (problem with Eigen library)

Hello All,

I am Mark, I am doing my masters degree in Computer Science at Uni Stuttgart.
I recently started getting familiar with preCICE for one of my study courses, however I am facing a problem in building the source code.

I am using a Macbook with M1 Pro Chip, and ma

cOS 13.0.1 (Ventura)

I used homebrew to install the dependencies, but during the cmake process, I find Eigen but it fails in validating it.

I noticed when I try the validating script on it’s own it has a problem with finding the Eigen library, it only works when I explicitly include it as
“”” G++ -I /Users/markashraf/Downloads/eigen-3.4.0 HelloWorld.cpp “””

(It’s only here in the downloads folder as part of testing this approach)

I will be very grateful if someone knows anything about this problem, and can help me solve it.

Best Regards,
Mark

When you first run cmake to configure preCICE, there should be a section in the output that mentions which version of Eigen was found and where it is located. Can you have a look at that?

[...]
-- === DEPENDENCIES ===
[...]
-- Found Boost 1.80.0
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "3.2")
-- Found Eigen 3.4.0
-- Validating Eigen
-- Validating Eigen - success
[...]

The path shown after Found Eigen3: must contain a directory Eigen, which must contain the file Core.

You can get more useful information about what CMake is doing by calling it like this during the initial configuration: cmake --debug-find-pkg=Eigen3 ...

It finds it successfully and the path has the directory Eigen which contains the file Core

When I ran the error with the debug option, I didn’t get anything extra regarding the error.

I just checked on a Mac (M1, MacOS Ventura 13.0.1) and for me the build process for preCICE 2.5.0 and I could not reproduce the error (yet).

I used the following build command

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/software/precice-2.5.0 -DPRECICE_PETScMapping=OFF -DPRECICE_PythonActions=OFF ..

from the documentation. I did install Eigen (3.4.0), open-mpi (4.1.4), cmake (3.25) andboost (1.80.0) via brew. My compiler is clang (actually AppleClang 14.0.0). libxml2 etc. is provided by the XCode command line tools.

Could you maybe show us what CMake and build command you use? Could you also add the full output of the configuration step here? Please copy and paste the text (no screenshot) using a code block (triple back ticks “```” ). It would be great to figure out what is going on.

3 Likes

Just as an addition: The tests, run via make test passed as well. Only surprise here was that the test “Acceleration” was surprisingly slow. It took 20 seconds. I am not sure if that is to be expected.

The dependencies are all the same as your setup.
You can find a screenshot here.

And here I also used the same cmake command:

(base) markashraf@192 build % ls
(base) markashraf@192 build % cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/software/precice -DPRECICE_PETScMapping=OFF -DPRECICE_PythonActions=OFF ..
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CXX11_N2071_N2072
-- Performing Test CXX11_N2071_N2072 - Success
-- === CONFIGURATION ===
-- Library version to build: 2.5.0
-- Build configuration: Release
-- Build shared libraries: ON
-- Target system: Darwin-22.1.0
-- Host system: Darwin-22.1.0
-- Library architecture: <empty>
-- CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- CXX compiler flags: <empty>
-- CXX linker: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
-- Install prefix: /Users/markashraf/software/precice
-- Source directory: /Users/markashraf/Documents/Winter_22:23/Simulation_Engineering/Git_Repos/precice-2.5.0
-- Binary directory: /Users/markashraf/Documents/Winter_22:23/Simulation_Engineering/Git_Repos/precice-2.5.0/build
-- Configure package generation: ON
-- Install tests/testfiles: OFF
-- Additional CTest MPI Flags: <empty>

-- === ENABLED FEATURES ===
 * MPICommunication, Enables the MPI communication back-end.

   This enables the MPI communication back-end which is highly recommended on multi-node systems.
   See the documentation of the CMake module FindMPI to control its functionality.

   This feature can be enabled/disabled by setting the PRECICE_MPICommunication CMake option.

 * CBindings, Enables the native C bindings.

   preCICE provides native bindings for C, which are compiled into the library.
   This feature enables the compilation and installation of the bindings into the library.
   Note that we strongly recommend to compile with C bindings enabled for compatibility reasons.

   This feature can be enabled/disabled by setting the PRECICE_ENABLE_C CMake option.
  
 * FortranBindings, Enables the native Fortran bindings.

   preCICE provides native bindings for Fortran, which are compiled into the library.
   This feature enables the compilation and installation of the bindings into the library.
   Note that we strongly recommend to compile with Fortran bindings enabled for compatibility reasons.

   This feature can be enabled/disabled by setting the PRECICE_ENABLE_FORTRAN CMake option.
  
 * PreciceTools, Build the "precice-tools" executable

   preCICE offers in addition to the core library a variety of tools in order to check configuration
   files or generate xml references. The tools are copmiled into an exectuable called "precice-tools".

   This feature can be enabled/disabled by setting the PRECICE_BUILD_TOOLS CMake option.
  

-- === DISABLED FEATURES ===
 * PETScMapping, Enables the PETSc-powered radial basic function mappings.

   This enables the PETSc-based variant of radial basis function mappings which can run in parallel,
   also across different compute nodes. This is highly recommended for large cases running in parallel.

   This feature can be enabled/disabled by setting the PRECICE_PETScMapping CMake option.
   Requires MPICommunication.
  
 * PythonActions, Enables the support for user-defined python actions.

   preCICE allows to manipulate coupling data at runtime using configurable actions.
   This feature enables the support for user-defined actions written in Python based on numpy.

   This feature can be enabled/disabled by setting the PRECICE_PythonActions CMake option.
  

-- === DEPENDENCIES ===
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.80.0/BoostConfig.cmake (found suitable version "1.80.0", minimum required is "1.71.0") found components: filesystem log log_setup program_options system thread unit_test_framework 
-- Found Eigen3: /opt/homebrew/include/eigen3 (Required is at least version "3.2") 
-- Validating Eigen
CMake Error at cmake/Validation.cmake:53 (message):
  Validating Eigen - failure

  

  Change Dir:
  /Users/markashraf/Documents/Winter_22:23/Simulation_Engineering/Git_Repos/precice-2.5.0/build/validation/CMakeFiles/CMakeTmp


  

  Run Build Command(s):/usr/bin/make -f Makefile cmTC_d1167/fast &&
  /Applications/Xcode.app/Contents/Developer/usr/bin/make -f
  CMakeFiles/cmTC_d1167.dir/build.make CMakeFiles/cmTC_d1167.dir/build

  CMakeFiles/cmTC_d1167.dir/build.make:76: *** target pattern contains no
  `%'.  Stop.

  make: *** [cmTC_d1167/fast] Error 2

  

Call Stack (most recent call first):
  cmake/Validation.cmake:91 (precice_validate_lib)
  CMakeLists.txt:176 (precice_validate_eigen)


-- Configuring incomplete, errors occurred!
See also "/Users/markashraf/Documents/Winter_22:23/Simulation_Engineering/Git_Repos/precice-2.5.0/build/CMakeFiles/CMakeOutput.log".
See also "/Users/markashraf/Documents/Winter_22:23/Simulation_Engineering/Git_Repos/precice-2.5.0/build/CMakeFiles/CMakeError.log".
(base) markashraf@192 build % 

@MarkAshraf96 what Alex has asked below here

the full output of the configuration step would be helpful in determining what exactly is going wrong in your case. Comparing your system specifications to those that @ajaust has described, it certainly appears to be the case that you are doing something differently than him. One probable discrepancy is the compiler, are you also using clang (AppleClang 14.0.0)?

Thanks for the additional information.

It is interesting that Eigen is found, but could not be verified.

 CMakeFiles/cmTC_d1167.dir/build.make:76: *** target pattern contains no
  `%'.  Stop.

Do you know where that comes from?! Are you able to compile any Eigen example codes that do not involve preCICE?

I also see that you have some prefix in your terminal command line

(base) markashraf@192 build % 

which is prefixed with (base). Are you using any additional package manager or environment? I also use bash on MacOS while zsh would be the standard. Not sure if that would make a difference.

I just tried to compile preCICE again on another Machine with M1 Max CPU and MacOS 13.1 without errors. I am wondering what is going wrong. Could you maybe attach the following files mentioned in the output of CMake

See also "/Users/markashraf/Documents/Winter_22:23/Simulation_Engineering/Git_Repos/precice-2.5.0/build/CMakeFiles/CMakeOutput.log".
See also "/Users/markashraf/Documents/Winter_22:23/Simulation_Engineering/Git_Repos/precice-2.5.0/build/CMakeFiles/CMakeError.log".
(base) markashraf@192 build % 
2 Likes