First of all thank you for taking the time to read my post. I am currently working on compiling an old code with meson and the gnu compilers. While I have been able to build the first two static libraries, I have sadly run into trouble on the main source and am hoping that some of you might have a solution / helpful pointers.
I am working off from an old Makefile, which is non-functional by now as it mixed explicit and implicit syntax. Drawing from the Makefile:
PP = /lib/cpp PFLAGS = -P F90 = mpif90 CC = mpicc FFLAGS = -c OPTIONS = -D GFORTRAN \ -O3 -fdefault-integer-8 -fdefault-real-8 -fno-range-check \ -ftree-vectorize -funroll-all-loops -cpp LOPTIONS = -fopenmp -g -fbacktrace
$(TARGET): $(LIBS) $(OBJS) @$(PF90) $(FFLAGS) $(OPTIONS) -o $(OBJDIR)/<main-file-name>.o <main-file-name>.f @echo "COMPILE END := `date "+%T"` " >> $(INFOFILE) @$(PF90) -o $(TARGET) $(LOPTIONS) $(OBJS) $(LIBRARY)
I have now gone and transported this into meson with the usual mpi dependencies, as well as adding the compiler arguments for the Fortran compiler.
# Get default compiler configurations if fc.get_id() == 'gcc' add_project_arguments('-fdefault-real-8', language: 'fortran') add_project_arguments('-fdefault-double-8', language: 'fortran') add_project_arguments('-fdefault-integer-8', language: 'fortran') add_project_arguments('-ffree-line-length-none', language: 'fortran') add_project_arguments('-fbacktrace', language: 'fortran') add_project_arguments('-DLINUX', language: 'cpp') add_project_arguments('-DLINUX64', language: 'cpp') # Specify a fortran standard to the compiler add_project_arguments('-std=legacy', language: 'fortran') # Suppress warnings to find the actual errors add_project_arguments('-w', language: 'fortran') endif
And the main build argument for the executable as
executable( 'NAME', sources: srcs, link_with: [lib_1, lib_2], fortran_args: ['-fno-range-check', '-ftree-vectorize', '-funroll-all-loops', '-cpp'], dependencies: mpif, )
Today I was butting heads with the compiler and eventually ended up at a syntax error argument of gfortran, i.e.
Error: Syntax error in argument list at (1) ../source/filename.f:836:72: 836 | call FN-NAME ( __FILE__, __LINE__
I understand that
__FILE__, especially with the double-underscore is reserved for gfortran’s internal use, and I need to use a preprocessor to make this amenable to gfortran, but am unsure how to actually implement that.
Would be really glad for any pointers and help :)))