Description
Thank you for taking the time to submit an issue!
Background information
I am compiling an application (my own) which has C++ as the top level but also uses some C and F77 libraries. The build system is cmake on OSX via macports. The application is about 2 decades old now, and has successfully used various versions of MPI-1 for most of that time. Recently I added some new MPI memory and IO routines to do with Cartesian communicators and parallel IO, and have created a small set of linkage problems if using openmpi (they can however be linked successfully if I use mpich). The problem has persisted across two OS X versions, so I suspect the problem lies in openmpi code base. It has the flavour of a misplaced "extern" declaration in a header file.
What version of Open MPI are you using? (e.g., v4.1.6, v5.0.1, git branch name and hash, etc.)
4.1.6
Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)
Installed via macports. (Of course this leaves open the possibility that the problem lies there...)
sudo port -N install openmpi +gfortran
sudo port select --set mpi openmpi-mp-fortran
If you are building/installing from a git clone, please copy-n-paste the output from git submodule status
.
Please describe the system on which you are running
- Operating system/version: MacOS Sonoma (14.2.1) + Xcode15
- Computer hardware: Mac Studio and Macbook Pro (ARM M2)
- Network type: SMP/single machine
Details of the problem
The build fails at the linkage stage, unable to find 4 low-level (not API-level) MPI routines called from various object files. Below is a clip of the relevant messages.
[ 53%] Linking CXX executable elliptic_mp
Undefined symbols for architecture arm64:
"__ZN3MPI3Win4FreeEv", referenced from:
__ZTVN3MPI3WinE in auxfield.cpp.o
__ZTVN3MPI3WinE in data2df.cpp.o
__ZTVN3MPI3WinE in domain.cpp.o
__ZTVN3MPI3WinE in geometry.cpp.o
__ZTVN3MPI3WinE in mesh.cpp.o
__ZTVN3MPI3WinE in message.cpp.o
__ZTVN3MPI3WinE in helmholtz.cpp.o
...
"__ZN3MPI4CommC2Ev", referenced from:
__ZNK3MPI9Intracomm5CloneEv in auxfield.cpp.o
__ZNK3MPI9Graphcomm5CloneEv in auxfield.cpp.o
__ZNK3MPI8Cartcomm3SubEPKb in auxfield.cpp.o
__ZNK3MPI9Intracomm12Create_graphEiPKiS2_b in auxfield.cpp.o
__ZNK3MPI8Cartcomm5CloneEv in auxfield.cpp.o
__ZNK3MPI9Intracomm11Create_cartEiPKiPKbb in auxfield.cpp.o
__ZNK3MPI9Intercomm5MergeEb in auxfield.cpp.o
...
"__ZN3MPI8Datatype4FreeEv", referenced from:
__ZTVN3MPI8DatatypeE in auxfield.cpp.o
__ZTVN3MPI8DatatypeE in data2df.cpp.o
__ZTVN3MPI8DatatypeE in domain.cpp.o
__ZTVN3MPI8DatatypeE in geometry.cpp.o
__ZTVN3MPI8DatatypeE in mesh.cpp.o
__ZTVN3MPI8DatatypeE in message.cpp.o
__ZTVN3MPI8DatatypeE in helmholtz.cpp.o
...
"_ompi_mpi_cxx_op_intercept", referenced from:
__ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb in auxfield.cpp.o
__ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb in data2df.cpp.o
__ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb in domain.cpp.o
__ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb in geometry.cpp.o
__ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb in mesh.cpp.o
__ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb in message.cpp.o
__ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb in helmholtz.cpp.o
...
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make[2]: *** [elliptic_mp] Error 1
make[1]: *** [CMakeFiles/elliptic_mp.dir/all] Error 2
make: *** [all] Error 2
These linkage errors do not occur if I use mpich instead of openmpi (but right now I have issues with mpich not working on Sonoma). As I said, this looks like it could be an issue with C++ mangling routine names as a result of a misplaced "extern" declaration in a header.
An older code version which used a smaller subset of MPI continues to compile and run fine.