[GRASS-dev] [GRASS GIS] #3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module expects them

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
----------------------+-------------------------
Reporter: msieczka | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.2.1
Component: Vector | Version: 7.2.0
Keywords: | CPU: All
Platform: All |
----------------------+-------------------------
PDAL 1.4.0, Arch Linux, x86_64.

Some PDAL includes are not in /usr/include/pdal, where v.in.pdal expects
them, but in the /usr/include/pdal/io subdirectory. This leads a following
build error:

{{{
$ cd ~/src/grass-7.2.0/vector/v.in.pdal
$ make
c++ -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-
protector-strong
-I/home/dane/devel/aur/grass7/src/grass-7.2.0/dist.x86_64-pc-linux-
gnu/include -I/home/dane/devel/aur/grass7/src/grass-7.2.0/dist.x86_64-pc-
linux-gnu/include -I/usr/include -I/usr/include -march=x86-64
-mtune=generic -O2 -pipe -fstack-protector-strong -Wextra -Wall -Wno-
unused-parameter -Wno-unused-variable -Wpointer-arith -Wcast-align -Wcast-
qual -Wredundant-decls -Wno-long-long -Wno-unknown-pragmas -Wno-
deprecated-declarations -isystem /usr/local/include -std=c++11 -std=c++11
-DPACKAGE=\""grassmods"\" -I/usr/include -I/usr/include -I/usr/include
-I/usr/include/libxml2 -I/usr/include -I/usr/include
-I/home/dane/devel/aur/grass7/src/grass-7.2.0/dist.x86_64-pc-linux-
gnu/include -I/home/dane/devel/aur/grass7/src/grass-7.2.0/dist.x86_64-pc-
linux-gnu/include -DRELDIR=\"vector/v.in.pdal\" -o OBJ.x86_64-pc-linux-
gnu/main.o -c main.cpp
main.cpp:4:30: fatal error: pdal/LasReader.hpp: No such file or directory
  #include <pdal/LasReader.hpp>
                               ^
compilation terminated.
make: *** [../../include/Make/Compile.make:35: OBJ.x86_64-pc-linux-
gnu/main.o] Error 1
}}}

The reason why:

