PDAL / PDAL

PDAL is Point Data Abstraction Library. GDAL for point cloud data.
https://pdal.io
Other
1.14k stars 446 forks source link

Compilation fails on Ubuntu 18.04 with (GDAL installed, found by CMake, but not included) #3053

Closed themightyoarfish closed 4 years ago

themightyoarfish commented 4 years ago

Describe the bug

I have installed the libgdal-dev package. CMake reports

CMake Warning at cmake/gtest.cmake:10 (find_package):
  By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "absl", but
  CMake did not find one.

  Could not find a package configuration file provided by "absl" with any of
  the following names:

    abslConfig.cmake
    absl-config.cmake

  Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
  "absl_DIR" to a directory containing one of the above files.  If "absl"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:168 (include)

-- Could NOT find LIBEXECINFO (missing: LIBEXECINFO_LIBRARY)
-- Could NOT find LIBUNWIND (missing: LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
-- The following features have been enabled:

 * PostgreSQL PointCloud plugin, read/write PostgreSQL PointCloud objects
 * Unit tests, PDAL unit tests
-- The following OPTIONAL packages have been found:

 * LibXml2
 * PkgConfig
 * OpenSSL (required version >= 1.1)
 * PythonInterp

-- The following REQUIRED packages have been found:

 * GDAL (required version >= 2.2.0)
   Provides general purpose raster, vector, and reference system support
 * GeoTIFF
 * ZLIB
   Compression support in BPF
 * CURL
 * PostgreSQL
 * Threads, The thread library of the system

-- The following features have been disabled:

 * Bash completion, completion for PDAL command line
 * CPD plugin, Coherent Point Drift (CPD) computes rigid or nonrigid transformations between point sets
 * GeoWave plugin, Read and Write data using GeoWave
 * I3S plugin, Read from a I3S server or from a SLPK file
 * Icebridge plugin, read data in the Icebridge format
 * HDF plugin, read data in the HDF format
 * Matlab plugin, write data to a .mat file
 * MrSID plugin, read data in the MrSID format
 * NITF plugin, read/write LAS data wrapped in NITF
 * OpenSceneGraph plugin, read/write OpenSceneGraph objects
 * Oracle OCI plugin, Read/write point clould patches to Oracle
 * RiVLib plugin, read data in the RXP format
 * rdblib plugin, read data in the RDB format
 * MBIO plugin, add features that depend on MBIO
 * FBX plugin, add features that depend on FBX
 * TileDB plugin, read/write data from TileDB
 * E57 plugin, read/write data to and from e57 format

-- The following OPTIONAL packages have not been found:

 * ZSTD
   General compression support
 * absl
 * Libexecinfo
 * Libunwind

-- The following RECOMMENDED packages have not been found:

 * LASzip (required version >= 3.1)
   Provides LASzip compression

-- Configuring done
-- Generating done
-- Build files have been written to: /home/rasmus/Downloads/Sources/PDAL/build

However, make fails with

/home/rasmus/Downloads/Sources/PDAL/test/unit/SpatialReferenceTest.cpp:45:10: fatal error: gdal_version.h: No such file or directory
 #include <gdal_version.h>
          ^~~~~~~~~~~~~~~~

Expected behavior Compilation succeeds

System/installation information: 5.3.0-46-generic #38~18.04.1-Ubuntu

Is there a bug in the cmake files leading to a missing include? The file is present

$ dpkg-query -L libgdal-dev|grep gdal_version
/usr/include/gdal/gdal_version.h

it is just not included properly. When running cmake with verbose makefile, I can see that the required include dir is not present for this target:

[ 60%] Building CXX object test/unit/CMakeFiles/pdal_spatial_reference_test.dir/SpatialReferenceTest.cpp.o
cd /home/rasmus/Downloads/Sources/PDAL/build/test/unit && /usr/bin/c++  -DUNIX -I/home/rasmus/Downloads/Sources/PDAL -I/home/rasmus/Downloads/Sources/PDAL/vendor/nlohmann -I/home/rasmus/Downloads/Sources/PDAL/test/unit -I/home/rasmus/Downloads/Sources/PDAL/build/test/unit -I/home/rasmus/Downloads/Sources/PDAL/build/include -I/usr/include/geotiff -isystem /home/rasmus/Downloads/Sources/PDAL/vendor/gtest/include -isystem /home/rasmus/Downloads/Sources/PDAL/vendor/gtest  -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -std=c++11 -o CMakeFiles/pdal_spatial_reference_test.dir/SpatialReferenceTest.cpp.o -c /home/rasmus/Downloads/Sources/PDAL/test/unit/SpatialReferenceTest.cpp
themightyoarfish commented 4 years ago

I can build successfully after applying this diff:

--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -95,6 +95,7 @@ PDAL_ADD_TEST(pdal_spatial_reference_test
         SpatialReferenceTest.cpp
     INCLUDES
         ${NLOHMANN_INCLUDE_DIR}
+        ${GDAL_INCLUDE_DIR}
     LINK_WITH
         ${GDAL_LIBRARY}
 )

Not sure if thats the right way here, should I open a PR?

abellgithub commented 4 years ago

Sure.