I recently got GCC 7.1 installed on a local box and decided to build my Baselibs which includes NCO 4.6.0. All seems to build okay (barring an issue with antlr since GCC 7.1 no longer supplies gcj, so I need javac), but when I get to NCO, it dies at:
I'm using mpic++ because I build HDF5 with parallel support, so the toolchain that uses netCDF needs it. I first checked my antlr install because I saw that the error referenced antlr, but that wasn't the issue. I also tried compiling with GCC 6.3.0 (and a slightly older Open MPI) and that does work (with either javac available or not).
So, I'm at the point where I'm thinking this is due to some new Standards strictness in GCC 7.1.0. A glance around the internet seems to say that char* requires double quotes and char single, but double quotes imply null termination and your string is only null...brain asplode. Still, I made the dumb fix of double quotes instead of single quotes:
fmc_all_cls.cc: In member function ‘var_sct* vlist_cls::atoi_fnd(bool&, std::vector<antlr::ASTRefCount<antlr::AST> >&, fmc_cls&, ncoTree&)’:
fmc_all_cls.cc:4193:21: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
char *pend="\0";
^~~~
fmc_all_cls.cc:4214:21: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
char *pend="\0";
^~~~
mv -f .deps/fmc_all_cls.Tpo .deps/fmc_all_cls.Po
though I do now get warnings (but warning > error). Since my C++ knowledge is "I can read it and sometimes hack codes to add a cout for debugging", it is possible and highly probable I broke whatever this is doing. As I don't know how to trigger whatever code I just altered (I only recently enabled building of ncap2 because I wanted to play around with it; it looks useful!), I don't know if I just broke everything.
So, Charlie, do you know a "correct" fix for this? Or do you suspect this is a GCC 7.1.0 bug that I should report? Or should I just pass in -fpermissive in my configure for NCO if using GCC 7.1.0 and be done with it?
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Side note: If I set CXXFLAGS=-fpermissive for NCO configuration and building, I do get past this as well. I can easily add a make rule for 'if gfortran 7', so that's a workaround for now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Matthew, thank you for the GCC 7 compile report. The initialization line that causes problems is weird. Henry, please consider rewriting these initializations as Matthew suggests, or even something more GCC7-friendly. I think GCC7 implements ISO C++ 2011 and drops support for a deprecated feature that now triggers an error instead. It's unclear to me what the code in question does or I would try to re-write it myself, but my inclination is that the initialization should be
char *pend=NULL;
Since pend performs same role as sng_cnv_rcd in the rest of NCO. We need NCO to be GCC7-compliant...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
All, or, well, Charlie,
I recently got GCC 7.1 installed on a local box and decided to build my Baselibs which includes NCO 4.6.0. All seems to build okay (barring an issue with antlr since GCC 7.1 no longer supplies gcj, so I need javac), but when I get to NCO, it dies at:
I'm using
mpic++
because I build HDF5 with parallel support, so the toolchain that uses netCDF needs it. I first checked my antlr install because I saw that the error referenced antlr, but that wasn't the issue. I also tried compiling with GCC 6.3.0 (and a slightly older Open MPI) and that does work (with either javac available or not).So, I'm at the point where I'm thinking this is due to some new Standards strictness in GCC 7.1.0. A glance around the internet seems to say that
char*
requires double quotes andchar
single, but double quotes imply null termination and your string is only null...brain asplode. Still, I made the dumb fix of double quotes instead of single quotes:and I don't get an error, so it all works:
though I do now get warnings (but warning > error). Since my C++ knowledge is "I can read it and sometimes hack codes to add a
cout
for debugging", it is possible and highly probable I broke whatever this is doing. As I don't know how to trigger whatever code I just altered (I only recently enabled building ofncap2
because I wanted to play around with it; it looks useful!), I don't know if I just broke everything.So, Charlie, do you know a "correct" fix for this? Or do you suspect this is a GCC 7.1.0 bug that I should report? Or should I just pass in
-fpermissive
in my configure for NCO if using GCC 7.1.0 and be done with it?Matt
Side note: If I set
CXXFLAGS=-fpermissive
for NCO configuration and building, I do get past this as well. I can easily add a make rule for 'if gfortran 7', so that's a workaround for now.Matthew, thank you for the GCC 7 compile report. The initialization line that causes problems is weird. Henry, please consider rewriting these initializations as Matthew suggests, or even something more GCC7-friendly. I think GCC7 implements ISO C++ 2011 and drops support for a deprecated feature that now triggers an error instead. It's unclear to me what the code in question does or I would try to re-write it myself, but my inclination is that the initialization should be
Since
pend
performs same role as sng_cnv_rcd in the rest of NCO. We need NCO to be GCC7-compliant...