{{{
$ locate LasReader.hpp
/usr/include/pdal/io/LasReader.hpp

$ ls /usr/include/pdal/io/*.hpp | wc -l
37

$ ls /usr/include/pdal/*.hpp | wc -l
50
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3243&gt;
GRASS GIS <https://grass.osgeo.org>

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+-------------------------
  Reporter: msieczka | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.1
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+-------------------------
Changes (by neteler):

* Attachment "v_in_pdal.diff" added.

Patch to update include statements for PDAL 1.4.0

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3243&gt;
GRASS GIS <https://grass.osgeo.org>

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+-------------------------
  Reporter: msieczka | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.1
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+-------------------------

Comment (by neteler):

I have attached a patch which solves the changes include paths.

However, I get several compilation errors with PDAL 1.4.0. Due to API
changes?

{{{
[neteler@oboe v.in.pdal]$ make
...
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but
not for C
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but
not for C
c++ -g -Wall -I/home/neteler/software/grass72/dist.x86_64-pc-linux-
gnu/include -I/home/neteler/software/grass72/dist.x86_64-pc-linux-
gnu/include -I/usr/include/gdal -I/usr/include -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-
protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wextra
-Wall -Wno-unused-parameter -Wno-unused-variable -Wpointer-arith -Wcast-
align -Wcast-qual -Wredundant-decls -Wno-long-long -Wno-unknown-pragmas
-Wno-deprecated-declarations -isystem /usr/local/include -std=c++11
-std=c++11 -DPACKAGE=\""grassmods"\" -I/usr/include/gdal -I/usr/include
-I/usr/include/gdal -I/usr/include/libxml2 -I/usr/include -I/usr/include
-I/home/neteler/software/grass72/dist.x86_64-pc-linux-gnu/include
-I/home/neteler/software/grass72/dist.x86_64-pc-linux-gnu/include
-DRELDIR=\"vector/v.in.pdal\" -o OBJ.x86_64-pc-linux-gnu/main.o -c
main.cpp
main.cpp:62:47: error: ‘pdal::Dimension::id::Enum’ has not been declared
                           pdal::Dimension::id::Enum dim_to_use_as_z)
                                                ^~~~
main.cpp: In function ‘void pdal_point_to_grass(Map_info*, line_pnts*,
line_cats*, pdal::PointViewPtr, pdal::PointId, GLidarLayers*, int, int)’:
main.cpp:67:38: error: ‘Id’ is not a namespace-name
      using namespace pdal::Dimension::Id;
                                       ^~
main.cpp:67:40: error: expected namespace-name before ‘;’ token
      using namespace pdal::Dimension::Id;
                                         ^
main.cpp:68:47: error: ‘X’ was not declared in this scope
      double x = point_view->getFieldAs<double>(X, idx);
                                                ^
main.cpp:69:47: error: ‘Y’ was not declared in this scope
      double y = point_view->getFieldAs<double>(Y, idx);
                                                ^
main.cpp:70:67: error: no matching function for call to
‘pdal::PointView::getFieldAs(int&, pdal::PointId&)’
      double z = point_view->getFieldAs<double>(dim_to_use_as_z, idx);
                                                                    ^
In file included from main.cpp:2:0:
/usr/include/pdal/PointView.hpp:116:7: note: candidate: template<class T>
T pdal::PointView::getFieldAs(pdal::Dimension::Id, pdal::PointId) const
      T getFieldAs(Dimension::Id dim, PointId pointIndex) const;
        ^~~~~~~~~~
/usr/include/pdal/PointView.hpp:116:7: note: template argument
deduction/substitution failed:
main.cpp:70:67: note: cannot convert ‘dim_to_use_as_z’ (type ‘int’) to
type ‘pdal::Dimension::Id’
      double z = point_view->getFieldAs<double>(dim_to_use_as_z, idx);
                                                                    ^
main.cpp:78:52: error: ‘ReturnNumber’ was not declared in this scope
          int return_n = point_view->getFieldAs<int>(ReturnNumber, idx);
                                                     ^~~~~~~~~~~~
main.cpp:79:53: error: ‘NumberOfReturns’ was not declared in this scope
          int n_returns = point_view->getFieldAs<int>(NumberOfReturns,
idx);
                                                      ^~~~~~~~~~~~~~~
main.cpp:85:50: error: ‘Classification’ was not declared in this scope
                       point_view->getFieldAs<int>(Classification, idx));
                                                   ^~~~~~~~~~~~~~
main.cpp:88:47: error: ‘Red’ was not declared in this scope
          int red = point_view->getFieldAs<int>(Red, idx);
                                                ^~~
main.cpp:89:49: error: ‘Green’ was not declared in this scope
          int green = point_view->getFieldAs<int>(Green, idx);
                                                  ^~~~~
main.cpp:90:48: error: ‘Blue’ was not declared in this scope
          int blue = point_view->getFieldAs<int>(Blue, idx);
                                                 ^~~~
main.cpp: In function ‘int main(int, char**)’:
main.cpp:224:37: warning: ISO C++ forbids converting a string constant to
‘char*’ [-Wwrite-strings]
      max_ground_window_opt->answer = "33";
                                      ^~~~
main.cpp:233:32: warning: ISO C++ forbids converting a string constant to
‘char*’ [-Wwrite-strings]
      ground_slope_opt->answer = "1.0";
                                 ^~~~~
main.cpp:241:39: warning: ISO C++ forbids converting a string constant to
‘char*’ [-Wwrite-strings]
      max_ground_distance_opt->answer = "2.5";
                                        ^~~~~
main.cpp:250:40: warning: ISO C++ forbids converting a string constant to
‘char*’ [-Wwrite-strings]
      init_ground_distance_opt->answer = "0.15";
                                         ^~~~~~
main.cpp:259:36: warning: ISO C++ forbids converting a string constant to
‘char*’ [-Wwrite-strings]
      ground_cell_size_opt->answer = "1";
                                     ^~~
main.cpp:326:5: error: ‘Enum’ is not a member of ‘pdal::Dimension::Id’
      pdal::Dimension::id::Enum dim_to_use_as_z = pdal::Dimension::id::Z;
      ^~~~
main.cpp:479:20: error: ‘eHorizontalOnly’ is not a member of
‘pdal::SpatialReference’
              getWKT(pdal::SpatialReference::eHorizontalOnly);
                     ^~~~
main.cpp:541:9: error: ‘dim_to_use_as_z’ was not declared in this scope
          dim_to_use_as_z = point_view->layout()->findDim("Height");
          ^~~~~~~~~~~~~~~
main.cpp:549:29: error: ‘dim_to_use_as_z’ was not declared in this scope
      if (!point_view->hasDim(dim_to_use_as_z))
                              ^~~~~~~~~~~~~~~
main.cpp:570:51: error: ‘dim_to_use_as_z’ was not declared in this scope
          double z = point_view->getFieldAs<double>(dim_to_use_as_z, idx);
                                                    ^~~~~~~~~~~~~~~
../../include/Make/Compile.make:35: recipe for target 'OBJ.x86_64-pc-
linux-gnu/main.o' failed
make: *** [OBJ.x86_64-pc-linux-gnu/main.o] Error 1
}}}

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+-------------------------
  Reporter: msieczka | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.1
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+-------------------------

Comment (by wenzeslaus):

Replying to [comment:1 neteler]:
> However, I get several compilation errors with PDAL 1.4.0. Due to API
changes?

Yes.

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+----------------------
  Reporter: msieczka | Owner: ptschrum
      Type: defect | Status: assigned
  Priority: normal | Milestone: 7.2.2
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+----------------------
Changes (by ptschrum):

* status: new => assigned
* owner: grass-dev@… => ptschrum

Comment:

I (ptschrum) assigned this ticket to myself.

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+----------------------
  Reporter: msieczka | Owner: ptschrum
      Type: defect | Status: assigned
  Priority: normal | Milestone: 7.2.3
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+----------------------

Comment (by neteler):

See r72253: v.in.pdal: change API calls to PDAL 1.6.0 (available in G7.4)

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+------------------------
  Reporter: msieczka | Owner: wenzeslaus
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.3
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+------------------------
Changes (by wenzeslaus):

* owner: ptschrum => wenzeslaus
* status: assigned => new

Comment:

Assigning to myself for clarity, but should be fixed in r72253 from #3496
by felixg for 7.4. Do we need/want to backport?

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+------------------------
  Reporter: msieczka | Owner: wenzeslaus
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.3
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+------------------------

Comment (by mlennert):

Replying to [comment:7 wenzeslaus]:
> Assigning to myself for clarity, but should be fixed in r72253 from
#3496 by felixg for 7.4. Do we need/want to backport?

Yes, please. For me v.in.pdal compilation fails in 7.2.3RC1 because of
this.

Moritz

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+------------------------
  Reporter: msieczka | Owner: wenzeslaus
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.3
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+------------------------

Comment (by wenzeslaus):

In [changeset:"72363" 72363]:
{{{
#!CommitTicketReference repository="" revision="72363"
v.in.pdal: change API calls to PDAL 1.6.0, see #3496, #3243, #3101, #2732
(author: felixg, backport of trunk r72246) + GPL header added in r72245
}}}

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+------------------------
  Reporter: msieczka | Owner: wenzeslaus
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.4
Component: Vector | Version: 7.2.0
Resolution: | Keywords:
       CPU: All | Platform: All
-----------------------+------------------------

Comment (by wenzeslaus):

r72363 backported this to 7.2 branch, closing.

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+------------------------
  Reporter: msieczka | Owner: wenzeslaus
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: Vector | Version: 7.2.0
Resolution: fixed | Keywords:
       CPU: All | Platform: All
-----------------------+------------------------
Changes (by wenzeslaus):

* status: new => closed
* resolution: => fixed

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

#3243: v.in.pdal build error: some PDAL 1.4.0 includes are not where the module
expects them
-----------------------+----------------------------
  Reporter: msieczka | Owner: wenzeslaus
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: Vector | Version: 7.2.0
Resolution: fixed | Keywords: v.in.pdal PDAL
       CPU: All | Platform: All
-----------------------+----------------------------
Changes (by wenzeslaus):

* keywords: => v.in.pdal PDAL

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