Re: [GRASS-dev] Difficulty compiling GRASS on Mac

2018-05-11 Thread Michael Barton
Eric Hutton at the Community Surface Dynamics Modeling System has created a 
recipe for compiling GRASS using Anaconda. You can find it at: 

https://github.com/csdms-stack/grass-recipe

I'm using a variant of this to create the stand-alone binaries for the Mac. 

Michael
__
C. Michael Barton 
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University
Tempe, AZ  85287-2402
USA
 
voice:480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax:  480-965-7671(SHESC), 480-727-0709 (CSDC)
www:  http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton
 
On 5/11/18, 2:55 AM, "grass-dev on behalf of 
grass-dev-requ...@lists.osgeo.org"  wrote:

Date: Thu, 10 May 2018 12:09:43 -0700
From: Seth Price 
To: grass-dev@lists.osgeo.org
Subject: [GRASS-dev] Difficulty compiling GRASS on Mac
Message-ID:

Content-Type: text/plain; charset="utf-8"

Hey all, I'm trying to compile GRASS on Mac 10.13.4 so I can compile and
link to the GRASS libraries. I don't need most of the GIS features, just
enough to create and run my own C++ modules. I'm having some troubles with
grass-7.4.0 and grass-7.4.1RC1. The first problem I'm having is an error
linking libgrass_gis.7.4.1RC1.dylib. I get this error:


Undefined symbols for architecture x86_64:

  "_libiconv", referenced from:

  _print_escaped_for_xml in parser_interface.o

  "_libiconv_close", referenced from:

  _print_escaped_for_xml in parser_interface.o

  "_libiconv_open", referenced from:

  _print_escaped_for_xml in parser_interface.o

ld: symbol(s) not found for architecture x86_64


I can rerun the command and manually add the correct linking path for
iconv, and it works. I'm not sure why it wouldn't find iconv otherwise, but
it is what it is. This is the initial configure command that I'm using:

./configure --with-opengl=aqua --with-prefix=/usr/local --enable-shared

I've found that I can change the configure command and fix that problem:

./configure --with-opengl=aqua --with-libs=/usr/local/lib
--with-prefix=/usr/local --enable-shared

However, then it progresses and returns this error while compiling many
modules:

dyld: Library not loaded:
/usr/local/grass-7.4.1RC1/lib/libgrass_gis.7.4.1RC1.dylib

  Referenced from:
/usr/local/grass/grass-7.4.1RC1/dist.x86_64-apple-darwin17.5.0/bin/g.parser

  Reason: image not found

make: *** [d.correlate.tmp.html] Error 1

The dylib looks like it's been successfully compiled at
dist.x86_64-apple-darwin17.5.0/lib/libgrass_gis.7.4.1RC1.dylib and just the
linking path for the libraries is wrong. I can't seem to shake it with any
of the online GRASS compiling instructions I've found. What might cause
this? Are there any current instructions for getting the shared libraries
compiled and installed?


Also, I'm able to install via homebrew, but then I have this problem when
compiling my modules against GRASS:

*sources/CameraOptic.cpp:33:23: **error: **use of undeclared identifier
'PACKAGE'*

G_verbose_message(_("(%5d) Camera optical adjustment..."),

*  ^*

*/usr/local/opt/grass7/grass-base/include/grass/glocale.h:10:26: note:
*expanded
from macro '_'

#define _(str) G_gettext(PACKAGE,(str))

I've never seen it before and can only guess that it would be fixed by a
fresh install of GRASS from source. Identical code compiles fine under
Ubuntu. Does anyone know what might be causing this? Or what might I do to
fix it?

Thanks,
Seth

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] remove raster map in C code

