[ncl-talk] Using NetCDF with WRAPIT
Ian Harris (ENV - Staff)
I.Harris at uea.ac.uk
Sat Jul 18 18:05:01 MDT 2020
Okay, I’ve moved things on.
1. I located and edited the WRAPIT script. This has a ’set compiler options’ section, and within that a 'Darwin' subsection. Here I was able to add the minimum includes and libraries for NetCDF to be incorporated. Easy. This meant I didn’t need to spend two days upgrading everything, which is a shame, because of point 2.
2. Because I upgraded the Mac to 10.14 ('Mojave'), a security feature called FDA (Full Disk Access) prevents me from running WRAPIT! It’s very restrictive if you want to do things outside of the approved areas (ie, buying Apple Music, joining Apple TV, etc). You can add apps to FDA in the system Prefs, but not scripts. I tried writing a dummy Fortran proglet to run the script, but I don’t get any outputs, so that’s not working.
It doesn’t get easier!
Harry
From: ncl-talk <ncl-talk-bounces at mailman.ucar.edu<mailto:ncl-talk-bounces at mailman.ucar.edu>> on behalf of "Ian Harris (ENV - Staff) via ncl-talk" <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>>
Reply-To: Ian Harris <i.harris at uea.ac.uk<mailto:i.harris at uea.ac.uk>>
Date: Friday, 17 July 2020 at 23:57
To: ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>>
Subject: Re: [ncl-talk] Using NetCDF with WRAPIT
Hi Rick,
Nice suggestion, sadly no difference.
One of the reasons I went for a manual ncl install (“You have chosen Slow and Painful”) was in case I could mod WRAPIT to recognise Includes (or even just hard code NetCDF into it). I haven’t attempted that yet..
Cheers
Harry
From: Rick Brownrigg <brownrig at ucar.edu<mailto:brownrig at ucar.edu>>
Date: Friday, 17 July 2020 at 18:41
To: Ian Harris <i.harris at uea.ac.uk<mailto:i.harris at uea.ac.uk>>
Cc: ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>>
Subject: Re: [ncl-talk] Using NetCDF with WRAPIT
Hi Harry,
I don't know for certain. It really looks like the compiler is not finding the netcdf header, and needs the equivalent of a -I/usr/local/include option. As you point out, WRAPIT doesn't accept that (seems like an oversight to me).
I presume you are using gfortran? It manual states: "The gfortran compiler currently does not make use of any environment variables to control its operation above and beyond those that affect the operation of gcc"
With that, you might try setting CPATH:
export CPATH=/usr/local/include
Other than that, you might try running WRAPIT with the -d switch. This will show the build commands and not delete temporary outputs. From there you might be able to manually fix-up and run the appropriate build commands.
Wish I had a better answer...
Rick
On Fri, Jul 17, 2020 at 10:32 AM Ian Harris (ENV - Staff) via ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>> wrote:
Hi Rick,
WRAPIT Version: 120209
A syntax error occurred while parsing: include
COMPILING /Users/ianharris/Programs/Fortran/forverify3.for
/Users/ianharris/Programs/Fortran/forverify3.for:443: Error: Can't open included file 'netcdf.inc'
LINKING
gcc: error: forverify3.o: No such file or directory
rm: forverify3.o: No such file or directory
END WRAPIT
This is the gfortran equivalent that works:
% gfortran -m64 -I/usr/local/include/ -L/usr/local/lib -lnetcdf /usr/local/lib/libnetcdff.a ~/Programs/Fortran/forverify3.for
also, new tree from macports:
% gfortran -m64 -I/opt/local/include/ -L/opt/local/lib -lnetcdf /opt/local/lib/libnetcdff.a ~/Programs/Fortran/forverify3.for
Now WRAPIT doesn't like Includes, and you have to put spaces after the -L and -l linkages, but:
% WRAPIT -m64 -L /opt/local/lib -l netcdf /opt/local/lib/libnetcdff.a ~/Programs/Fortran/forverify3.for
WRAPIT Version: 120209
A syntax error occurred while parsing: include
COMPILING /Users/ianharris/Programs/Fortran/forverify3.for
/Users/ianharris/Programs/Fortran/forverify3.for:442: Error: Can't open included file 'netcdf.inc'
LINKING
gcc: error: forverify3.o: No such file or directory
rm: forverify3.o: No such file or directory
END WRAPIT
Cheers
Harry
________________________________
From: Rick Brownrigg <brownrig at ucar.edu<mailto:brownrig at ucar.edu>>
Sent: 17 July 2020 17:15
To: Ian Harris (ENV - Staff) <I.Harris at uea.ac.uk<mailto:I.Harris at uea.ac.uk>>
Cc: Dennis Shea via ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>>
Subject: Re: [ncl-talk] Using NetCDF with WRAPIT
Warning: This email is from outside the UEA system. Do not click on links or attachments unless you expect them from the sender and know the content is safe.
Hi,
What do you mean by "cannot get WRAPIT to recognise the "include 'netcdf.inc'""? Are you getting a compiler error, or an error from WRAPIT itself, or? I see you have -L directives pointing to where the netcdf library resides; do you need a similar -I directive to point to where the header is?
Rick
On Fri, Jul 17, 2020 at 10:03 AM Ian Harris (ENV - Staff) via ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>> wrote:
Hi,
I need to write NetCDF files with a Fortran subroutine, because there seems to be a memory leak in addfile(). I know that was supposed to be fixed years back, but I have memory usage graphs that indicate otherwise. And yes, I have comprehensive deletion strategies.
I've tried a lot of things, including reinstalling ncl, (oh, yes..), NetCDF, etc, etc, but I cannot get WRAPIT to recognise the "include 'netcdf.inc'" line in the subroutine. Has anyone managed this? How did you link to the libraries?
Here are a couple examples that don't work:
WRAPIT -L/usr/local/lib -l netcdf -L /usr/local /usr/local/lib/libnetcdff.a /usr/local/lib/libnetcdf.a ~/Programs/Fortran/forverify3.for
WRAPIT -L /opt/local/lib -l netcdf -L /opt/local -l libnetcdff.a ~/Programs/Fortran/forverify3.for
..I just chose two from dozens.
Is it actually *possible* to have a NetCDF-aware Fortran subroutine under WRAPIT?
Cheers
Harry
_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.ucar.edu%2Fmailman%2Flistinfo%2Fncl-talk&data=02%7C01%7Ci.harris%40uea.ac.uk%7C211102872dc14150611308d82aa4d6c0%7Cc65f8795ba3d43518a070865e5d8f090%7C0%7C0%7C637306234773303227&sdata=fbUmdThTM7lcAJkKSPQFChudUlfhnPf3Q1yUNKLv3y8%3D&reserved=0>
_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.ucar.edu%2Fmailman%2Flistinfo%2Fncl-talk&data=02%7C01%7Ci.harris%40uea.ac.uk%7C211102872dc14150611308d82aa4d6c0%7Cc65f8795ba3d43518a070865e5d8f090%7C0%7C0%7C637306234773313217&sdata=kx1POU0lvUBmTW5NNtQ7IQCzhTWbS%2Btn5s58MXhT6po%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200719/babe17c9/attachment.html>
More information about the ncl-talk
mailing list