<div dir="ltr"><div>re: " ... there seems to be a memory leak in addfile()."</div><div><br></div><div>Can you please provide an example?</div><div><br></div><div>THX<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 17, 2020 at 11:42 AM Rick Brownrigg via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Harry,</div><div><br></div><div><span style="font-family:arial,sans-serif">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).</span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">I presume you are using gfortran?  It manual states: "The <code>gfortran</code> compiler currently does not make use of any environment
variables to control its operation<span style="color:rgb(255,0,0)"> above and beyond </span>those
that affect the operation of <code>gcc"</code></span></div><div><span style="font-family:arial,sans-serif"><code><br></code></span></div><div><span style="font-family:arial,sans-serif"><code>With that, you might try setting CPATH:</code></span></div><div><span style="font-family:arial,sans-serif"><code><br></code></span></div><div><span style="font-family:arial,sans-serif"><code>export CPATH=/usr/local/include</code></span></div><div><span style="font-family:arial,sans-serif"><code><br></code></span></div><div><span style="font-family:arial,sans-serif"><code>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.</code></span></div><div><span style="font-family:arial,sans-serif"><code><br></code></span></div><div><span style="font-family:arial,sans-serif"><code>Wish I had a better answer...</code></span></div><div><span style="font-family:arial,sans-serif"><code>Rick<br></code></span></div><div><code><span style="font-family:arial,sans-serif"></span><br></code></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 17, 2020 at 10:32 AM Ian Harris (ENV - Staff) via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Rick,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span>WRAPIT Version: 120209<br>
</span>
<div>A syntax error occurred while parsing: include<br>
</div>
<div>COMPILING /Users/ianharris/Programs/Fortran/forverify3.for<br>
</div>
<div>/Users/ianharris/Programs/Fortran/forverify3.for:443: Error: Can't open included file 'netcdf.inc'<br>
</div>
<div>LINKING<br>
</div>
<div>gcc: error: forverify3.o: No such file or directory<br>
</div>
<div>rm: forverify3.o: No such file or directory<br>
</div>
<div>END WRAPIT<br>
</div>
<span></span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
This is the gfortran equivalent that works:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
% gfortran -m64 -I/usr/local/include/ -L/usr/local/lib -lnetcdf /usr/local/lib/libnetcdff.a ~/Programs/Fortran/forverify3.for</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
also, new tree from macports:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
% gfortran -m64 -I/opt/local/include/ -L/opt/local/lib -lnetcdf /opt/local/lib/libnetcdff.a ~/Programs/Fortran/forverify3.for</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Now WRAPIT doesn't like Includes, and you have to put spaces after the -L and -l linkages, but:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span>% WRAPIT -m64 -L /opt/local/lib -l netcdf /opt/local/lib/libnetcdff.a ~/Programs/Fortran/forverify3.for<br>
</span>
<div> <br>
</div>
<div>WRAPIT Version: 120209<br>
</div>
<div>A syntax error occurred while parsing: include<br>
</div>
<div>COMPILING /Users/ianharris/Programs/Fortran/forverify3.for<br>
</div>
<div>/Users/ianharris/Programs/Fortran/forverify3.for:442: Error: Can't open included file 'netcdf.inc'<br>
</div>
<div>LINKING<br>
</div>
<div>gcc: error: forverify3.o: No such file or directory<br>
</div>
<div>rm: forverify3.o: No such file or directory<br>
</div>
<div>END WRAPIT<br>
</div>
<span></span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Cheers</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Harry<br>
</div>
<div id="gmail-m_-2819898048657338827gmail-m_4122559872299673996appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-2819898048657338827gmail-m_4122559872299673996divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>
<b>Sent:</b> 17 July 2020 17:15<br>
<b>To:</b> Ian Harris (ENV - Staff) <<a href="mailto:I.Harris@uea.ac.uk" target="_blank">I.Harris@uea.ac.uk</a>><br>
<b>Cc:</b> Dennis Shea via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>><br>
<b>Subject:</b> Re: [ncl-talk] Using NetCDF with WRAPIT</font>
<div> </div>
</div>
<div>
<p style="border:4px solid rgb(255,0,0);padding:0.5em;text-align:center">
<b>Warning:</b> 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.
</p>
<div></div>
<div>
<div dir="ltr">
<div>Hi,</div>
<div><br>
</div>
<div>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?</div>
<div><br>
</div>
<div>Rick<br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Fri, Jul 17, 2020 at 10:03 AM Ian Harris (ENV - Staff) via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
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.<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
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?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Here are a couple examples that don't work:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
WRAPIT  -L/usr/local/lib -l netcdf -L /usr/local /usr/local/lib/libnetcdff.a /usr/local/lib/libnetcdf.a   ~/Programs/Fortran/forverify3.for<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
WRAPIT -L /opt/local/lib -l netcdf -L /opt/local -l libnetcdff.a ~/Programs/Fortran/forverify3.for</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
..I just chose two from dozens.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Is it actually *possible* to have a NetCDF-aware Fortran subroutine under WRAPIT?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Cheers</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Harry<br>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="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" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</div>
</div>
</div>

_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>