2018-05-11 Thread Markus Metz
On Fri, May 11, 2018 at 11:54 AM, Luca Delucchi 
wrote:
>
> On 11 May 2018 at 10:54, Markus Metz 
wrote:
> > Hi Luca,
> >
>
> Hi Markus,
>
> > On Fri, May 11, 2018 at 10:26 AM, Luca Delucchi 
> > wrote:
> >>
> >> Hi devs,
> >>
> >> I would like to remove a raster map inside a C module, looking aroung
> >> I found the M_do_remove function used in g.remove and r.reclass. So I
> >> tried to use it but I get error in compilation
> >>
> >> OBJ.x86_64-pc-linux-gnu/main.o: In function `main':
> >> main.c:(.text.startup+0x9eb): undefined reference to `M_get_element'
> >> main.c:(.text.startup+0x9f5): undefined reference to `M_do_remove'
> >> collect2: error: ld returned 1 exit status
> >
> > this is a problem of the linker: you need to link against the manage
lib,
> > see e.g. the Makefile for g.remove. Try
> >
> > LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
> > DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)
> >
> > in the Makefile of your module.
> >
>
> thanks, now it compile but I get "Segmentation fault", the module is
> r.tile, I attached the diff, could someone have a look to it please?

I think you need to call M_read_list() first, before you loop over the
tiles.

Markus M

>
> > HTH,
> >
> > Markus M
> >
>
>
>
> --
> ciao
> Luca
>
> www.lucadelu.org
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] [GRASS GIS] #3561: quiet option for garray.write()

2018-05-11 Thread GRASS GIS
#3561: quiet option for garray.write()
--+--
  Reporter:  pesekon2 |  Owner:  grass-dev@…
  Type:  enhancement  | Status:  new
  Priority:  normal   |  Milestone:
 Component:  Python   |Version:  svn-trunk
Resolution:   |   Keywords:  python, script.array
   CPU:  Unspecified  |   Platform:  All
--+--
Changes (by pesekon2):

 * Attachment "array_diff" added.

 quiet option for script.array.write()

-- 
Ticket URL: 
GRASS GIS 

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] [GRASS GIS] #3561: quiet option for garray.write()

2018-05-11 Thread GRASS GIS
#3561: quiet option for garray.write()
--+-
 Reporter:  pesekon2  |  Owner:  grass-dev@…
 Type:  enhancement   | Status:  new
 Priority:  normal|  Milestone:
Component:  Python|Version:  svn-trunk
 Keywords:  python, script.array  |CPU:  Unspecified
 Platform:  All   |
--+-
 Hi,

 it would be very useful to have a quiet option for r.in.bin used in
 write() method of objects in grass.script.array.

 Yes, it is only logging percents, but due to this behaviour, it cannot be
 used in a loop with its own percentage log (it will contain a 100 % log
 for each loop).

-- 
Ticket URL: 
GRASS GIS 

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] remove raster map in C code

2018-05-11 Thread Luca Delucchi
On 11 May 2018 at 10:54, Markus Metz  wrote:
> Hi Luca,
>

Hi Markus,

> On Fri, May 11, 2018 at 10:26 AM, Luca Delucchi 
> wrote:
>>
>> Hi devs,
>>
>> I would like to remove a raster map inside a C module, looking aroung
>> I found the M_do_remove function used in g.remove and r.reclass. So I
>> tried to use it but I get error in compilation
>>
>> OBJ.x86_64-pc-linux-gnu/main.o: In function `main':
>> main.c:(.text.startup+0x9eb): undefined reference to `M_get_element'
>> main.c:(.text.startup+0x9f5): undefined reference to `M_do_remove'
>> collect2: error: ld returned 1 exit status
>
> this is a problem of the linker: you need to link against the manage lib,
> see e.g. the Makefile for g.remove. Try
>
> LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
> DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)
>
> in the Makefile of your module.
>

thanks, now it compile but I get "Segmentation fault", the module is
r.tile, I attached the diff, could someone have a look to it please?

> HTH,
>
> Markus M
>



-- 
ciao
Luca

www.lucadelu.org
Index: raster/r.tile/Makefile
===
--- raster/r.tile/Makefile	(revision 72704)
+++ raster/r.tile/Makefile	(working copy)
@@ -2,8 +2,8 @@
 
 PGM = r.tile
 
