[ncl-talk] Using NetCDF with WRAPIT

Rick Brownrigg brownrig at ucar.edu
Fri Jul 17 11:41:24 MDT 2020


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> 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>
> *Sent:* 17 July 2020 17:15
> *To:* Ian Harris (ENV - Staff) <I.Harris at uea.ac.uk>
> *Cc:* Dennis Shea via ncl-talk <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> 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
> 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%7Ca9ba723c8c50424170b708d82a6cb492%7Cc65f8795ba3d43518a070865e5d8f090%7C0%7C0%7C637305993657185694&sdata=8lqsMy7ZpRGpBncfaGTPwjf2zeWxgSe6hTMRrIBKyL4%3D&reserved=0>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200717/71f1b592/attachment.html>


More information about the ncl-talk mailing list