amusecode / amuse

Astrophysical Multipurpose Software Environment. This is the main repository for AMUSE
http://www.amusecode.org
Apache License 2.0
154 stars 98 forks source link

Missing stoppingconditions.mod on arm64 #982

Closed GijsVermarien closed 1 year ago

GijsVermarien commented 1 year ago

Describe the bug I am trying to build Fi on a M2 macbook, but it seems that the compiler is not creating the stoppingconditions.mod file that is needed for Fi

So it crashes:

arm64-apple-darwin20.0.0-gfortran -I/Users/gijsv/projects/uclchem_teaching/installation_attempts/2023_amuse_conda/amuse/src/amuse/community/fi/build -g -O2 -DNOMPI -fno-common -fdefault-real-8 -O3 -ffree-line-length-256 -frecord-marker=4  -I/Users/gijsv/projects/uclchem_teaching/installation_attempts/2023_amuse_conda/amuse/lib/stopcond  -c -o muse_helpers.o ../src/muse_helpers.f90
../src/muse_helpers.f90:2:6:

    2 |  use StoppingConditions
      |      1
Fatal Error: Cannot open module file ‘stoppingconditions.mod’ for reading at (1): No such file or directory
compilation terminated.

It seems that unlike on x86_64 systems, the stoppingsconditions.mod is removed by the compiler during/after compilation (make stopcond.code). Causing it to not be able to link (AFAIK the .mod files are similar to .h files)

To Reproduce Here are the installation steps to reproduce this error on a M1/M2 macbook:

conda create -n amuse
conda activate amuse
conda config --env --set subdir osx-arm64
conda install -c conda-forge gfortran clang openmpi fftw openlibm python
git clone https://github.com/amusecode/amuse.git
export OMPI_CXX=clang++
cd amuse
pip install -r requirements.txt
pip install .
make stopcond.code
make fi.code

Expected behavior Fi to compile just like on x86_64 architectures, tested with gfortran 11.3.0 (don't have access to a newer fortran on an x86_64 machine).

Logs

Environment (please complete the following information):

rieder commented 1 year ago

Works fine for me on M1 with macports GCC… Yet another case of conda issues?

GijsVermarien commented 1 year ago

Which version of fortran do you use with macports? I can try and see if I can isolate the error a bit further. It just seems that the compiler cleans up the .mod files during/after compilation...

rieder commented 1 year ago

Gcc/gfortran 12. It's not supposed to do any cleaning of mod files in any case, unless you do a make clean!

GijsVermarien commented 1 year ago

Yes, so the problem might be that we use clang here as well, and it probably does some cleaning