-LIBES = $(RASTERLIB) $(GISLIB)
-DEPENDENCIES = $(RASTERDEP) $(GISDEP)
+LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
+DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
Index: raster/r.tile/main.c
===
--- raster/r.tile/main.c	(revision 72704)
+++ raster/r.tile/main.c	(working copy)
@@ -15,12 +15,15 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 static struct
 {
 struct Option *rastin, *rastout, *width, *height, *overlap;
 } parm;
+
 static struct Cell_head dst_w, src_w, ovl_w;
 static int xtiles, ytiles;
 static RASTER_MAP_TYPE map_type;
@@ -30,6 +33,9 @@
 int main(int argc, char *argv[])
 {
 struct GModule *module;
+struct Range int_range;
+struct FPRange fp_range;
+struct Flag *flag;
 int infile;
 const char *mapset;
 size_t cell_size;
@@ -75,6 +81,10 @@
 parm.overlap->multiple = NO;
 parm.overlap->description = _("Overlap of tiles");
 
+flag = G_define_flag();
+flag->key = 'n';
+flag->description = _("Does not create tiles having only NULL values");
+
 if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -149,8 +159,31 @@
 	}
 
 	for (xtile = 0; xtile < xtiles; xtile++) {
-	Rast_close(outfiles[xtile]);
-	write_support_files(xtile, ytile, overlap);
+Rast_close(outfiles[xtile]);
+write_support_files(xtile, ytile, overlap);
+if (flag->answer){
+char name[GNAME_MAX];
+sprintf(name, "%s-%03d-%03d", parm.rastout->answer, ytile, xtile);
+if (map_type == CELL_TYPE) {
+CELL min, max;
+Rast_read_range(name, G_mapset(), &int_range);
+min = int_range.min;
+max = int_range.max;
+if (IS_NULL_C(&min) && IS_NULL_C(&max)){
+M_do_remove(M_get_element("raster"), name);
+G_debug(0, "Removed empty tile %s", name);
+}
+} else {
+DCELL min, max;
+Rast_read_fp_range(name, mapset, &fp_range);
+min = fp_range.min;
+max = fp_range.max;
+if (IS_NULL_D(&min) && IS_NULL_D(&max)){
+M_do_remove(M_get_element("raster"), name);
+G_debug(0, "Removed empty tile %s", name);
+}
+}
+}
 	}
 }
 
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] remove raster map in C code

2018-05-11 Thread Markus Metz
Hi Luca,

On Fri, May 11, 2018 at 10:26 AM, Luca Delucchi 
wrote:
>
> Hi devs,
>
> I would like to remove a raster map inside a C module, looking aroung
> I found the M_do_remove function used in g.remove and r.reclass. So I
> tried to use it but I get error in compilation
>
> OBJ.x86_64-pc-linux-gnu/main.o: In function `main':
> main.c:(.text.startup+0x9eb): undefined reference to `M_get_element'
> main.c:(.text.startup+0x9f5): undefined reference to `M_do_remove'
> collect2: error: ld returned 1 exit status

this is a problem of the linker: you need to link against the manage lib,
see e.g. the Makefile for g.remove. Try

LIBES = $(MANAGELIB) $(RASTERLIB) $(GISLIB)
DEPENDENCIES = $(MANAGEDEP) $(RASTERDEP) $(GISDEP)

in the Makefile of your module.

HTH,

Markus M

>
> In the source code of the module I added #include 
> that it seems the header containing the definition of M_do_remove.
>
> Any idea?
>
> Thanks in advance
>
> --
> ciao
> Luca
>
> www.lucadelu.org
> ___
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] remove raster map in C code

2018-05-11 Thread Luca Delucchi
Hi devs,

I would like to remove a raster map inside a C module, looking aroung
I found the M_do_remove function used in g.remove and r.reclass. So I
tried to use it but I get error in compilation

OBJ.x86_64-pc-linux-gnu/main.o: In function `main':
main.c:(.text.startup+0x9eb): undefined reference to `M_get_element'
main.c:(.text.startup+0x9f5): undefined reference to `M_do_remove'
collect2: error: ld returned 1 exit status

In the source code of the module I added #include 
that it seems the header containing the definition of M_do_remove.

Any idea?

Thanks in advance

-- 
ciao
Luca

www.lucadelu.org
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev