<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Craig,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The ncargf77/ncargcc/ncargf90 scripts are generated whenever NCAR Graphics is built on a system, and the appropriate compilers used are inserted into the scripts at compile time. These scripts actually start off with variables with names like "SED_FC", much in the same way that you are using "<span style="font-size:12.8000001907349px">NCARG_F77_FORTRAN",</span> and then the "Makefile" inserts the proper compiler names and such, by replacing all SED_XXXX lines.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Since these scripts are shipped with specific versions of NCL/NCAR Graphics, they really are meant to be used with a specific set of compilers and a specific set of libraries. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It's certainly possible to modify these scripts to use a different compiler, but if you are still linking to the NCAR Graphics libraries that were compiled with a different compiler, then you will have to take care to modify these scripts appropriately. For example, I know people who have taken a GNU version of these scripts that use gfortran and gcc, and changed them to use pgf90 and pgcc. In order to do this, though, requires hard-coding some GNU libraries to be linked, like "-lgfortran", and sometimes it requires special PGI libraries to be linked as well. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Long story short: it is not straight forward to generically modify these scripts so that they can be used with other compilers, without having to customize them for a particular system. There's just too many combinations of compilers and compile options.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">What you've done sounds pretty reasonable to me. I've usually found that you can link to GNU compiled libraries somewhat easily with other compilers, but the reverse is not always true.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 22, 2015 at 3:37 PM, Craig Tierney - NOAA Affiliate <span dir="ltr"><<a href="mailto:craig.tierney@noaa.gov" target="_blank">craig.tierney@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello all,<div><br></div><div>We have users that use the wrapper scripts ncargf77 and ncargf90 with compilers other than gfortran. The way we have handled this in the past was to make copies of the bin directory, one for each compiler (Intel and PGI). For each compiler, we would hand edit the wrapper script to properly compile and link the ncl libraries. Then depending on the compiler loaded, the path to the appropriate bin directory would be specified.</div><div><br></div><div>As I was setting up version 6.3.0, I thought there might be a better generic way to do this. Instead of a different wrapper script for each compiler, I changed the wrapper script to overload the variables like fortran, loadflags, and libextra so to allow those variables to be set in the environment and loaded as needed. Several variables are defined specific to the language used:</div><div><br></div><div>NCARG_F77 - Define the compiler</div><div>NCARG_F77_LOADFLAGS - Define the compiler flags to be used</div><div>NCARG_F77_EXTRALIB - Define any extra libraries necessary</div><div><br></div><div>There are also versions above used in the ncargf90 script, but named with _F90_.</div><div><br></div><div>There is also a generic variable that is not compiler specific (this was created so that I can point to a new Cairo build).</div><div><br></div><div>NCARG_LIBPATH - Define the library path<br></div><div><br></div><div>Am I missing something on how to properly support additional compilers? Is the method I implemented something than can be included in future versions of NCL?</div><div><br></div><div>Here is the patch for ncargf77, but I have a similar patch for ncargf90 and ncargcc.</div><div><br></div><div><div># diff -urN ncargf77.orig ncargf77</div><div>--- ncargf77.orig<span style="white-space:pre-wrap">        </span>2015-07-22 15:25:49.245582280 +0000</div><div>+++ ncargf77<span style="white-space:pre-wrap">        </span>2015-07-22 21:30:51.856202314 +0000</div><div>@@ -23,13 +23,32 @@</div><div> set syslibdir = "-L/usr/X11R6/lib64"</div><div> set xlib = "-lX11 -lXext"</div><div> set cairolib = "-lcairo -lfontconfig -lpixman-1 -lfreetype -lexpat -lpng -lz -lpthread -lXrender -lbz2"</div><div>-set fortran = "/usr/bin/gfortran"</div><div>-set loadflags = "-fPIC -fno-second-underscore -fno-range-check -fopenmp -O "</div><div> set libdir = `ncargpath lib`</div><div> set ro = "$libdir/ncarg/robj"</div><div>-set libpath = "-L$libdir $syslibdir"</div><div><br></div><div>-set libextra = ""</div><div>+if ($?NCARG_F77_FORTRAN) then</div><div>+<span style="white-space:pre-wrap">        </span>set fortran = "$NCARG_F77_FORTRAN"</div><div>+else</div><div>+<span style="white-space:pre-wrap">        </span>set fortran = "/usr/bin/gfortran"</div><div>+endif</div><div>+</div><div>+if ($?NCARG_F77_LOADFLAGS) then</div><div>+<span style="white-space:pre-wrap">        </span>set loadflags = "$NCARG_F77_LOADFLAGS"</div><div>+else</div><div>+<span style="white-space:pre-wrap">        </span>set loadflags = "-fPIC -fno-second-underscore -fno-range-check -fopenmp -O "</div><div>+endif</div><div>+</div><div>+if ($?NCARG_LIBPATH) then</div><div>+<span style="white-space:pre-wrap">        </span>set libpath = "-L$libdir $syslibdir $NCARG_LIBPATH"</div><div>+else</div><div>+<span style="white-space:pre-wrap">        </span>set libpath = "-L$libdir $syslibdir"</div><div>+endif</div><div>+</div><div>+if ($?NCARG_F77_LIBEXTRA) then</div><div>+<span style="white-space:pre-wrap">        </span>set libextra = $NCARG_F77_LIBEXTRA</div><div>+else</div><div>+<span style="white-space:pre-wrap">        </span>set libextra = ""</div><div>+endif</div><div><br></div><div> if (! -d "$libdir") then</div><div> echo "Library directory <$libdir> does not exist."</div></div><div><br></div><div>Thanks,</div><div>Craig</div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>