Page 1 of 1

era52arl compile issue

Posted: April 17th, 2023, 3:31 am
by draba914
Hi,
I am trying to work with era52arl and am currently at the stage of installing eccodes.
I have installed my eccodes at /opt/eccodes and followed through the explanation on viewtopic.php?f=14&t=2141&p=7413&hilit=makefile#p7413 already. However, I am still getting the error message of "Cannot open module file ‘eccodes.mod’ for reading at (1): No such file or directory" when compiling with

Code: Select all

gfortran -o era52arl era52arl.f90
This is my /opt/eccodes folder:
Screenshot 2023-04-17 002613.png
This is what I have for my make file:

Code: Select all

include ../../Makefile.inc

EXE=../../exec
PGM=era52arl

ECCODES_TOPDIR= /opt/eccodes
ECCODESINC= -I/opt/eccodes/include
ECCODESLIBS= -L/opt/eccodes/lib -libeccodes_f90.so -libeccodes.so
FC=gfortran
FFLAGS_FREEFORM= -ffree-form
FFLAGS=$(OPTIMIZATION) -fconvert=big-endian -frecord-marker=4 -fPIC -falign-commons -finit-local-zero

LIBHYS = -L../../library -lhysplit

FCFLAGS = -g $(FFLAGS) $(FFLAGS_FREEFORM)

api2arl_DEPENDENCIES =  \
	$(ECCODES_TOPDIR)/lib/libeccodes_f90.so \
	$(ECCODES_TOPDIR)/lib/libeccodes.so
FCCOMPILE = $(FC) $(ECCODESINC) $(FCFLAGS)
FCLD = $(FC)
FCLINK = $(FCLD) $(FCFLAGS) $(AM_LDFLAGS) \
	 $(LDFLAGS) -o $(EXE)/$@

.SUFFIXES:
.SUFFIXES: .f .lo .o .obj

$(PGM): $(PGM).o $(api2arl_DEPENDENCIES) 
	@rm -f $(PGM)
	$(FCLINK) $(PGM).o $(ECCODESLIBS) $(LIBHYS)


.f.o:
	$(FCCOMPILE) -c -o $@ $<  

clean :
	 rm -f $(EXE)/apidump
	 rm -f $(EXE)/$(PGM)
	 rm -f *.o
What edits should I make?

Re: era52arl compile issue

Posted: April 18th, 2023, 7:21 am
by sonny.zinn
The era52arl program is built by running the make command, not by directly running the gfortran compiler. The make command will invoke the compiler with necessary options as specified by Makefile. I suppose you are building era52arl using the files in the data2arl/era52arl directory. A few things that caught my eyes are:

1) The Makefile file is meant to be used as is, without modification.

2) Create or modify Makefile.inc in the ../.. directory as explained in the other forum post. This ../../Makefile.inc will be included by the above Makefile.

3) Check if eccodes.mod exists in your /opt/eccodes/include directory. If it is missing, you might want to double check your ECCODES installation.

Re: era52arl compile issue

Posted: April 19th, 2023, 2:53 pm
by draba914
Thank you! It worked after I created the Makefile.inc document. When I was reading through the other posts, I thought the Makefile showing up in the folder is the same as the Makefile.inc.