grass-addons icon indicating copy to clipboard operation
grass-addons copied to clipboard

[Bug] r.pi modules do not compile

Open petrasovaa opened this issue 4 years ago • 6 comments

Name of the addon r.pi

Describe the bug Compilation fails Windows, see e.g. log here

Additionally, g.extension r.pi fails on Ubuntu with the following although r.pi can be compiled directly.

Fetching <r.pi> from GRASS GIS Addons repository (be patient)...
Compiling...
matrix.c: In function ‘writeDistMatrixAndID’:
matrix.c:42:20: warning: format not a string literal and no format arguments [-Wformat-security]
      G_fatal_error(msg);
                    ^~~
matrix.c: In function ‘writeDistMatrixAndID’:
matrix.c:44:20: warning: format not a string literal and no format arguments [-Wformat-security]
      G_fatal_error(msg);
                    ^~~
OBJ.x86_64-pc-linux-gnu/heap.o: In function `upheap':
/tmp/grass7-anna-15561/tmp2zi1v7ur/r.pi/r.pi.fnn/heap.c:19: undefined reference to `exchange'
OBJ.x86_64-pc-linux-gnu/heap.o: In function `downheap':
/tmp/grass7-anna-15561/tmp2zi1v7ur/r.pi/r.pi.fnn/heap.c:36: undefined reference to `exchange'
collect2: error: ld returned 1 exit status
make[1]: *** [/tmp/grass7-anna-15561/tmp2zi1v7ur/r.pi/bin/r.pi.fnn] Error 1
frag.c: In function ‘writeFrag_local’:
frag.c:71:8: warning: ‘x’ is used uninitialized in this function [-Wuninitialized]
     if (x > 0 && flagbuf[y * ncols + x - 1] != 0)
        ^
frag.c:71:28: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (x > 0 && flagbuf[y * ncols + x - 1] != 0)
                          ~~^~~~~~~
Installing...
make[1]: *** No rule to make target 'install'.  Stop.
/usr/bin/install: cannot stat '/tmp/grass7-anna-15561/tmp2zi1v7ur/r.pi/bin/r.pi.fnn': No such file or directory
make[1]: *** [install] Error 1
Updating extensions metadata file...
Updating extension modules metadata file...
WARNING: No metadata available for module 'r.pi'.
WARNING: No metadata available for module 'r.pi.fnn'.
ERROR: Unable to read manual page: [Errno 2] No such file or directory:
       '/home/anna/.grass7/addons/docs/html/r.pi.fnn.html'

petrasovaa avatar Feb 19 '21 05:02 petrasovaa

Can you pls specify more? On which Linux distro does it fail with which error?

Debian:

https://grass.osgeo.org/grass7/manuals/addons/ --> r.pi present

It also compiles on my Fedora box.

neteler avatar Feb 19 '21 16:02 neteler

Sorry, I clarified in the description.

petrasovaa avatar Feb 19 '21 17:02 petrasovaa

Next try on my Fedora 33 box: I am not able to reproduce the problem. Maybe you have different compiler flags?

g.extension r.pi --verbose
Type of source identified as 'official'.
Fetching <r.pi> from GRASS GIS Addons repository (be patient)...
A    r.pi
A    r.pi/FIXES_markus.txt
A    r.pi/Makefile
A    r.pi/TODO.txt
A    r.pi/r.pi.corearea
A    r.pi/r.pi.corearea/Makefile
A    r.pi/r.pi.corearea/func.c

...
gcc  -O2 -march=native -std=gnu99 -fexceptions -fstack-protector -m64 -fdiagnostics-color -D_FORTIFY_SOURCE=1   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include    -DPACKAGE=\""grassmods"\"   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -DRELDIR=\"/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.fnn\" -o OBJ.x86_64-pc-linux-gnu/parser.o -c parser.c
: && gcc -L/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib -L/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib -Wl,--no-undefined -Wl,-z,now -Wl,--export-dynamic -Wl,-rpath-link,/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib -o /home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/bin/r.pi.fnn OBJ.x86_64-pc-linux-gnu/func.o OBJ.x86_64-pc-linux-gnu/heap.o OBJ.x86_64-pc-linux-gnu/main.o OBJ.x86_64-pc-linux-gnu/matrix.o OBJ.x86_64-pc-linux-gnu/parser.o    -lgrass_stats.7.8 -lgrass_raster.7.8 -lgrass_gis.7.8 -lgrass_rpi   -lm 
if [ "/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/bin/r.pi.fnn" != "" ] ; then GISRC=/home/mneteler/tmp/grass7-mneteler-1479941/gisrc GISBASE=/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu PATH="/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/scripts:$PATH" PYTHONPATH="/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/etc/python:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/gui/wxpython:$PYTHONPATH" LD_LIBRARY_PATH="/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/bin:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/scripts:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib" LC_ALL=C LANG=C LANGUAGE=C /home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/bin/r.pi.fnn --html-description < /dev/null | grep -v '</body>\|</html>' > r.pi.fnn.tmp.html ; fi
VERSION_NUMBER=7.8.6dev VERSION_DATE=2021 MODULE_TOPDIR=/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu \
        python3 /home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/tools/mkhtml.py r.pi.fnn > /home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/docs/html/r.pi.fnn.html
