sourceryinstitute / OpenCoarrays

A parallel application binary interface for Fortran 2018 compilers.
http://www.opencoarrays.org
BSD 3-Clause "New" or "Revised" License
243 stars 58 forks source link

Bug: fpm fails to find garden object files #756

Closed rouson closed 2 years ago

rouson commented 2 years ago

System information including:

To help us debug your issue please explain:

What happened (include command output, screenshots, logs, etc.)

Running.install.sh builds and installs ~/.local/bin/caf, ~/.local/bin/cafrun but emits linker errors if the form

ar: build/caf_3E83561A255DFE60/opencoarrays/build_dependencies_garden_src_garden.f90.o: No such file or directory

and several messages about other files missing. In each case, a similarly-named file with .digest appended at the end of the file name is present in the build tree.

What you expected to happen

A successful build and installation of libopencoarrays.a.

Step-by-step reproduction instructions to reproduce the error/bug

git clone -b fpm-build git@github.com:sourceryinstitute/opencoarrays
cd opencoarrays
./install.sh
everythingfunctional commented 2 years ago

After fiddling around with it on my Linux machine, I can make the following observations.

I found a place that MPICC and MPIFC were mixed up in the install.sh script. I've already pushed a commit to fix that.

The install.sh is trying to use caf to build OpenCoarrays. On my machine I get the following error for that.

 + /home/brad/.local/bin/caf -c example/hello.f90  -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g -fcheck=bounds -fcheck=array-temps -fbacktrace -J build/caf_3E83561A255DFE60 -Ibuild/caf_3E83561A255DFE60 -o build/caf_3E83561A255DFE60/opencoarrays/example_hello.f90.o
Failed to find static library /home/brad/.local/lib/libopencoarrays.a or shared library alternatives.
Error in /home/brad/.local/bin/caf in function . on line 224. Please report this error at http://bit.ly/OpenCoarrays-new-issue

It looks like caf isn't exiting with a non-zero status, so fpm doesn't detect the failure and keeps on going. By the time it gets to the archive command, none (most) of the object files haven't actually been created.

I tried switching to using mpifort directly, but it needs the right compile and link flags for that to work properly (I think), because I get warnings like the following.

 + /usr/bin/mpifort -c example/hello.f90  -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g -fcheck=bounds -fcheck=array-temps -fbacktrace -fcoarray=single -J build/mpifort_2A42023B310FA28D -Ibuild/mpifort_2A42023B310FA28D -o build/mpifort_2A42023B310FA28D/opencoarrays/example_hello.f90.o
f951: Warning: Nonexistent include directory '/usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/openmpi' [-Wmissing-include-dirs]

I also think there might be something wrong with my openmpi installation, because I get the following error.

 + /usr/bin/mpicc -c ././src/mpi-runtime/mpi_caf.c  -DPREFIX_NAME=_gfortran_caf_ -DGCC_GE_7 -DGCC_GE_8 -o build/mpifort_EA4E6F5B6A428512/opencoarrays/src_mpi-runtime_mpi_caf.c.o
././src/mpi-runtime/mpi_caf.c:46:10: fatal error: mpi.h: No such file or directory
   46 | #include <mpi.h>
      |          ^~~~~~~
compilation terminated.

I think we should put our heads together on this one. Let's try and get on a call some time today.