OSGeo / grass-addons

GRASS GIS Addons Repository
https://grass.osgeo.org/grass-stable/manuals/addons/
GNU General Public License v2.0
103 stars 154 forks source link

[Bug] r.pi modules do not compile #438

Open petrasovaa opened 3 years ago

petrasovaa commented 3 years ago

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'
neteler commented 3 years ago

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.

petrasovaa commented 3 years ago

Sorry, I clarified in the description.

neteler commented 3 years ago

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
...
hmitaso commented 3 years ago

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

petrasovaa commented 3 years ago

Still valid for Windows.

HuidaeCho commented 1 year ago

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