0 votes
ago by (520 points)
retagged ago by

I am trying to install OpenCarp onto a MacBook Pro with an M1 MAX chip. While following the building from the source guideline, I have been able to successfully use the following commands:

cmake -S. -B_build -DDLOPEN=ON -DBUILD_EXTERNAL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/opt/homebrew/" -DCMAKE_C_COMPILER=/usr/bin/clang   -DCMAKE_CXX_COMPILER=/usr/bin/clang++   -DOpenMP_omp_LIBRARY="/opt/homebrew/opt/libomp/lib/libomp.dylib" -DCMAKE_CXX_STANDARD_LIBRARIES="/opt/homebrew/opt/libomp/lib/libomp.dylib" -DPETSC_DIR=/opt/homebrew/Cellar/petsc/3.24.1   -DPETSC_ARCH=arch-darwin-c-opt -DPETSC_INCLUDE_DIRS=/opt/homebrew/Cellar/petsc/3.24.1/include   -DPETSC_LIBRARIES="/opt/homebrew/Cellar/petsc/3.24.1/lib/libpetsc.dylib

cmake --build _build

However, while I am trying to move towards the next step of installation using this command: make setup, I got these errors:

make update

--- updating openCARP -------------------------------------

Already up to date.

make all

 * SIMULATOR: compiling openCARP_p.cc

mpicxx -c -I../param/include  -std=c++17 -Wno-deprecated -Wno-unused-result -Wno-deprecated-declarations -Wno-implicit-const-int-float-conversion -Wno-unused-command-line-argument -O2 -g -DWITH_PETSC  -DSOLVE_CURRENT -DWITH_BLAS -D_GNU_SOURCE -I.  -I../simulator -I../physics/limpet/src -I../fem -I../fem/slimfem -I../fem/slimfem/src -I../physics       -I../numerics -I/usr/include/malloc -I../numerics/petsc -I../numerics/ginkgo  -I../param/include  -I/opt/homebrew/Cellar/petsc/3.24.1/include -I/opt/homebrew/opt/fftw/include -I/opt/homebrew/opt/hdf5-mpi/include -I/opt/homebrew/opt/metis/include   -MMD -O0 openCARP_p.cc -o build/openCARP_p.o

make[2]: `libnumerics.opt.a' is up to date.

make[2]: `libfem.opt.a' is up to date.

 * creating archive:  liblimpet

 * Linking binary  bench

mpicxx -o bench.opt -std=c++17 -Wno-deprecated -Wno-unused-result -Wno-deprecated-declarations -Wno-implicit-const-int-float-conversion -Wno-unused-command-line-argument -O2 -g -DWITH_PETSC -DSOLVE_CURRENT -DWITH_BLAS -D_GNU_SOURCE -I. -I../../simulator -I../../physics/limpet/src -I../../fem -I../../fem/slimfem -I../../fem/slimfem/src -I../../physics -I../../numerics -I/usr/include/malloc -I../../numerics/petsc -I../../numerics/ginkgo -I../../param/include -I/opt/homebrew/Cellar/petsc/3.24.1/include -I/opt/homebrew/opt/fftw/include -I/opt/homebrew/opt/hdf5-mpi/include -I/opt/homebrew/opt/metis/include -MMD -Wno-shadow -Wno-pedantic -Wno-sign-compare -Wno-switch-default -Wno-format-nonliteral -Wno-narrowing -Wno-newline-eof -Wno-self-assign -Wno-uninitialized -Wno-cast-align -DCPU_GENERATED build/cmdline.o build/bench.o build/bench_utils.o build/clamp.o build/ap_analyzer.o build/restitute.o build/stretch.o build/target.o -Wl,-rpath,/opt/homebrew/Cellar/petsc/3.24.1/lib -L/opt/homebrew/Cellar/petsc/3.24.1/lib -Wl,-rpath,/opt/homebrew/opt/fftw/lib -L/opt/homebrew/opt/fftw/lib -Wl,-rpath,/opt/homebrew/opt/scalapack/lib -L/opt/homebrew/opt/scalapack/lib -Wl,-rpath,/opt/homebrew/opt/hdf5-mpi/lib -L/opt/homebrew/opt/hdf5-mpi/lib -Wl,-rpath,/opt/homebrew/opt/metis/lib -L/opt/homebrew/opt/metis/lib -Wl,-rpath,/opt/homebrew/Cellar/open-mpi/5.0.8/lib -L/opt/homebrew/Cellar/open-mpi/5.0.8/lib -Wl,-rpath,/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/15 -L/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/15 -Wl,-rpath,/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current/gcc -L/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current/gcc -Wl,-rpath,/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current -L/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current -lpetsc -lfftw3_mpi -lfftw3 -lscalapack -llapack -lblas -lhdf5_hl_fortran -lhdf5_fortran -lhdf5_hl_f90cstub -lhdf5_f90cstub -lhdf5_hl -lhdf5 -lmetis -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lgfortran -lemutls_w -lheapt_w -lgfortran -lquadmath -lc++ -L. -llimpet.opt -L../../numerics -lnumerics.opt ../../fem/build/sf_interface.o -lz -lm -ldl

