PrincetonUniversity / tristan-mp-v2

Tristan-MP v2 [public]
https://princetonuniversity.github.io/tristan-v2/
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

An error of 'Cannot open module file' occurred at compile time #18

Open marc-shen opened 5 months ago

marc-shen commented 5 months ago
Fatal Error: Cannot open module file 'module_name.mod' for reading at (1): No such file or directory
compilation terminated.

Such as:

Fatal Error: Cannot open module file 'm_domain.mod' for reading at (1): No such file or directory
compilation terminated.

Fatal Error: Cannot open module file 'm_domain.mod' for reading at (1): No such file or directory
compilation terminated.

Fatal Error: Cannot open module file 'm_domain.mod' for reading at (1): No such file or directory
compilation terminated.

My computer configuration is an ARM architecture Mac Book pro with M1 chip. My Makefile was generated by the following command:

python3 configure.py -mpi08 -hdf5 --user=user_2d_rec -2d
haykh commented 5 months ago

ouch... i've never tested the code on arm, unfortunately. what compiler are you using? can you try to compile a simple fortran program?

marc-shen commented 5 months ago

The fortran environment is gfortran + openmpi + hdf5.

The gfortran, openmpi and h5pfc all can compile some simple fortran program.

Here is my environment.

❯ gfortran -v                                                                                                                                      ─╯
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../libexec/gcc/aarch64-apple-darwin23/14/lto-wrapper
Target: aarch64-apple-darwin23
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-14 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 14.1.0_1' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin23 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.0 (Homebrew GCC 14.1.0_1)
❯ mpif90 -v                                                                                                                                        ─╯
Using built-in specs.
COLLECT_GCC=/opt/homebrew/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../libexec/gcc/aarch64-apple-darwin23/14/lto-wrapper
Target: aarch64-apple-darwin23
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-14 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 14.1.0_1' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin23 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.0 (Homebrew GCC 14.1.0_1)
❯ h5pfc -v                                                                                                                        
Driving: /opt/homebrew/bin/gfortran -I/opt/homebrew/Cellar/hdf5-mpi/1.14.3/include -v -L/opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib /opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib/libhdf5hl_fortran.a /opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib/libhdf5_hl.a /opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib/libhdf5_fortran.a /opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib/libhdf5.a -L/opt/homebrew/opt/libaec/lib -Wl,-ld_classic -lsz -lz -ldl -lm -I/opt/homebrew/Cellar/open-mpi/5.0.3_1/include -Wl,-flat_namespace -Wl,-commons,use_dylibs -Wl,-ld_classic -I/opt/homebrew/Cellar/open-mpi/5.0.3_1/lib -L/opt/homebrew/Cellar/open-mpi/5.0.3_1/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -mmacosx-version-min=14.0.0 -asm_macosx_version_min=14.0 -nodefaultexport -l gfortran
Using built-in specs.
COLLECT_GCC=/opt/homebrew/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../libexec/gcc/aarch64-apple-darwin23/14/lto-wrapper
Target: aarch64-apple-darwin23
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-14 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 14.1.0_1' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin23 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.0 (Homebrew GCC 14.1.0_1)
Reading specs from /opt/homebrew/Cellar/gcc/14.1.0_1/bin/../lib/gcc/current/gcc/aarch64-apple-darwin23/14/../../../libgfortran.spec
rename spec lib to liborig
COLLECT_GCC_OPTIONS='-I' '/opt/homebrew/Cellar/hdf5-mpi/1.14.3/include' '-v' '-L/opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib' '-L/opt/homebrew/opt/libaec/lib' '-I' '/opt/homebrew/Cellar/open-mpi/5.0.3_1/include' '-I' '/opt/homebrew/Cellar/open-mpi/5.0.3_1/lib' '-L/opt/homebrew/Cellar/open-mpi/5.0.3_1/lib' '-mmacosx-version-min=14.0.0' '-asm_macosx_version_min=14.0' '-nodefaultexport' '-mcpu=apple-m1' '-mlittle-endian' '-mabi=lp64' '-dumpdir' 'a-'
COMPILER_PATH=/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../libexec/gcc/aarch64-apple-darwin23/14/:/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../libexec/gcc/
LIBRARY_PATH=/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../lib/gcc/current/gcc/aarch64-apple-darwin23/14/:/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../lib/gcc/current/gcc/:/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../lib/gcc/current/gcc/aarch64-apple-darwin23/14/../../../
COLLECT_GCC_OPTIONS='-I' '/opt/homebrew/Cellar/hdf5-mpi/1.14.3/include' '-v' '-L/opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib' '-L/opt/homebrew/opt/libaec/lib' '-I' '/opt/homebrew/Cellar/open-mpi/5.0.3_1/include' '-I' '/opt/homebrew/Cellar/open-mpi/5.0.3_1/lib' '-L/opt/homebrew/Cellar/open-mpi/5.0.3_1/lib' '-mmacosx-version-min=14.0.0' '-asm_macosx_version_min=14.0' '-nodefaultexport' '-mcpu=apple-m1' '-mlittle-endian' '-mabi=lp64' '-dumpdir' 'a.'
 /opt/homebrew/Cellar/gcc/14.1.0_1/bin/../libexec/gcc/aarch64-apple-darwin23/14/collect2 -demangle -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/ -dynamic -arch arm64 -platform_version macos 14.0.0 0.0 -o a.out -L/opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib -L/opt/homebrew/opt/libaec/lib -L/opt/homebrew/Cellar/open-mpi/5.0.3_1/lib -L/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../lib/gcc/current/gcc/aarch64-apple-darwin23/14 -L/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../lib/gcc/current/gcc -L/opt/homebrew/Cellar/gcc/14.1.0_1/bin/../lib/gcc/current/gcc/aarch64-apple-darwin23/14/../../.. -lemutls_w -lheapt_w /opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib/libhdf5hl_fortran.a /opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib/libhdf5_hl.a /opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib/libhdf5_fortran.a /opt/homebrew/Cellar/hdf5-mpi/1.14.3/lib/libhdf5.a -ld_classic -lsz -lz -flat_namespace -commons use_dylibs -ld_classic -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lgfortran -lgcc -lquadmath -lSystem -no_compact_unwind -rpath @loader_path -rpath /opt/homebrew/Cellar/gcc/14.1.0_1/lib/gcc/current/gcc/aarch64-apple-darwin23/14 -rpath /opt/homebrew/Cellar/gcc/14.1.0_1/lib/gcc/current/gcc -rpath /opt/homebrew/Cellar/gcc/14.1.0_1/lib/gcc/current
ld: warning: -commons use_dylibs is no longer supported, using error treatment instead
Undefined symbols for architecture arm64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
haykh commented 5 months ago

not sure, but maybe these lines suggest your linker (e.g. LD_FLAGS) is not configured for arm64?

ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status

i didn't even know gcc supported apple silicon. you may try compile the above-mentioned packages with the apple-clang, or something similar.

i just pushed v2.8 which has a cmake support. it might do a slightly better job in organizing the modules, than then makedepf90 (which has always been clumsy). let me know if that helps.