Big picture: Attempting to compile elmerfem on an M3 silicon Mac with parallel computing abilities
Litle steps: Get some of the prerequisite libraries compiled with homebrew installed open-mpi or gcc.
Step one: get parMETIS compiled. Obtaining ParMETIS | Karypis Lab CMake wants to use AppleCLang for the compilers, I want to use the homebrew installed gcc and tools for my platform. Simply setting the prefix to /opt/homebrew has not proven sufficient, as Cmake is pulling in Apple compiler stuff, not the homebrew installed libraries and helpers. Sort of fixed that by creating a hombrew.cmake file that sets the tool chain. Unfortunately, this results in Cmake not being able to find source files. So I am asking for some help.
% rm -r build
(base)parmetis % cmake . -B build -DCMAKE_TOOLCHAIN_FILE=$PWD/homebrew.cmake
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 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 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/bin/aarch64-apple-darwin23-gcc-13 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/bin/aarch64-apple-darwin23-g++-13 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
failed to create symbolic link 'metis' because existing path cannot be removed: Operation not permitted
-- Looking for execinfo.h
-- Looking for execinfo.h - found
-- Looking for getline
-- Looking for getline - found
CMake Error at /Users/me/myApps/parmetis/build/CMakeFiles/CMakeTmp/CMakeLists.txt:18 (target_sources):
Cannot find source file:
METIS/GKlib/conf/check_thread_storage.c
CMake Error at /Users/me/myApps/parmetis/build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
No SOURCES given to target: cmTC_53873
CMake Error at METIS/GKlib/GKlibSystem.cmake:110 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
CMakeLists.txt:26 (include)
-- Configuring incomplete, errors occurred!
Seems I cannot upload a small attachment (1K). Contents of homebrew.cmake
set(HOMEBREW_PREFIX "/opt/homebrew"
CACHE PATH "Path to Homebrew installation")
set(CMAKE_C_COMPILER "${HOMEBREW_PREFIX}/bin/aarch64-apple-darwin23-gcc-13")
set(CMAKE_CXX_COMPILER "${HOMEBREW_PREFIX}/bin/aarch64-apple-darwin23-g++-13")
set(CMAKE_RANLIB "${HOMEBREW_PREFIX}/bin/aarch64-apple-darwin23-gcc-ranlib-13")
set(CMAKE_AR "${HOMEBREW_PREFIX}/bin/aarch64-apple-darwin23-gcc-ar-13")
set(CMAKE_Fortran_COMPILER "${HOMEBREW_PREFIX}/bin/aarch64-apple-darwin23-gfortran-13")
set(CMAKE_PREFIX_PATH
"${HOMEBREW_PREFIX}"
# These libraries are keg-only and not loaded into
# the root prefix by default (to avoid clashes).
"${HOMEBREW_PREFIX}/opt/lapack"
"${HOMEBREW_PREFIX}/opt/openblas"
"${HOMEBREW_PREFIX}/opt/gcc"
"${HOMEBREW_PREFIX}/opt/scalapack"
"${HOMEBREW_PREFIX}/opt/open-mpi"
"${HOMEBREW_PREFIX}/opt/openmpi"
)
list(TRANSFORM CMAKE_PREFIX_PATH APPEND "/include"
OUTPUT_VARIABLE CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES}")
set(CMAKE_FIND_FRAMEWORK NEVER)
set(CMAKE_FIND_APPBUNDLE NEVER)
set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE)
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH FALSE)
Thanks for any and all help.