Building MPICH with LLVM 20.1.0-rc3
I have been trying to build MPICH with LLVM 20.1.0-rc3 and I get an error which, I think, is due to some configuration step during the build.
MPICH 4.3.0 built from source tarball
Source code:
program llvb
use mpi_f08
integer :: v(10)
end program llvb
Compilation:
sfilippo@euler GitHub]$ mpifort -o llvb llvb.f90
/usr/bin/ld: /opt/mpich/4.3.0/llvm/20.1.0/lib/libmpifort.so: undefined reference to `_FortranACopyAndUpdateDescriptor'
/usr/bin/ld: /opt/mpich/4.3.0/llvm/20.1.0/lib/libmpifort.so: undefined reference to `_FortranACopyInAssign'
flang-20: error: linker command failed with exit code 1 (use -v to see invocation)
[sfilippo@euler GitHub]$ mpifort -v
mpifort for MPICH version 4.3.0
flang version 20.1.0-rc3
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /software/opt/llvm/20.1.0/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/13
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/14
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/14
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
flang-20: warning: argument unused during compilation: '-I /opt/mpich/4.3.0/llvm/20.1.0/include' [-Wunused-command-line-argument]
flang-20: warning: argument unused during compilation: '-I /opt/mpich/4.3.0/llvm/20.1.0/include' [-Wunused-command-line-argument]
[sfilippo@euler GitHub]$
There is a workaround:
[sfilippo@euler GitHub]$ mpifort -o llvb llvb.f90 -lFortranRuntime -L/opt/llvm/20.1.0/lib
[sfilippo@euler GitHub]$
but I do not think I should be forced to add explicitly libraries and paths from within the compiler installation.
but I do not think I should be forced to add explicitly libraries and paths from within the compiler installation.
In principle, Fortran compiler is supposed to add any Fortran runtime libraries. Anyway, we'll look into it. Thanks for reporting.
The Fortran compiler on its own adds all the necessary libraries, it's the mpifort script that is missing something
Il lun 3 mar 2025, 19:19 Hui Zhou @.***> ha scritto:
but I do not think I should be forced to add explicitly libraries and paths from within the compiler installation.
In principle, Fortran compiler is supposed to add any Fortran runtime libraries. Anyway, we'll look into it. Thanks for reporting.
— Reply to this email directly, view it on GitHub https://github.com/pmodels/mpich/issues/7315#issuecomment-2695205022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD274T65JW7BC53GJVWHCTD2SSMMVAVCNFSM6AAAAABYEKPBOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOJVGIYDKMBSGI . You are receiving this because you authored the thread.Message ID: @.***> [image: hzhou]hzhou left a comment (pmodels/mpich#7315) https://github.com/pmodels/mpich/issues/7315#issuecomment-2695205022
but I do not think I should be forced to add explicitly libraries and paths from within the compiler installation.
In principle, Fortran compiler is supposed to add any Fortran runtime libraries. Anyway, we'll look into it. Thanks for reporting.
— Reply to this email directly, view it on GitHub https://github.com/pmodels/mpich/issues/7315#issuecomment-2695205022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD274T65JW7BC53GJVWHCTD2SSMMVAVCNFSM6AAAAABYEKPBOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOJVGIYDKMBSGI . You are receiving this because you authored the thread.Message ID: @.***>
Update: I have multiple compiler versions on my system, including a distribution-package clang-devel and flang-devel version 18. If I delete the prepackaged versions and leave only version 20.1.0-rc3 compiled by hand, everything works. There has been some discussion over at OpenMPI, which was showing the same issue, and there is now an issue open with LLVM, because the problem is in the interaction between the MPI configure script and the LLVM compiler, apparently requires some sort of agreement of multiple parties.