r-spatial / link2GI

Simplify the linking of GIS/RS and CLI tools
https://r-spatial.github.io/link2GI
GNU General Public License v3.0
25 stars 7 forks source link

findGRASS finds grass where it is not #43

Closed gse-cc-git closed 4 years ago

gse-cc-git commented 4 years ago

Hello, Using Linux Ubuntu 20.04 where grass in installed here:

user@comp:~$ which grass78
/usr/bin/grass78

link2GI::findGRASS returns

     instDir version installation_type
1 /opt/grass   7.8.2           grass78

but there is nothing in /opt/ directory

hence the following (from the examples) fails

> link2GI::linkGRASS7(meuse_sf)
Error in rgrass7::initGRASS(gisBase = grass$gisbase_GRASS, home = home,  : 
  /opt/grass not found

Sorry to bother you if this issue is related to my understanding of the linux system files rather than on your package.

Thank you for your help

 version  R version 3.6.3 (2020-02-29)
 os       Ubuntu 20.04 LTS            
 system   x86_64, linux-gnu     
link2GI     * 0.4.3    2020-07-16 [1] Github (r-spatial/link2GI@fb91d36)
gisma commented 4 years ago

Thanks for sharing. I will check it asap. EDIT: I have to check the parsing of the GRASS starting script there has obviously changed something. Hope to fix this until tomorrow.

gisma commented 4 years ago

I have tried to fix the parsing of the GRASS init script which is looking and setting for the correct path of the GRASS installation folder while starting GRASS . Please check if findGrass() will return the correct path and in addition runs.

gse-cc-git commented 4 years ago

Hello, I installed v0.4.4 and still have the same issue with findGRASS()

On my machine GRASS was installed in /usr/lib/grass78 (came with QGIS 3.10).

searchGRASSX fails in finding v.clean with file.exists(file.path(raw_GRASS,"v.clean")) and falls back to "/opt/grass"

system2("find", paste(MP," ! -readable -prune -o -type f -executable -iname 'grass??' -print"),stdout = TRUE,stderr = FALSE) points the binaries in "/usr/bin/grass78"

        rd = file.exists(file.path(raw_GRASS,"v.clean"))  
        if (rd)  root_dir = raw_GRASS
        else root_dir =  "/opt/grass"

Thanks a lot for your work.

gisma commented 4 years ago

@gse-cc-git could you pls check if this new workaround fix this issue?

gse-cc-git commented 4 years ago

@gisma it works now:

> grass <- link2GI::findGRASS()
> grass
           instDir version installation_type
1 /usr/lib/grass78   7.8.2           grass78