<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — netCDF4]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=834&amp;type=atom" />
	<updated>2022-01-12T16:09:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=834</id>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3846#p3846" />
			<content type="html"><![CDATA[<p>Thanks again Jeff.</p>]]></content>
			<author>
				<name><![CDATA[pcornillon]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4065</uri>
			</author>
			<updated>2022-01-12T16:09:57Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3846#p3846</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3845#p3845" />
			<content type="html"><![CDATA[<p>I think you should be fine with that warning.&nbsp; I&#039;m glad to hear things are working!</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2022-01-11T12:32:54Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3845#p3845</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3844#p3844" />
			<content type="html"><![CDATA[<p>That works. I did get a warning:</p><p>ld: warning: dylib (/usr/local/Cellar/netcdf/4.8.1/lib/libnetcdff.dylib) was built for newer macOS version (11.5) than being linked (11.3)</p><p>I assume that I don’t have to worry about this?</p><p>Thanks a million!</p>]]></content>
			<author>
				<name><![CDATA[pcornillon]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4065</uri>
			</author>
			<updated>2022-01-10T21:33:14Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3844#p3844</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3843#p3843" />
			<content type="html"><![CDATA[<p>I just received your screenshot, and I think that additional libraries need to be linked.&nbsp; Try changing your Linker flags to be:</p><div class="codebox"><pre><code>-L/usr/local/Cellar/netcdf/4.8.1/lib -lnetcdff -lnetcdf</code></pre></div><p>Note that the first library, <strong>-lnetcdff</strong> ends with two <strong>f</strong>s.&nbsp; I think that the main netcdf library doesn&#039;t contain the necessary Fortran functions.</p><p>I&#039;ll send this same message via email.&nbsp; Let us know if it works!</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2022-01-10T20:42:56Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3843#p3843</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3842#p3842" />
			<content type="html"><![CDATA[<p>First, image posting on the forum is maybe not what one expects.&nbsp; The image must be hosted elsewhere, and the <em>img</em> tag requires a url to the hosted image.&nbsp; We don&#039;t have any image upload capability.&nbsp; Hopefully, it didn&#039;t just reject a url to a hosted image... If you want to send one to me, though, you can email it to <a href="mailto:support@approximatrix.com">support@approximatrix.com</a>.</p><p>Second, in the File Locations category, if you want to use it, you need to add <em>/usr/local/Cellar/netcdf/4.8.1/lib</em> under the <strong>Libraries</strong> tab.&nbsp; The linker is having trouble finding the library, most likely a file named <em>/usr/local/Cellar/netcdf/4.8.1/lib/libnetcdf.a</em>.&nbsp; In the <strong>Include/Module</strong> tab, you need to add&nbsp; <em>/usr/local/Cellar/netcdf/4.8.1/include</em>, which should be where the module files are.&nbsp; The linker has no knowledge of &quot;modules&quot; in reality; they are only useful to the Fortran compiler.</p><p>If you take the step above of adding the library directory properly, you can change your <strong>Linker</strong> entry to just be:</p><div class="codebox"><pre><code>-lnetcdf</code></pre></div><p>since the File Locations entry, under the <strong>Libraries</strong> tab contains the directory to search for said library.</p><p>I&#039;m assuming in this process that you&#039;re trying to use netCDF as installed by homebrew, correct?</p><p>Please do send that screenshot, though.&nbsp; We&#039;ll get this sorted out.&nbsp; Something minor is just slightly amiss.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2022-01-10T12:30:10Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3842#p3842</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3841#p3841" />
			<content type="html"><![CDATA[<p>Yes, I had pasted the string in the Linker box in Compiler Flags. </p><p>Here&#039;s a link to a screenshot &lt;&lt;It didn&#039;t allow me to include the link to the screenshot. It says that I can use Images but when I try it doesn&#039;t seem to like it. Specifically, I can have left square bracket url or image right square bracket, the url and then then left square bracket \img or \url \right square bracket. Is there a way that I can send you a screenshot? Following is the rest of the message I wrote before discovering that I couldn&#039;t attach the screenshot.&gt;&gt;. On the right hand side of the screenshot is the SimplyFortran App with the Project Options open, showing what I pasted into the Linker box. On the left hand side of the screenshot is another screenshot showing the Modules/Include Files locations I&#039;ve pasted into it, including the one pointing to the location for the netCDF lib files - I think - and a terminal window showing how I obtained these locations. I tried it all again and it still doesn&#039;t seem to be working.</p>]]></content>
			<author>
				<name><![CDATA[pcornillon]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4065</uri>
			</author>
			<updated>2022-01-09T17:12:47Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3841#p3841</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3840#p3840" />
			<content type="html"><![CDATA[<p>The problem is that it can&#039;t find the <em>library</em>; it does seem to be able to find the modules and include files.&nbsp; You need to paste that string in the box marked <strong>Linker</strong> in Compiler Flags.&nbsp; Is that what you did?&nbsp; If so, you should see some different errors if it still isn&#039;t working.</p><p>You could also use the File Locations, but let&#039;s focus on the more direct route by using Compiler Flags for now.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2022-01-09T15:59:07Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3840#p3840</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3839#p3839" />
			<content type="html"><![CDATA[<p>Bummer - it didn&#039;t work or I did it incorrectly. Here&#039;s what I did:</p><p>petercornillon@satdat1 ~ % pkg-config --libs netcdf<br />-L/usr/local/Cellar/netcdf/4.8.1/lib -lnetcdf</p><p>Captured &quot;-L/usr/local/Cellar/netcdf/4.8.1/lib -lnetcdf&quot; and pasted it into Compiler Flags, saved the project and clicked on Build. I got the same error.</p><p>So then I pasted &quot;/usr/local/Cellar/netcdf/4.8.1/lib&quot; in the File Locations window. Specifically, I pasted it into the skinny box with the Browse, Add buttons to the right of it under the big box labeled &quot;Modules/Include Files&quot;, clicked Add and then Save Options As Defaults, saved the project and clicked on Browse again. I got the same error. </p><p>I&#039;m feeling a bit stupid at this point and apologize for imposing on you this way.</p>]]></content>
			<author>
				<name><![CDATA[pcornillon]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4065</uri>
			</author>
			<updated>2022-01-07T20:46:46Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3839#p3839</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3838#p3838" />
			<content type="html"><![CDATA[<p>You would have seen a different message if the module was incompatible.&nbsp; You&#039;re fine with the module you have, but it looks like the linker isn&#039;t linking with netcdf.&nbsp; You&#039;ll need to add the proper library (or libraries) to <a href="http://simplyfortran.com/docs/full/macos/options/project.html">Project Options under the <em>Compiler Flags</em> section</a>.</p><p>In the <em>Compiler Flags</em> section, you might be able to get away with adding just the following to the box labelled &quot;Linker:&quot;</p><div class="codebox"><pre><code>-lnetcdf</code></pre></div><p>On Intel Macs, there&#039;s a good chance it should work.&nbsp; If not, though, you can return to the terminal and enter the command:</p><div class="codebox"><pre><code>pkg-config --libs netcdf</code></pre></div><p>Whatever the string returned by the above command turns out to be, copy it in its entirety and paste it into that &quot;Linker&quot; box we discussed above.&nbsp; On my Apple Silicon Mac, for example, I did actually have to include a path to the library as well as the library flag itself.</p><p>Let us know if the above works!</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2022-01-07T12:30:51Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3838#p3838</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3837#p3837" />
			<content type="html"><![CDATA[<p>Thank you very much for the quick reply Jeff. </p><p>I&#039;m struggling a bit with this however. Specifically, I get a make error but I&#039;m not sure if it is because I have not pointed to the netcdf.mod file properly or if it has been compiled with an incorrect version of Fortran. Here&#039;s the error I get:<br />_____________________________________</p><p>==============================================================================<br />Generating Makefile... Okay<br />==============================================================================<br />Generating target<br />Undefined symbols for architecture x86_64:<br />&nbsp; &quot;___netcdf_MOD_nf90_close&quot;, referenced from:<br />&nbsp; &nbsp; &nbsp; _quickwrite_ in GeoSobel_Main-3.20.o<br />&nbsp; &nbsp; &nbsp; _readlatlon_ in GeoSobel_Main-3.20.o<br />&nbsp; &nbsp; &nbsp; _MAIN__ in GeoSobel_Main-3.20.o<br />&nbsp; &nbsp; &nbsp; _checkdimensions_ in GeoSobel_Main-3.20.o<br />&nbsp; &nbsp; &nbsp; _readpixelspacing_ in GeoSobel_Main-3.20.o<br />&nbsp; &nbsp; &nbsp; _getattributes_ in GeoSobel_Main-3.20.o<br />&nbsp; &nbsp; &nbsp; _getlatlonattributes_ in GeoSobel_Main-3.20.o<br />&nbsp; &nbsp; &nbsp; ...<br />&nbsp; &quot;___netcdf_MOD_nf90_copy_att&quot;, referenced from:<br />&nbsp; &nbsp; &nbsp; _generateglobals_ in GeoSobel_Main-3.20.o<br /> ...<br />&nbsp; &quot;___netcdf_MOD_nf90_strerror&quot;, referenced from:<br />&nbsp; &nbsp; &nbsp; _handle_err_ in GeoSobel_Main-3.20.o<br />ld: symbol(s) not found for architecture x86_64<br />Error: Last command making (target) returned a bad status<br />Error: Make execution terminated<br />_____________________________________</p><p>I used brew to upgrade my version of netcdf but I&#039;m not sure which version of fortran that was used to build netcdf. I&#039;m guessing that it is gFortran and probably a pretty recent vintage. The version of gFortran on my machine appears to be 11.2.</p><p>petercornillon@satdat1 ~ % which gfortran<br />/usr/local/bin/gfortran<br />petercornillon@satdat1 bin % cd /usr/local/bin&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />petercornillon@satdat1 bin % ls -l gfortran*<br />lrwxr-xr-x&nbsp; 1 petercornillon&nbsp; admin&nbsp; 35 Jan&nbsp; 6 12:59 gfortran -&gt; ../Cellar/gcc/11.2.0_3/bin/gfortran<br />lrwxr-xr-x&nbsp; 1 petercornillon&nbsp; admin&nbsp; 38 Jan&nbsp; 6 12:59 gfortran-11 -&gt; ../Cellar/gcc/11.2.0_3/bin/gfortran-11<br />petercornillon@satdat1 bin %</p>]]></content>
			<author>
				<name><![CDATA[pcornillon]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4065</uri>
			</author>
			<updated>2022-01-06T22:09:52Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3837#p3837</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3836#p3836" />
			<content type="html"><![CDATA[<p>You can place the NetCDF files anywhere you wish, but you&#039;ll need to configure your Simply Fortran project to look for them in the appropriate location.&nbsp; You can configure the directories that are searched for libraries and modules in the <a href="https://simplyfortran.com/docs/full/windows/options/project.html">Project Options window under the <em>File Locations</em> category</a>.&nbsp; </p><p>One word of caution: the <em>netcdf.mod</em> file will have to be compatible with our compiler.&nbsp; If it was created with Simply Fortran or any GNU Fortran release from version 10 and up, it should work fine.&nbsp; If it was created with an older version of GNU Fortran or a different compiler, you&#039;re going to see an error message.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2022-01-06T12:48:21Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3836#p3836</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[netCDF4]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=3835#p3835" />
			<content type="html"><![CDATA[<p>I&#039;m new to SimplyFortran. I have code, which requires access to netCDF4. My program has a &#039;use netcdf&#039; statement. Where should I put the netCDF package and associated netcdf.mod file?</p>]]></content>
			<author>
				<name><![CDATA[pcornillon]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=4065</uri>
			</author>
			<updated>2022-01-05T23:19:49Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=3835#p3835</id>
		</entry>
</feed>