mpicxx -o bench.opt  -std=c++17 -Wno-deprecated -Wno-unused-result -Wno-deprecated-declarations -Wno-implicit-const-int-float-conversion -Wno-unused-command-line-argument -O2 -g -DWITH_PETSC  -DSOLVE_CURRENT -DWITH_BLAS -D_GNU_SOURCE -I.  -I../../simulator -I../../physics/limpet/src -I../../fem -I../../fem/slimfem -I../../fem/slimfem/src -I../../physics       -I../../numerics -I/usr/include/malloc -I../../numerics/petsc -I../../numerics/ginkgo  -I../../param/include  -I/opt/homebrew/Cellar/petsc/3.24.1/include -I/opt/homebrew/opt/fftw/include -I/opt/homebrew/opt/hdf5-mpi/include -I/opt/homebrew/opt/metis/include   -MMD -Wno-shadow -Wno-pedantic -Wno-sign-compare -Wno-switch-default -Wno-format-nonliteral -Wno-narrowing -Wno-newline-eof -Wno-self-assign -Wno-uninitialized -Wno-cast-align -DCPU_GENERATED  build/cmdline.o build/bench.o build/bench_utils.o build/clamp.o build/ap_analyzer.o build/restitute.o build/stretch.o build/target.o -Wl,-rpath,/opt/homebrew/Cellar/petsc/3.24.1/lib -L/opt/homebrew/Cellar/petsc/3.24.1/lib -Wl,-rpath,/opt/homebrew/opt/fftw/lib -L/opt/homebrew/opt/fftw/lib -Wl,-rpath,/opt/homebrew/opt/scalapack/lib -L/opt/homebrew/opt/scalapack/lib -Wl,-rpath,/opt/homebrew/opt/hdf5-mpi/lib -L/opt/homebrew/opt/hdf5-mpi/lib -Wl,-rpath,/opt/homebrew/opt/metis/lib -L/opt/homebrew/opt/metis/lib -Wl,-rpath,/opt/homebrew/Cellar/open-mpi/5.0.8/lib -L/opt/homebrew/Cellar/open-mpi/5.0.8/lib -Wl,-rpath,/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/15 -L/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/15 -Wl,-rpath,/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current/gcc -L/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current/gcc -Wl,-rpath,/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current -L/opt/homebrew/Cellar/gcc/15.2.0/lib/gcc/current -lpetsc -lfftw3_mpi -lfftw3 -lscalapack -llapack -lblas -lhdf5_hl_fortran -lhdf5_fortran -lhdf5_hl_f90cstub -lhdf5_f90cstub -lhdf5_hl -lhdf5 -lmetis -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lgfortran -lemutls_w -lheapt_w -lgfortran -lquadmath -lc++ -L. -llimpet.opt -L../../numerics -lnumerics.opt ../../fem/build/sf_interface.o -lz -lm -ldl

ld: warning: ignoring duplicate libraries: '-lc++', '-lgfortran', '-lmpi'

Undefined symbols for architecture arm64:

  "SF::init_vector_petsc(SF::abstract_vector<int, double>**)", referenced from:

      void SF::init_vector<int, double>(SF::abstract_vector<int, double>**, int, int, int, SF::abstract_vector<int, double>::ltype) in bench.o

      void SF::init_vector<int, double>(SF::abstract_vector<int, double>**, SF::abstract_vector<int, double>*) in bench.o

  "opencarp::initialize_PETSc(int*, char**, char*, char*)", referenced from:

      _main in bench.o

ld: symbol(s) not found for architecture arm64

clang++: error: linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [bench] Error 1

make[1]: *** [openCARP] Error 2

make: *** [setup] Error 2

Not sure what else I could do to fix this error. Could someone help me with this issue? Thank you so much

ago by (520 points)
Additionally, I believe I have installed the required packages (e.g., PETSc, libomp, llvm) using Homebrew, and that they are built for the arm64 architecture.  I have also tried to set my environment variables:

export CC=clang

export CXX=clang++

export LDFLAGS="-L/opt/homebrew/opt/libomp/lib"

export CPPFLAGS="-I/opt/homebrew/opt/libomp/include"

export PETSC_DIR=/opt/homebrew/Cellar/petsc/3.24.1

export PETSC_ARCH=linux-gnu-c-debug

export PATH=$PATH:$PETSC_DIR/bin

PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH

PATH=/opt/homebrew/opt/llvm/bin:$PATH

export PATH

export OpenMP_ROOT=/opt/homebrew/opt/libomp

export CPATH=/opt/homebrew/opt/libomp/include

export LIBRARY_PATH=/opt/homebrew/opt/libomp/lib

export CMAKE_PREFIX_PATH="/opt/homebrew/opt/llvm"

export HDF5_DIR=/opt/homebrew

1 Answer

0 votes
ago by (20.1k points)

In which directory are you running the build commands.

I have a feeling that you are mixing the CMake and make based workflows. It should be 

Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...