{"id":44,"date":"2008-05-02T07:38:59","date_gmt":"2008-05-02T06:38:59","guid":{"rendered":"http:\/\/www.miscdebris.net\/blog\/2008\/05\/02\/mingw-binaries-of-netcdf-362\/"},"modified":"2008-05-02T07:48:40","modified_gmt":"2008-05-02T06:48:40","slug":"mingw-binaries-of-netcdf-362","status":"publish","type":"post","link":"http:\/\/www.miscdebris.net\/blog\/2008\/05\/02\/mingw-binaries-of-netcdf-362\/","title":{"rendered":"MinGW binaries of NetCDF 3.6.2"},"content":{"rendered":"<p>&#8220;<a title=\"NetCDF Homepage\" href=\"http:\/\/www.unidata.ucar.edu\/software\/netcdf\/\" target=\"_blank\">netCDF<\/a> (network Common Data Form) is a set of software libraries and machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data&#8221;. On its homepage you&#8217;ll find a lot of precompiled libraries for Unix derivates but only a binary of netCDF 3.6.1 compiled with Visual C++. It&#8217;s possible to use this binary in MinGW also, but I prefer to use libraries compiled with the same compiler toolkit I&#8217;m working with. <!--more-->There are no makefiles for the MinGW compiler but it is possible to compile the netCDF library in the MSys development ennvironment. I wrote a bash little script which downloads the netCDF source package (with the help of <a title=\"curl for windows package\" href=\"http:\/\/curl.haxx.se\/download\/curl-7.18.0-win32-nossl-sspi.zip\">curl<\/a>), untars the package, compiles the source and assembles the binaries and necessary files for development in a tar.gz package. Curl needs to be in the path or in the same directory as the script. The script will create a netcdf_mingw directory where the source package is downloaded to and all compilation steps will take place. The tar.gz package will be created in netcdf_mingw\/package. Below you can download the binary package of netCDF 3.6.2 for the MinGW compiler toolset (to be used in MSys and in native Windows CLI) and the script I wrote to compile netCDF in MSys yourself if you want.<\/p>\n<p>netCDF 3.6.2 Binary for MinGW 3.4.5: <a href=\"http:\/\/www.miscdebris.net\/blog\/wp-content\/uploads\/2008\/05\/netcdf-362_mingwtar.gz\">Download<\/a> (rename the file to netcdf-3.6.2_mingw.tar.gz)<\/p>\n<p>The script will create a directory netcdf_mingw in the same directory where the script is run. Before the scripts starts downloading the netCDF package, it shows some informations and waits for user input.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n#######################################################################\r\n# This batch file will download, compile and make a package of\r\n# the netcdf library for the MinGW compiler. You need to have Msys\r\n# and MinGW already installed.\r\n#\r\n# You need curl.exe and 7za.exe for this script to work\r\n# correctly:\r\n#   - curl 7.18.0 no SSL download location:\r\n# http:\/\/curl.haxx.se\/download\/curl-7.18.0-win32-nossl-sspi.zip\r\n#   - 7-zip 4.57 command line version:\r\n# http:\/\/downloads.sourceforge.net\/sevenzip\/7za457.zip\r\n#######################################################################\r\n\r\n#######################################################################\r\n# determine directories\r\n# source package will be downloaded into and compiled in $MAINDIR\r\n# binary package will be created in $PACKAGEDIR\r\n#######################################################################\r\nexport ROOTDIR=`pwd`\r\nexport MAINDIR=$ROOTDIR\/netcdf_mingw\r\nexport BUILDDIR=$MAINDIR\/netcdf-3.6.2\r\nexport PACKAGEDIR=$MAINDIR\/package\r\n\r\n#######################################################################\r\n# show user the settings and ask if he wants to continue\r\n#######################################################################\r\necho\r\necho ==============================================================\r\necho == Please check the settings\r\necho ==============================================================\r\necho\r\necho Directories\r\necho ===========\r\necho ROOTDIR=$ROOTDIR\r\necho MAINDIR=$MAINDIR\r\necho BUILDDIR=$BUILDDIR\r\necho PACKAGEDIR=$PACKAGEDIR\r\necho\r\necho Type y to continue!\r\n\r\nread -n 1 ANSWER\r\nif &#x5B; $ANSWER != &quot;y&quot; ]\r\nthen\r\nexit -1;\r\nfi\r\n\r\n#######################################################################\r\n# remove and create directories\r\n#######################################################################\r\nmkdir $MAINDIR\r\nmkdir $PACKAGEDIR\r\n\r\n#######################################################################\r\n# download and unpack netcdf-3.6.2 package\r\n#######################################################################\r\necho +++ Downloading netcdf library from http:\/\/www.unidata.ucar.edu\/downloads\/netcdf\/ftp\/netcdf-3.6.2.tar.gz +++\r\ncurl http:\/\/www.unidata.ucar.edu\/downloads\/netcdf\/ftp\/netcdf-3.6.2.tar.gz -o $MAINDIR\/netcdf-3.6.2.tar.gz\r\npushd $MAINDIR\r\ntar xzf netcdf-3.6.2.tar.gz\r\npopd\r\n\r\n#######################################################################\r\n# configure and build library\r\n#######################################################################\r\npushd $BUILDDIR\r\n.\/configure --enable-shared --disable-separate-fortram --disable-cxx --disable-f90\r\nmake\r\n\r\n#######################################################################\r\n# make package for website\r\n#######################################################################\r\nif &#x5B; 1 == 1 ]\r\nthen\r\necho &#039;This netCDF DLL was generated using MingW\/Msys.&#039; &gt; $PACKAGEDIR\/README_DLL.txt\r\necho &#039;&#039; &gt;&gt; $PACKAGEDIR\/README_DLL.txt\r\necho &#039;.\/configure --enable-shared --disable-separate-fortram --disable-cxx --disable-f90&#039; &gt;&gt; $PACKAGEDIRREADME_DLL.txt\r\necho &#039;To use the DLL from C, include netcdf.h.&#039; &gt;&gt; $PACKAGEDIR\/README_DLL.txt\r\necho &#039;To use the DLL from Fortran, include netcdf.inc.&#039; &gt;&gt; $PACKAGEDIR\/README_DLL.txt\r\ncp libsrc\/.libs\/libnetcdf.a $PACKAGEDIR\r\ncp libsrc\/.libs\/libnetcdf.dll.a $PACKAGEDIR\r\ncp libsrc\/.libs\/libnetcdf-4.dll $PACKAGEDIR\r\ncp libsrc\/netcdf.h $PACKAGEDIR\r\ncp fortran\/netcdf.inc $PACKAGEDIR\r\ncp ncgen\/.libs\/ncgen.exe $PACKAGEDIR\r\ncp ncdump\/.libs\/ncdump.exe $PACKAGEDIR\r\npushd $PACKAGEDIR\r\ntar -cf netcdf-3.6.2_mingw.tar netcdf.h libnetcdf.a libnetcdf.dll.a libnetcdf-4.dll README_DLL.txt netcdf.inc ncgen.exe ncdump.exe\r\ngzip netcdf-3.6.2_mingw.tar\r\npopd\r\nfi\r\n\r\npopd\r\n\r\nexit 1\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;netCDF (network Common Data Form) is a set of software libraries and machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data&#8221;. On its homepage you&#8217;ll find a lot of precompiled libraries for Unix derivates but only a binary of netCDF 3.6.1 compiled with Visual C++. It&#8217;s possible to use this &hellip; <a href=\"http:\/\/www.miscdebris.net\/blog\/2008\/05\/02\/mingw-binaries-of-netcdf-362\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">MinGW binaries of NetCDF 3.6.2<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[4],"tags":[21,22,20,19],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-research","tag-bash","tag-curl","tag-mingw","tag-netcdf"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6pnj-I","_links":{"self":[{"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/posts\/44"}],"collection":[{"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":0,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.miscdebris.net\/blog\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}