VERSION_NUMBER=7.8.6dev /home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/tools/g.html2man.py "/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/docs/html/r.pi.fnn.html" "/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/docs/man/man1/r.pi.fnn.1"
rm r.pi.fnn.tmp.html
make[1]: Leaving directory '/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.fnn'
make -C r.pi.graph || echo /home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph >> /home/mneteler/software/grass78/error.log
make[1]: Entering directory '/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph'
test -d OBJ.x86_64-pc-linux-gnu || mkdir -p OBJ.x86_64-pc-linux-gnu
gcc  -O2 -march=native -std=gnu99 -fexceptions -fstack-protector -m64 -fdiagnostics-color -D_FORTIFY_SOURCE=1   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include    -DPACKAGE=\""grassmods"\"   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -DRELDIR=\"/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph\" -o OBJ.x86_64-pc-linux-gnu/draw.o -c draw.c
gcc  -O2 -march=native -std=gnu99 -fexceptions -fstack-protector -m64 -fdiagnostics-color -D_FORTIFY_SOURCE=1   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include    -DPACKAGE=\""grassmods"\"   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -DRELDIR=\"/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph\" -o OBJ.x86_64-pc-linux-gnu/func.o -c func.c
gcc  -O2 -march=native -std=gnu99 -fexceptions -fstack-protector -m64 -fdiagnostics-color -D_FORTIFY_SOURCE=1   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include    -DPACKAGE=\""grassmods"\"   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -DRELDIR=\"/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph\" -o OBJ.x86_64-pc-linux-gnu/hull.o -c hull.c
gcc  -O2 -march=native -std=gnu99 -fexceptions -fstack-protector -m64 -fdiagnostics-color -D_FORTIFY_SOURCE=1   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include    -DPACKAGE=\""grassmods"\"   -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -I/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/include -DRELDIR=\"/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph\" -o OBJ.x86_64-pc-linux-gnu/main.o -c main.c
: && gcc -L/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib -L/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib -Wl,--no-undefined -Wl,-z,now -Wl,--export-dynamic -Wl,-rpath-link,/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib -o /home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/bin/r.pi.graph OBJ.x86_64-pc-linux-gnu/draw.o OBJ.x86_64-pc-linux-gnu/func.o OBJ.x86_64-pc-linux-gnu/hull.o OBJ.x86_64-pc-linux-gnu/main.o    -lgrass_stats.7.8 -lgrass_raster.7.8 -lgrass_gis.7.8 -lgrass_rpi   -lm 
if [ "/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/bin/r.pi.graph" != "" ] ; then GISRC=/home/mneteler/tmp/grass7-mneteler-1479941/gisrc GISBASE=/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu PATH="/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/scripts:$PATH" PYTHONPATH="/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/etc/python:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/gui/wxpython:$PYTHONPATH" LD_LIBRARY_PATH="/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/bin:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/scripts:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib:/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/lib" LC_ALL=C LANG=C LANGUAGE=C /home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/bin/r.pi.graph --html-description < /dev/null | grep -v '</body>\|</html>' > r.pi.graph.tmp.html ; fi
VERSION_NUMBER=7.8.6dev VERSION_DATE=2021 MODULE_TOPDIR=/home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu \
        python3 /home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/tools/mkhtml.py r.pi.graph > /home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/docs/html/r.pi.graph.html
VERSION_NUMBER=7.8.6dev /home/mneteler/software/grass78/dist.x86_64-pc-linux-gnu/tools/g.html2man.py "/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/docs/html/r.pi.graph.html" "/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/docs/man/man1/r.pi.graph.1"
rm r.pi.graph.tmp.html
make[1]: Leaving directory '/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph'
make -C r.pi.graph.dec || echo /home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph.dec >> /home/mneteler/software/grass78/error.log
make[1]: Entering directory '/home/mneteler/tmp/grass7-mneteler-1479941/tmpsrxjg_4m/r.pi/r.pi.graph.dec
...

Manual page for <r.pi.graph.dec> updated
Manual page for <r.pi.graph.red> updated
Manual page for <r.pi.odc> updated
Manual page for <r.pi.corr.mw> updated
Manual page for <r.pi.energy.pr> updated
Manual page for <r.pi.fnn> updated
Installation of <r.pi> successfully finished
...

neteler avatar Feb 19 '21 23:02 neteler

It also compiles on Mac OSX 10.15.7 in GRASS7.9dev (binary from Michael from Jan 11), it just gives the same warnings. Helena

GRASS nc_spm_08_grass7/assignments:~ > g.extension r.pi Fetching <r.pi> from GRASS GIS Addons repository (be patient)... Compiling... matrix.c:42:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security] G_fatal_error(msg); ^~~ matrix.c:42:20: note: treat the string as an argument to avoid this G_fatal_error(msg); ^ "%s", 1 warning generated. matrix.c:44:20: warning: format string is not a string literal (potentially insecure) [-Wformat-security] G_fatal_error(msg); ^~~ matrix.c:44:20: note: treat the string as an argument to avoid this G_fatal_error(msg); ^ "%s", 1 warning generated. Installing... make[1]: *** No rule to make target install'. Stop. Updating extensions metadata file... Updating extension modules metadata file... WARNING: No metadata available for module 'r.pi'. Installation of <r.pi> successfully finished

hmitaso avatar Feb 20 '21 00:02 hmitaso

Still valid for Windows.

petrasovaa avatar Mar 01 '21 05:03 petrasovaa

@petrasovaa Please check https://github.com/OSGeo/grass-addons/pull/840

HuidaeCho avatar Dec 16 '22 22:12 HuidaeCho