[GRASS-dev] [GRASS GIS] #2598: g.extension compilation fails

#2598: g.extension compilation fails
-----------------------+---------------------------------
  Reporter: ewcgrass | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.3
Component: Default | Version: svn-releasebranch70
Resolution: fixed | Keywords:
       CPU: x86-64 | Platform: Linux
-----------------------+---------------------------------

Comment (by rdzur):

Markus, in running g.extension to attempt to compile r.damflood on the
7.0.3RC1 version from http://grassmac.wikidot.com (GRASS 7.0.3 development
4 Jan 2016) r.damflood does not compile and indicates a SWE.c error which
I don't know if this is related to the fix you contributed to r67415 or
some other issue with my system?

This is the error I currently have:

{{{
g.extension --verbose extension=r.damflood operation=add
Fetching <r.damflood> from GRASS-Addons SVN repository (be patient)...
A r.damflood/SWE.c
A r.damflood/SWE.h
A r.damflood/main.c
A r.damflood/r.damflood.html
A r.damflood/dam_failure.png
A r.damflood/Makefile
Checked out revision 67490.
Compiling...
mkdir -p
/var/folders/m3/4x793z_n5sl0v4glj4qlz1sh0000gp/T/tmpP5reiG/r.damflood/bin
mkdir -p
/var/folders/m3/4x793z_n5sl0v4glj4qlz1sh0000gp/T/tmpP5reiG/r.damflood/etc
mkdir -p
/var/folders/m3/4x793z_n5sl0v4glj4qlz1sh0000gp/T/tmpP5reiG/r.damflood/docs/html
mkdir -p
/var/folders/m3/4x793z_n5sl0v4glj4qlz1sh0000gp/T/tmpP5reiG/r.damflood/docs/man
mkdir -p
/var/folders/m3/4x793z_n5sl0v4glj4qlz1sh0000gp/T/tmpP5reiG/r.damflood/docs/man/man1
test -d OBJ.x86_64-apple-darwin14.5.0 || mkdir -p OBJ.x86_64-apple-
darwin14.5.0
gcc -I/usr/local/include -g -O2 -arch i386 -arch x86_64
-I/usr/local/include -I/Applications/GRASS-7.0.app/Contents/MacOS/include
-I/Applications/GRASS-7.0.app/Contents/MacOS/include
-DPACKAGE=\""grassmods"\"
-I/Applications/GRASS-7.0.app/Contents/MacOS/include
-I/Applications/GRASS-7.0.app/Contents/MacOS/include
-DRELDIR=\"/private/var/folders/m3/4x793z_n5sl0v4glj4qlz1sh0000gp/T/tmpP5reiG/r.damflood\"
-o OBJ.x86_64-apple-darwin14.5.0/SWE.o -c SWE.c
SWE.c:521:9: warning: using floating point absolute value
function 'fabs' when argument is of integer type
[-Wabsolute-value]
                                 if
(fabs(m_u2[row][col]>=1000 )){
                                     ^
SWE.c:521:9: note: use function 'abs' instead
                                 if
(fabs(m_u2[row][col]>=1000 )){
                                     ^~~~
                                     abs
SWE.c:707:31: warning: using integer absolute value function
'abs' when argument is of floating point type [-Wabsolute-
value]
                                 if ((timestep/res_ns*(abs(ab
s(m_v2[row][col])+sqrt(g*m_h2[row][col]))))>1){
                                                           ^
SWE.c:707:31: note: use function 'fabs' instead
                                 if ((timestep/res_ns*(abs(ab
s(m_v2[row][col])+sqrt(g*m_h2[row][col]))))>1){
^~~
fabs
SWE.c:707:27: warning: using integer absolute value function
'abs' when argument is of floating point type [-Wabsolute-
value]
                                 if ((timestep/res_ns*(abs(ab
s(m_v2[row][col])+sqrt(g*m_h2[row][col]))))>1){
                                                       ^
SWE.c:707:27: note: use function 'fabs' instead
                                 if ((timestep/res_ns*(abs(ab
s(m_v2[row][col])+sqrt(g*m_h2[row][col]))))>1){
                                                       ^~~
                                                       fabs
3 warnings generated.
SWE.c:521:9: warning: using floating point absolute value
function 'fabs' when argument is of integer type
[-Wabsolute-value]
                                 if
(fabs(m_u2[row][col]>=1000 )){
                                     ^
SWE.c:521:9: note: use function 'abs' instead
                                 if
(fabs(m_u2[row][col]>=1000 )){
                                     ^~~~
                                     abs
SWE.c:707:31: warning: using integer absolute value function
'abs' when argument is of floating point type [-Wabsolute-
value]
                                 if ((timestep/res_ns*(abs(ab
s(m_v2[row][col])+sqrt(g*m_h2[row][col]))))>1){
                                                           ^
SWE.c:707:31: note: use function 'fabs' instead
                                 if ((timestep/res_ns*(abs(ab
s(m_v2[row][col])+sqrt(g*m_h2[row][col]))))>1){
^~~
fabs
SWE.c:707:27: warning: using integer absolute value function
'abs' when argument is of floating point type [-Wabsolute-
value]
                                 if ((timestep/res_ns*(abs(ab
s(m_v2[row][col])+sqrt(g*m_h2[row][col]))))>1){
                                                       ^
SWE.c:707:27: note: use function 'fabs' instead
                                 if ((timestep/res_ns*(abs(ab
s(m_v2[row][col])+sqrt(g*m_h2[row][col]))))>1){
                                                       ^~~
                                                       fabs
3 warnings generated.
main.c:223:9: error: expected parameter declarator
   char* strcat(char* s, const char* ct);
         ^
/usr/include/secure/_string.h:125:38: note: expanded from
macro 'strcat'
   __builtin___strcat_chk (dest, src, __darwin_obsz (dest))
                                      ^
/usr/include/secure/_common.h:39:62: note: expanded from
macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object,
_USE_FORTIFY_LEVEL > 1 ? 1 : 0)
  ^
/usr/include/secure/_common.h:30:32: note: expanded from
macro '_USE_FORTIFY_LEVEL'
# define _USE_FORTIFY_LEVEL 2
                                ^
main.c:223:9: error: expected ')'
/usr/include/secure/_string.h:125:38: note: expanded from
macro 'strcat'
   __builtin___strcat_chk (dest, src, __darwin_obsz (dest))
                                      ^
/usr/include/secure/_common.h:39:62: note: expanded from
macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object,
_USE_FORTIFY_LEVEL > 1 ? 1 : 0)
  ^
/usr/include/secure/_common.h:30:32: note: expanded from
macro '_USE_FORTIFY_LEVEL'
# define _USE_FORTIFY_LEVEL 2
                                ^
main.c:223:9: note: to match this '('
/usr/include/secure/_string.h:125:38: note: expanded from
macro 'strcat'
   __builtin___strcat_chk (dest, src, __darwin_obsz (dest))
                                      ^
/usr/include/secure/_common.h:39:53: note: expanded from
macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object,
_USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                                                     ^
main.c:223:9: warning: type specifier missing, defaults to
'int' [-Wimplicit-int]
   char* strcat(char* s, const char* ct);
         ^
/usr/include/secure/_string.h:125:38: note: expanded from
macro 'strcat'
   __builtin___strcat_chk (dest, src, __darwin_obsz (dest))
                                      ^
/usr/include/secure/_common.h:39:31: note: expanded from
macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object,
_USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                               ^
main.c:223:9: error: conflicting types for
'__builtin___strcat_chk'
/usr/include/secure/_string.h:125:3: note: expanded from
macro 'strcat'
   __builtin___strcat_chk (dest, src, __darwin_obsz (dest))
   ^
main.c:223:9: note: '__builtin___strcat_chk' is a builtin
with type 'char *(char *, const char *, unsigned long)'
/usr/include/secure/_string.h:125:3: note: expanded from
macro 'strcat'
   __builtin___strcat_chk (dest, src, __darwin_obsz (dest))
   ^
gcc -I/usr/local/include -g -O2 -arch i386 -arch x86_64
-I/usr/local/include -I/Applications/GRASS-7.0.app/Contents/MacOS/include
-I/Applications/GRASS-7.0.app/Contents/MacOS/include
-DPACKAGE=\""grassmods"\"
-I/Applications/GRASS-7.0.app/Contents/MacOS/include
-I/Applications/GRASS-7.0.app/Contents/MacOS/include
-DRELDIR=\"/private/var/folders/m3/4x793z_n5sl0v4glj4qlz1sh0000gp/T/tmpP5reiG/r.damflood\"
-o OBJ.x86_64-apple-darwin14.5.0/main.o -c main.c
1 warning and 3 errors generated.
make: *** [OBJ.x86_64-apple-darwin14.5.0/main.o] Error 1
ERROR: Compilation failed, sorry. Please check above error messages.
}}}

Thanks for any ideas...

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2598#comment:14&gt;
GRASS GIS <https://grass.osgeo.org>