Warwick-Plasma/epoch

Issue compiling on MacOS w/ Xcode 15.0

sivovivanov opened this issue · 1 comments

Hello,

Compilation of any of the epoch{n}d binaries seems to fail on MacOS with the Xcode tools version 15.0 and higher. The issue stems from the fact that Apple have updated their ld linker binary and it no longer supports the "-commons" flag, resulting in it returning a code of 1 during compilation. Interestingly enough, they still have it in the man page for ld, but I digress.

~/Developer/epoch/epoch2d (main ✔) export COMPILER=gfortran

followed by

~/Developer/epoch/epoch2d (main ✔) make -j 8

I get

/Applications/Xcode.app/Contents/Developer/usr/bin/make MAKEFLAGS= COMPILER=gfortran -C ../SDF/FORTRAN
mpif90 -Iinclude -Iobj -Jinclude -o obj/MPI_CHECK src/mpi_version.f90
mpif90 -c -O3 -g -std=f2003 -ffpe-summary=invalid,zero,overflow -I../SDF/FORTRAN/include -Iobj -Jobj -Wno-conversion -fno-range-check -o obj/epoch_source_info.o obj/epoch_source_info.f90
sh src/pack.sh "." sdf 1 1 1 1 0 src/sdf_source_info.f90 "GNU Fortran (Homebrew GCC 13.2.0) 13.2.0 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." "-O3 -g -frecord-marker=4" CMakeLists.txt Makefile Makefile-objs Makefile-deps src/sdf.f90 src/sdf_common.f90 src/sdf_control.f90 src/sdf_input.f90 src/sdf_input_cartesian.f90 src/sdf_input_cartesian_r4.f90 src/sdf_input_cartesian_r8.f90 src/sdf_input_cartesian_ru.f90 src/sdf_input_point.f90 src/sdf_input_point_r4.f90 src/sdf_input_point_r8.f90 src/sdf_input_point_ru.f90 src/sdf_input_r4.f90 src/sdf_input_r8.f90 src/sdf_input_ru.f90 src/sdf_input_station.f90 src/sdf_input_station_r4.f90 src/sdf_input_station_r8.f90 src/sdf_input_station_ru.f90 src/sdf_input_util.f90 src/sdf_job_info.f90 src/sdf_md5.f90 src/sdf_output.f90 src/sdf_output_cartesian.f90 src/sdf_output_cartesian_r4.f90 src/sdf_output_cartesian_r8.f90 src/sdf_output_cartesian_ru.f90 src/sdf_output_point.f90 src/sdf_output_point_r4.f90 src/sdf_output_point_r8.f90 src/sdf_output_point_ru.f90 src/sdf_output_r4.f90 src/sdf_output_r8.f90 src/sdf_output_ru.f90 src/sdf_output_source.f90 src/sdf_output_station.f90 src/sdf_output_station_r4.f90 src/sdf_output_station_r8.f90 src/sdf_output_station_ru.f90 src/sdf_output_util.f90 src/CMakeLists.txt src/pack.py src/pack.sh src/COMMIT src/sdf_source_info_dummy.f90 src/gen_commit_string.sh
ld: unknown options: -commons 
collect2: error: ld returned 1 exit status
make[2]: *** [MPI_CHECK] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [../SDF/FORTRAN/include/sdf.mod] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [commit] Error 2

where the relevant part is

ld: unknown options: -commons 
collect2: error: ld returned 1 exit

My ld version is:

~/Developer/epoch/epoch2d (main ✔) ld -v
@(#)PROGRAM:ld  PROJECT:dyld-1022.1
BUILD 13:21:42 Nov 10 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.8)
Library search paths:
Framework search paths:

I wanted to ask where the LDFLAGS are defined, so I can potentially remove the -commons flag in order to get EPOCH to build (provided removing -commons would still allow EPOCH to build).

Grepping for "-commons" in the top-level directory for EPOCH doesn't seem to find anything so I am a bit confused. I am assuming that the "-commons" flag would be part of the LDFLAGS variable, as I can find that one in any of the epoch{n}d directories.

~/Developer/epoch/epoch2d (main ✔) grep -rnw LDFLAGS
./Makefile:173:LDFLAGS = $(FFLAGS) -L$(SDF)/lib -lsdf
./Makefile:387:	$(FC) -o $@ $(addprefix $(OBJDIR)/,$(OBJFILES)) $(LDFLAGS)
./Makefile:433:	$(FC) -o $@ $< $(LDFLAGS)

But I cannot find it being part of $(FFLAGS) and I am unsure where it is coming from. This is not necessarily an issue with EPOCH, but I thought that here would be a good place to ask, thank you!

Hey @keithbennett,

You have a Mac right? Can you double-check EPOCH is still compiling for you?

Cheers,
Stuart