Hi, I am building ElmerGUI Flatpak package, https://github.com/kevinsmia1939/flathub/tree/fi.csc.Elmer
but I have some problem understanding something about building package in general.
I got error while compiling ElmerGUI. I did build Open MPI before Elmer. But Elmer does not seems to find Open MPI.
65%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/TimeIntegrate.F90.o
65%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/ListMatrix.F90.o
65%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/IterativeMethods.F90.o
65%] Linking CXX executable ElmerGUI
65%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/IterSolve.F90.o
/usr/lib/gcc/x86_64-unknown-linux-gnu/10.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lMPI::MPI_C
65%] Building Fortran object fem/src/CMakeFiles/elmersolver.dir/SParIterSolver.F90.o
collect2: error: ld returned 1 exit status
make[2]: *** [ElmerGUI/Application/CMakeFiles/ElmerGUI.dir/build.make:1352: ElmerGUI/Application/ElmerGUI] Error 1
make[1]: *** [CMakeFiles/Makefile2:24531: ElmerGUI/Application/CMakeFiles/ElmerGUI.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
I can check where and what Open MPI ld is looking for using
ld -IMPI --verbose
ld: mode elf_x86_64
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/libMPI.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/libMPI.a failed
attempt to open /usr/lib/x86_64-linux-gnu/libMPI.so failed
attempt to open /usr/lib/x86_64-linux-gnu/libMPI.a failed
attempt to open /usr/lib/libMPI.so failed
attempt to open /usr/lib/libMPI.a failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib/libMPI.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib/libMPI.a failed
ld: cannot find -lMPI
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/libMPI.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/MPI.a failed
attempt to open /usr/lib/x86_64-linux-gnu/libMPI.so failed
attempt to open /usr/lib/x86_64-linux-gnu/MPI.a failed
attempt to open /usr/lib/libMPI.so failed
attempt to open /usr/lib/MPI.a failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib/libMPI.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib/MPI.a failed
Error: module test: Child process exited with code 1
Is it normal for ld to not find Open MPI in /usr because in case of Flatpak, it is installed in /app
So I use,
ld -L/app/lib -lMPI --verbose
attempt to open /app/lib/libMPI.so succeeded
/app/lib/libMPI.so
bla bla
which it does find Open MPI.
But with
ld -L/app/lib -lMPI::MPI_C --verbose
ld: mode elf_x86_64
attempt to open /app/lib/libMPI::MPI_C.so failed
attempt to open /app/lib/libMPI::MPI_C.a failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/libMPI::MPI_C.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/libMPI::MPI_C.a failed
attempt to open /usr/lib/x86_64-linux-gnu/libMPI::MPI_C.so failed
attempt to open /usr/lib/x86_64-linux-gnu/libMPI::MPI_C.a failed
attempt to open /usr/lib/libMPI::MPI_C.so failed
attempt to open /usr/lib/libMPI::MPI_C.a failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib/libMPI::MPI_C.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib/libMPI::MPI_C.a failed
ld: cannot find -lMPI::MPI_C
attempt to open /app/lib/libMPI::MPI_C.so failed
attempt to open /app/lib/MPI::MPI_C.a failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/libMPI::MPI_C.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib64/MPI::MPI_C.a failed
attempt to open /usr/lib/x86_64-linux-gnu/libMPI::MPI_C.so failed
attempt to open /usr/lib/x86_64-linux-gnu/MPI::MPI_C.a failed
attempt to open /usr/lib/libMPI::MPI_C.so failed
attempt to open /usr/lib/MPI::MPI_C.a failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib/libMPI::MPI_C.so failed
attempt to open /usr/x86_64-unknown-linux-gnu/lib/MPI::MPI_C.a failed
Error: module test: Child process exited with code 1
Failed, so…
I would like to know what the part “::MPI_C” mean. Thanks.