TEOS-10 / GSW-R

R implementation of the Thermodynamic Equation Of Seawater - 2010 (TEOS-10)
http://teos-10.github.io/GSW-R/
Other
8 stars 5 forks source link

CRAN build failing for Debian #17

Closed richardsc closed 8 years ago

richardsc commented 8 years ago

From https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/gsw-00check.html

using R Under development (unstable) (2016-07-11 r70891)
using platform: x86_64-pc-linux-gnu (64-bit)
using session charset: UTF-8
checking for file ‘gsw/DESCRIPTION’ ... OK
this is package ‘gsw’ version ‘1.0-3’
checking package namespace information ... OK
checking package dependencies ... OK
checking if this is a source package ... OK
checking if there is a namespace ... OK
checking for executable files ... OK
checking for hidden files and directories ... OK
checking for portable file names ... OK
checking for sufficient/correct file permissions ... OK
checking whether package ‘gsw’ can be installed ... ERROR
Installation failed.
See ‘/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/gsw.Rcheck/00install.out’ for details.
DONE
See https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/gsw-00install.html for details.

Details:

* installing to library ‘/home/hornik/tmp/R.check/r-devel-gcc/Work/build/Packages’
* installing *source* package ‘gsw’ ...
** package ‘gsw’ successfully unpacked and MD5 sums checked
** libs
make[1]: Entering directory '/tmp/Rtmp3o5B2Z/R.INSTALL52783215e22b/gsw/src'
gcc-6 -std=c11 -I/home/hornik/tmp/R.check/r-devel-gcc/Work/build/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -Wall -Wno-unused -pedantic -mtune=native -c gsw_oceanographic_toolbox.c -o gsw_oceanographic_toolbox.o
gcc-6 -std=c11 -I/home/hornik/tmp/R.check/r-devel-gcc/Work/build/include -DNDEBUG  -I/usr/local/include    -fpic  -g -O3 -Wall -Wno-unused -pedantic -mtune=native -c gsw_p_from_z.c -o gsw_p_from_z.o
gsw_p_from_z.c: In function ‘gsw_p_from_z’:
gsw_p_from_z.c:15:22: error: ‘M_PI’ undeclared (first use in this function)
     double deg2rad = M_PI / 180.0;
                      ^~~~
gsw_p_from_z.c:15:22: note: each undeclared identifier is reported only once for each function it appears in
/home/hornik/tmp/R.check/r-devel-gcc/Work/build/etc/Makeconf:132: recipe for target 'gsw_p_from_z.o' failed
make[1]: *** [gsw_p_from_z.o] Error 1
make[1]: Leaving directory '/tmp/Rtmp3o5B2Z/R.INSTALL52783215e22b/gsw/src'
ERROR: compilation failed for package ‘gsw’
* removing ‘/home/hornik/tmp/R.check/r-devel-gcc/Work/build/Packages/gsw’
dankelley commented 8 years ago

Interesting. The simple way to fix that is to copy the M_PI definition from another compiler. (They seem to have changed gcc-6) I'm off to a proposal defence but can do this in 3 minutes this aft.

PS. the gcc-6 webpage is a bit scary (quote: "huge number of improvements in GCC 6"). I don't like the sounds of "huge".

dankelley commented 8 years ago

I think I've fixed this in commit 80a92f1a3655216950aed8fa48ce8f7b976d10ef

richardsc commented 8 years ago

I reported this here, but I wonder if this should be reported upstream in the GSW-C repo? That way when we do (eventually) update to the more recent C sources we won't have to deal with it again ...

dankelley commented 8 years ago

I don't think this applies to GSW-C; it is just in code that I transliterated into C. In GSW-C, pi is defined as below. But I used M_PI because I prefer to use values from the C include files. As to why this is no longer present, I have no idea. But it doesn't matter hugely, I think, because the code fix that I put in will use the system-provided M_PI if there is one, falling back to a numerical definition otherwise. (As an aside, the definition I've used has 32 digits, compared to the 18 digits used in GSW-C. I suppose I could switch mine, but this passes the R build-check and so I don't see the point in degrading the number unless we had a check-value failure.)

$ grep -ni 3.141592 *
gsw_internal_const.h:14:    pi = 3.141592653589793, \