Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake build error on fpm-dev-build branch: make can't find a .mod file #759

Open
rouson opened this issue Jun 5, 2022 · 2 comments
Open

Comments

@rouson
Copy link
Member

rouson commented Jun 5, 2022

What happened

A test failed to compile because make couldn't find a required .mod file that is in the build tree.

System Information

uname -a
Darwin CLaSS.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
  • Hardware: 2.3 GHz 8-Core Intel Core i9
  • CMake Version: 3.23.2 (installed by Homebrew)

Step-by-step reproduction of the error

With Homebrew installed, execute

brew tap fortran-lang/fortran
brew install fpm open-mpi cmake
git clone -b fpm-dev-build [email protected]:sourceryinstitute/opencoarrays
cd opencoarrays
export CC=`which gcc-11`
export CXX=`which g++-11`
export FC=`which gfortran-11`
cmake -B build .
cd build
make -j 8

for which the trailing output is

[ 78%] Generating teams_subset
/Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/tests/unit/teams/team-number.f90:34:7:

   34 |   use oc_assertions_interface, only : assert
      |       1
Fatal Error: Cannot open module file 'oc_assertions_interface.mod' for reading at (1): No such file or directory
compilation terminated.
Error: comand:
   `/usr/local/bin/gfortran-11 -fcoarray=lib -Wl,-flat_namespace -Wl,-commons,use_dylibs -L/usr/local/Cellar/libevent/2.1.12/lib -I/usr/local/Cellar/open-mpi/4.1.4/include -I/usr/local/Cellar/open-mpi/4.1.4/lib -DPREFIX_NAME=_gfortran_caf_ -DGCC_GE_7 -DGCC_GE_8 -DHAVE_MPI -DMPI_WORKING_MODULE -O3 -DNDEBUG -O3 -o /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/bin/OpenCoarrays-2.10.0-17-g7f75c50-tests/team_number /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/tests/unit/teams/team-number.f90 /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libopencoarrays_test_utilities.a /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libopencoarrays_mod.a /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libcaf_mpi.a /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_usempif08.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_usempi_ignore_tkr.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_mpifh.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi.dylib`
failed to compile.
make[2]: *** [tests/unit/teams/team_number] Error 1
make[1]: *** [tests/unit/teams/CMakeFiles/build_team_number.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 78%] Built target build_image_fail_and_sync_test_2
/Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/tests/unit/teams/teams_subset.f90:6:7:

    6 |   use oc_assertions_interface, only : assert
      |       1
Fatal Error: Cannot open module file 'oc_assertions_interface.mod' for reading at (1): No such file or directory
compilation terminated.
Error: comand:
   `/usr/local/bin/gfortran-11 -fcoarray=lib -Wl,-flat_namespace -Wl,-commons,use_dylibs -L/usr/local/Cellar/libevent/2.1.12/lib -I/usr/local/Cellar/open-mpi/4.1.4/include -I/usr/local/Cellar/open-mpi/4.1.4/lib -DPREFIX_NAME=_gfortran_caf_ -DGCC_GE_7 -DGCC_GE_8 -DHAVE_MPI -DMPI_WORKING_MODULE -O3 -DNDEBUG -O3 -o /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/bin/OpenCoarrays-2.10.0-17-g7f75c50-tests/teams_subset /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/tests/unit/teams/teams_subset.f90 /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libopencoarrays_test_utilities.a /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libopencoarrays_mod.a /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libcaf_mpi.a /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_usempif08.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_usempi_ignore_tkr.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_mpifh.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi.dylib`
failed to compile.
make[2]: *** [tests/unit/teams/teams_subset] Error 1
make[1]: *** [tests/unit/teams/CMakeFiles/build_teams_subset.dir/all] Error 2
[ 78%] Built target build_image_fail_and_sync_test_3
[ 78%] Built target build_image_fail_and_failed_images_test_1
[ 78%] Built target build_image_fail_and_stopped_images_test_1
[ 78%] Built target build_image_fail_and_get_test_1
[ 78%] Built target build_image_fail_and_status_test_1
make: *** [all] Error 2
@rouson
Copy link
Member Author

rouson commented Jun 5, 2022

Commenting out lines 1-2 in tests/unit/teams/CMakeLists.txt eliminates the above two errors and leaves one similar error (see below), which in turn can be eliminated by commenting out line 3 in the same file. Each of the aforementioned lines invokes the function defined at line 563 in the project root CMakeLists.txt file. I suspect that the ultimate cause is related to the fact that I moved the entire tests directory from its previous location just inside src one level up to the project root directory. Otherwise, one of the biggest changes is that we recently recently released version 2.10.0, which adds support for building natively on Windows (without requiring Windows Subsystem for Linux).

/Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/tests/unit/teams/get-communicator.F90:32:7:

   32 |   use opencoarrays, only : get_communicator
      |       1
Fatal Error: Cannot open module file 'opencoarrays.mod' for reading at (1): No such file or directory
compilation terminated.
Error: comand:
   `/usr/local/bin/gfortran-11 -fcoarray=lib -Wl,-flat_namespace -Wl,-commons,use_dylibs -L/usr/local/Cellar/libevent/2.1.12/lib -I/usr/local/Cellar/open-mpi/4.1.4/include -I/usr/local/Cellar/open-mpi/4.1.4/lib -DPREFIX_NAME=_gfortran_caf_ -DGCC_GE_7 -DGCC_GE_8 -DHAVE_MPI -DMPI_WORKING_MODULE -O3 -DNDEBUG -O3 -o /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/bin/OpenCoarrays-2.10.0-17-g7f75c50-tests/get_communicator /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/tests/unit/teams/get-communicator.F90 /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libopencoarrays_test_utilities.a /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libopencoarrays_mod.a /Users/rouson/Repositories/sourceryinstitute/tmp/opencoarrays/build/lib/libcaf_mpi.a /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_usempif08.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_usempi_ignore_tkr.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi_mpifh.dylib /usr/local/Cellar/open-mpi/4.1.4/lib/libmpi.dylib`
failed to compile.
make[2]: *** [tests/unit/teams/get_communicator] Error 1
make[1]: *** [tests/unit/teams/CMakeFiles/build_get_communicator.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 77%] Built target build_image_fail_and_sync_test_2
[ 77%] Built target build_image_fail_and_sync_test_3
[ 77%] Built target build_image_fail_and_status_test_1
[ 77%] Built target build_image_fail_and_get_test_1
[ 77%] Built target build_image_fail_and_failed_images_test_1
[ 77%] Built target build_image_fail_and_stopped_images_test_1
[ 77%] Built target build_teams_coarray_get
make: *** [all] Error 2

@bradking
Copy link

The failure occurs in a custom command that invokes the bin/caf tool. That builds module-consuming code outside of CMake's code model, so module (include) directories need to be handled explicitly. See explanation in #758 (review).

rouson added a commit that referenced this issue Jun 15, 2022
This commit applies the patch provided Brad King in a review of
PR #758.
@vehre vehre mentioned this issue Oct 8, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants