Page 1 of 1

arw2arl compilation

Posted: February 22nd, 2016, 12:36 pm
by brownbagel
Hello,

Recently, I have been attempting to compile arw2arl function on Ubuntu 14.04 using gfortran.

However, when I try to compile the makefile using 'make' I get the following error message:

Code: Select all

gfortran -o ../../exec/arw2arl -O2 -fconvert=big-endian -frecord-marker=4 -ffree-form -Dgfortran -I/usr/include arw2arl.f libarw.a -I/usr/lib -lnetcdff -I../../library -lhysplit  
/usr/bin/ld: cannot find -lhysplit
collect2: error: ld returned 1 exit status
make: *** [arw2arl] Error 1
Here are the following 'modifications' I have made to the makefile:
-> I specified the file path for the locations of netcdf.so & netcdff.(NETLIB) and the locations of netcdf.h netcdf.inc (NETINC).
-> I changed

Code: Select all

 LINKS = -L$(NETLIB) -lnetcdff -L../../library -lhysplit
into

Code: Select all

 LINKS = -I$(NETLIB) -lnetcdff -I../../library -lhysplit
in order to avoid the "undefined reference ..._ error.

Any help would be greatly appreciated.
M.

Re: arw2arl compilation

Posted: February 22nd, 2016, 2:40 pm
by ariel.stein
You need to compile the hysplit library located in library/hysplit first.

Re: arw2arl compilation

Posted: February 22nd, 2016, 3:09 pm
by brownbagel
Thanks for the reply, I just did another fresh compile using compile.sh script, but the log file still displays the same error.
I then checked out the library/hysplit/ folder and tried to compile it, but it seems like the original bash script has already taken care of it.

Code: Select all

make: `../libhysplit.a' is up to date.

Re: arw2arl compilation

Posted: February 22nd, 2016, 4:19 pm
by ariel.stein
got to the subdirectory data2arl/arw2arl/ and type make there.

Re: arw2arl compilation

Posted: February 22nd, 2016, 5:07 pm
by brownbagel
Sorry, my problem was solved. I'll post my mistake for chives.

Initially, I've put -I in the LINKS part of the make file (see above post) is because I'm getting the following error:

Code: Select all

gfortran -o ../../exec/arw2arl -O2 -fconvert=big-endian -frecord-marker=4 -ffree-form  -I/usr/include arw2arl.f libarw.a -L/usr/lib -lnetcdf  -L../../library -lhysplit  
/tmp/ccyMA3dR.o: In function `MAIN__':
arw2arl.f:(.text+0x8a3): undefined reference to `nf_open_'
arw2arl.f:(.text+0x1548): undefined reference to `nf_get_var_real_'
arw2arl.f:(.text+0x6f66): undefined reference to `nf_close_'
arw2arl.f:(.text+0xa6ff): undefined reference to `nf_strerror_'
arw2arl.f:(.text+0xb600): undefined reference to `nf_strerror_'
However, the correct solution to this error is by commenting out

Code: Select all

LINKS = -L$(NETLIB) -lnetcdf  -L../../library -lhysplit
for

Code: Select all

 LINKS = -L$(NETLIB) -lnetcdff -L../../library -lhysplit
since I have netCDF4 (as outlined in the readme)

and putting -I causes this error:

Code: Select all

/usr/bin/ld: cannot find -lhysplit
gfortran 4.8.4, netCDF 4 library

silly me, thanks for your time.