candi icon indicating copy to clipboard operation
candi copied to clipboard

"unable to link a simple MPI-IO C program" on MacOS Ventura 13.1 Apple M1 chip

Open KiralyAgi opened this issue 2 years ago • 5 comments

Hello! I am trying to install deal.ii for ASPECT using candi on my mac. I run into a problem during the hdf5 installation:

checking whether a simple MPI-IO C program can be linked... no configure: error: unable to link a simple MPI-IO C program Failure with exit status: 1 Exit message: There was a problem configuring hdf5 1.10.7.

I reinstalled homebrew, tried both the deal.ii version 9.3 and 9.4. If I try to compile withouth hdf5 (./candi.sh -j 8 --packages="p4est trilinos dealii"), then I get MPI error for the p4est installation:

Build FAST version in /Users/kiraly/dealii-candi/tmp/build/p4est-2.3.2/FAST /Users/kiraly/dealii-candi/tmp/unpack/p4est-2.3.2/configure: line 4056: test: argument expected configure: WARNING: unknown Fortran name-mangling scheme configure: WARNING: unknown Fortran name-mangling scheme configure: error: MPI C test failed Error: Error in configure

Does anyone have some ideas what can I do?

Thanks, Ági

KiralyAgi avatar Jan 05 '23 11:01 KiralyAgi

Hi Agi, Are you following the instructions at https://github.com/dealii/dealii/wiki/Apple-ARM-M1-OSX? Can you show what mpicxx -v and mpicc -v report?

tjhei avatar Jan 05 '23 14:01 tjhei

Hi Timo,

Yes, I was following the wiki page. (Indeed, in the spring with some sweat and tears I made it work, but after some updates deal.ii stopped working). This is interesting. Initially if I check for mpicxx and mpi versions this is what I get: % mpicxx -v
Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin (same for mpicc) But If I use these lines first for GCC: export OMPI_FC=gfortran-11;export OMPI_CC=gcc-11;export OMPI_CXX=g++-11 then I get a long error about how much my mac is confused: gcc-11: warning: could not understand version 13.00.00 Using built-in specs. COLLECT_GCC=/usr/local/bin/gcc-11 COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc@11/11.3.0/bin/../libexec/gcc/x86_64-apple-darwin21/11/lto-wrapper Target: x86_64-apple-darwin21 Configured with: ../configure --prefix=/usr/local/opt/gcc@11 --libdir=/usr/local/opt/gcc@11/lib/gcc/11 --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran,d --program-suffix=-11 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-zstd=/usr/local/opt/zstd --with-pkgversion='Homebrew GCC 11.3.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --enable-libphobos --build=x86_64-apple-darwin21 --with-system-zlib --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.3.0 (Homebrew GCC 11.3.0)

So I didn't do that before trying to install deal.ii with candi. And during installation it seems it finds the homebrew locations of everything: Compiler Variables:

CC variable not set, but default mpicc found. CC = /opt/homebrew/bin/mpicc CXX variable not set, but default mpicxx found. CXX = /opt/homebrew/bin/mpicxx FC variable not set, but default mpif90 found. FC = /opt/homebrew/bin/mpif90 FF variable not set, but default mpif77 found. FF = /opt/homebrew/bin/mpif77

Ági

KiralyAgi avatar Jan 05 '23 16:01 KiralyAgi

I would strongly advise against using GCC (by exporting gcc-11 settings). Have you tried using clang?

tjhei avatar Jan 05 '23 20:01 tjhei

I am might be wrong, but if I don't export gcc, then the mpicxx version remains the Apple clang version 14, correct? I tried installing with that too (that's where I copied the Compiler Variables section) and got the same error.

KiralyAgi avatar Jan 05 '23 20:01 KiralyAgi

I had some progress. Because I had mpicc, mpicxx, mpifort both in homebrew and in my /usr/local/bin there was problem with different versions. So I exported CC, CXX, FF and FC to the /usr/local/bin/ versions of mpi. This helped with installing hdf5 and p4est, but now I have a problem with trillions. The error in the CMake.error.log file looks like this: .... ld: warning: ignoring file /opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/gcc/aarch64-apple-darwin22/12/libgcc.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 Undefined symbols for architecture x86_64: "_VerifyFortran", referenced from: _main in main.c.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am a bit confused why does this happen. I have macOS-arm64 architecture. (I attach the log file) CMakeError.log

KiralyAgi avatar Jan 11 '23 15:01 KiralyAgi