[Met_help] [rt.rap.ucar.edu #57514] History for Compiling METv4.0 with GRIB2 using PGI
Paul Oldenburg via RT
met_help at ucar.edu
Thu Jul 26 13:11:06 MDT 2012
----------------------------------------------------------------
Initial Request
----------------------------------------------------------------
I'm writing in response to Ticket Number 37869 titled "Re: Compiling MET" (
http://mailman.ucar.edu/pipermail/met_help/2010-May/001351.html)
I recently compiled MET 4.0 without GRIB2 compatibility, using PGI 10.5 on
a Linux machine, C++ compiler pgcpp and Fortran compiler pgf77. For the
most part, it compiled correctly with the exception of including #define
_ISOC9X_SOURCE at the beginning of pair_base.cc due to an llabs call issue.
I then attempted to add GRIB2 compatibility with MET. I came across the
same error as was posted by Paula Doubrawa Moreira in May 2010 in the
aforementioned ticket. This was my error:
stat_analysis.cc:
"/opt/pgi/linux86-64/10.5/include/CC/cmath", line 56: error: the global
scope
has no "abs"
using _STLP_VENDOR_CSTD::abs;
^
1 error detected in the compilation of "stat_analysis.cc".
make[4]: *** [stat_analysis] Error 2
make[3]: *** [all] Error 2
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2
which is peculiar considering I did not encounter this error when compiling
MET 4.0 without GRIB2.
After much debugging, I discovered that "#include <cmath>" must be inserted
after stdlib.h in stat_analysis.cc. Looks like cmath is trying to overload
the abs function without abs being originally called by stdlib.h. This may
only be the case when using PGI, as PGI may have its own abs function.
The order I have the includes listed in stat_analysis.cc is as follows:
#include <cstdio>
#include <dirent.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <cmath>
#include "vx_log.h"
#include "stat_analysis.h"
#include "parse_stat_line.h"
#include "aggr_stat_line.h"
#include "stat_analysis_job.h"
With this change, MET 4.0 compiled correctly and the error was fixed.
Hope this helps anyone else trying to compile MET 4.0 with GRIB2
compatibility using PGI. Maybe this small fix is something to consider
adding to the next patch for MET 4.0?
Greg
--
Greg Seroka
Ph.D. Candidate
Coastal Ocean Observation Lab
Institute of Marine and Coastal Sciences
Rutgers University
Email: seroka at marine.rutgers.edu
----------------------------------------------------------------
Complete Ticket History
----------------------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #57514] Compiling METv4.0 with GRIB2 using PGI
From: Paul Oldenburg
Time: Thu Jul 19 13:21:17 2012
Greg,
Thank you very much for finding and fixing this problem. I am a
little puzzled that WITH_GRIB2 triggered error in
stat_analysis.cc, since that file should be included in the build
either way. We will discuss how to add your proposed
fix into a future patch or release. Thanks again for pointing out
this issue.
Paul
On 07/19/2012 01:05 PM, Greg Seroka via RT wrote:
>
> Thu Jul 19 13:05:15 2012: Request 57514 was acted upon.
> Transaction: Ticket created by seroka at marine.rutgers.edu
> Queue: met_help
> Subject: Compiling METv4.0 with GRIB2 using PGI
> Owner: Nobody
> Requestors: seroka at marine.rutgers.edu
> Status: new
> Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=57514 >
>
>
> I'm writing in response to Ticket Number 37869 titled "Re: Compiling
MET" (
> http://mailman.ucar.edu/pipermail/met_help/2010-May/001351.html)
>
> I recently compiled MET 4.0 without GRIB2 compatibility, using PGI
10.5 on
> a Linux machine, C++ compiler pgcpp and Fortran compiler pgf77. For
the
> most part, it compiled correctly with the exception of including
#define
> _ISOC9X_SOURCE at the beginning of pair_base.cc due to an llabs call
issue.
>
> I then attempted to add GRIB2 compatibility with MET. I came across
the
> same error as was posted by Paula Doubrawa Moreira in May 2010 in
the
> aforementioned ticket. This was my error:
>
> stat_analysis.cc:
> "/opt/pgi/linux86-64/10.5/include/CC/cmath", line 56: error: the
global
> scope
> has no "abs"
> using _STLP_VENDOR_CSTD::abs;
> ^
>
> 1 error detected in the compilation of "stat_analysis.cc".
> make[4]: *** [stat_analysis] Error 2
> make[3]: *** [all] Error 2
> make[2]: *** [all] Error 2
> make[1]: *** [all] Error 2
> make: *** [all] Error 2
>
> which is peculiar considering I did not encounter this error when
compiling
> MET 4.0 without GRIB2.
>
> After much debugging, I discovered that "#include <cmath>" must be
inserted
> after stdlib.h in stat_analysis.cc. Looks like cmath is trying to
overload
> the abs function without abs being originally called by stdlib.h.
This may
> only be the case when using PGI, as PGI may have its own abs
function.
>
> The order I have the includes listed in stat_analysis.cc is as
follows:
>
> #include <cstdio>
> #include <dirent.h>
> #include <iostream>
> #include <stdlib.h>
> #include <string.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <cmath>
>
> #include "vx_log.h"
>
> #include "stat_analysis.h"
> #include "parse_stat_line.h"
> #include "aggr_stat_line.h"
> #include "stat_analysis_job.h"
>
> With this change, MET 4.0 compiled correctly and the error was
fixed.
>
> Hope this helps anyone else trying to compile MET 4.0 with GRIB2
> compatibility using PGI. Maybe this small fix is something to
consider
> adding to the next patch for MET 4.0?
>
> Greg
>
>
------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #57514] Compiling METv4.0 with GRIB2 using PGI
From: Paul Oldenburg
Time: Thu Jul 26 13:10:27 2012
Greg,
I posted a patch with several changes that pertain to the #include
ordering problem that you pointed out. You can
download the patch from this page, if you are interested:
http://www.dtcenter.org/met/users/support/known_issues/METv4.0/index.php
Note that we are using the PGI 11.7 compiler family to do testing at
the DTC. The change that you mentioned below is
one of the included changes. Thanks for pointing out this issue.
Paul
On 07/19/2012 01:05 PM, Greg Seroka via RT wrote:
>
> Thu Jul 19 13:05:15 2012: Request 57514 was acted upon.
> Transaction: Ticket created by seroka at marine.rutgers.edu
> Queue: met_help
> Subject: Compiling METv4.0 with GRIB2 using PGI
> Owner: Nobody
> Requestors: seroka at marine.rutgers.edu
> Status: new
> Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=57514 >
>
>
> I'm writing in response to Ticket Number 37869 titled "Re: Compiling
MET" (
> http://mailman.ucar.edu/pipermail/met_help/2010-May/001351.html)
>
> I recently compiled MET 4.0 without GRIB2 compatibility, using PGI
10.5 on
> a Linux machine, C++ compiler pgcpp and Fortran compiler pgf77. For
the
> most part, it compiled correctly with the exception of including
#define
> _ISOC9X_SOURCE at the beginning of pair_base.cc due to an llabs call
issue.
>
> I then attempted to add GRIB2 compatibility with MET. I came across
the
> same error as was posted by Paula Doubrawa Moreira in May 2010 in
the
> aforementioned ticket. This was my error:
>
> stat_analysis.cc:
> "/opt/pgi/linux86-64/10.5/include/CC/cmath", line 56: error: the
global
> scope
> has no "abs"
> using _STLP_VENDOR_CSTD::abs;
> ^
>
> 1 error detected in the compilation of "stat_analysis.cc".
> make[4]: *** [stat_analysis] Error 2
> make[3]: *** [all] Error 2
> make[2]: *** [all] Error 2
> make[1]: *** [all] Error 2
> make: *** [all] Error 2
>
> which is peculiar considering I did not encounter this error when
compiling
> MET 4.0 without GRIB2.
>
> After much debugging, I discovered that "#include <cmath>" must be
inserted
> after stdlib.h in stat_analysis.cc. Looks like cmath is trying to
overload
> the abs function without abs being originally called by stdlib.h.
This may
> only be the case when using PGI, as PGI may have its own abs
function.
>
> The order I have the includes listed in stat_analysis.cc is as
follows:
>
> #include <cstdio>
> #include <dirent.h>
> #include <iostream>
> #include <stdlib.h>
> #include <string.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <cmath>
>
> #include "vx_log.h"
>
> #include "stat_analysis.h"
> #include "parse_stat_line.h"
> #include "aggr_stat_line.h"
> #include "stat_analysis_job.h"
>
> With this change, MET 4.0 compiled correctly and the error was
fixed.
>
> Hope this helps anyone else trying to compile MET 4.0 with GRIB2
> compatibility using PGI. Maybe this small fix is something to
consider
> adding to the next patch for MET 4.0?
>
> Greg
>
>
------------------------------------------------
More information about the Met_help
mailing list