Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error in geospatial/src/Dem.cc #330

Closed
darksylinc opened this issue Mar 22, 2022 · 4 comments
Closed

Compile error in geospatial/src/Dem.cc #330

darksylinc opened this issue Mar 22, 2022 · 4 comments
Labels
bug Something isn't working geospatial Geospatial component

Comments

@darksylinc
Copy link
Contributor

darksylinc commented Mar 22, 2022

Environment

  • OS Version: Ubuntu 18.04
  • Source or binary build?
    Source, main. Commit ff5970e

g++ --version

g++ (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Trying to run latest ign-rendering7 fails because ign-common5's CMake tries to pull something-geospatial.cmake

But that won't exist unless GDAL dependency is installed.

So I installed GDAL, rebuilt from scratch and met with this gem:

--- stderr: ignition-common5                                                                                   
/home/matias/Projects/ign/src/ign-common/geospatial/src/Dem.cc: In member function ‘bool ignition::common::Dem::GeoReference(double, double, ignition::math::v7::Angle&, ignition::math::v7::Angle&) const’:
/home/matias/Projects/ign/src/ign-common/geospatial/src/Dem.cc:264:28: error: invalid conversion from ‘const char**’ to ‘char**’ [-fpermissive]
     sourceCs.importFromWkt(&importString);
                            ^~~~~~~~~~~~~
In file included from /home/matias/Projects/ign/src/ign-common/geospatial/src/Dem.cc:21:
/usr/include/gdal/ogr_spatialref.h:185:32: note:   initializing argument 1 of ‘OGRErr OGRSpatialReference::importFromWkt(char**)’
     OGRErr      importFromWkt( char ** );
                                ^~~~~~~
make[2]: *** [geospatial/src/CMakeFiles/ignition-common5-geospatial.dir/Dem.cc.o] Error 1
make[1]: *** [geospatial/src/CMakeFiles/ignition-common5-geospatial.dir/all] Error 2

Description

  • Expected behavior: To compile correctly (or alternatively why is ign-common5 marked as NOTFOUND if geospatial is skipped?)
  • Actual behavior: Compiler error (or alternatively, ign-common5 is being marked as NOTFOUND if GDAL is missing, despite successfully compiling)

Steps to reproduce

  1. Pull latest main.
  2. colcon build --cmake-args -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug -DBUILD_DOCS=OFF --merge-install NOTE: Debug is the build type.

Using libgdal-dev 2.2.3+dfsg-2

@darksylinc darksylinc added the bug Something isn't working label Mar 22, 2022
@darksylinc
Copy link
Contributor Author

Obvious solution:

diff --git a/geospatial/src/Dem.cc b/geospatial/src/Dem.cc
index f3e3d1e..7d75b12 100644
--- a/geospatial/src/Dem.cc
+++ b/geospatial/src/Dem.cc
@@ -261,7 +261,7 @@ bool Dem::GeoReference(double _x, double _y,
     // Transform the terrain's coordinate system to WGS84
     const char *importString
         = strdup(this->dataPtr->dataSet->GetProjectionRef());
-    sourceCs.importFromWkt(&importString);
+    sourceCs.importFromWkt((char**)&importString);
     targetCs.SetWellKnownGeogCS("WGS84");
     cT = OGRCreateCoordinateTransformation(&sourceCs, &targetCs);
     if (nullptr == cT)

@darksylinc
Copy link
Contributor Author

Regarding the lack of GDAL causing ign-rendering7 not to build, this is the error:

CMake Warning at /usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package):
  By not providing "Findignition-common5-geospatial.cmake" in
  CMAKE_MODULE_PATH this project has asked CMake to find a package
  configuration file provided by "ignition-common5-geospatial", but CMake did
  not find one.

  Could not find a package configuration file provided by
  "ignition-common5-geospatial" (requested version 5.0.0) with any of the
  following names:

    ignition-common5-geospatialConfig.cmake
    ignition-common5-geospatial-config.cmake

  Add the installation prefix of "ignition-common5-geospatial" to
  CMAKE_PREFIX_PATH or set "ignition-common5-geospatial_DIR" to a directory
  containing one of the above files.  If "ignition-common5-geospatial"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  /home/matias/Projects/ign/install/lib/cmake/ignition-common5/ignition-common5-config.cmake:188 (find_dependency)
  /home/matias/Projects/ign/install/share/cmake/ignition-cmake2/cmake2/IgnUtils.cmake:189 (find_package)
  CMakeLists.txt:38 (ign_find_package)


CMake Warning at /home/matias/Projects/ign/install/share/cmake/ignition-cmake2/cmake2/IgnUtils.cmake:189 (find_package):
  Found package configuration file:

    /home/matias/Projects/ign/install/lib/cmake/ignition-common5/ignition-common5-config.cmake

  but it set ignition-common5_FOUND to FALSE so package "ignition-common5" is
  considered to be NOT FOUND.  Reason given by package:

  ignition-common5 could not be found because dependency
  ignition-common5-geospatial could not be found.

Call Stack (most recent call first):
  CMakeLists.txt:38 (ign_find_package)

@scpeters
Copy link
Member

the main branch of ign-common (major version 5) will be part of the Garden collection, which will be supported on Ubuntu 20.04 and 22.04:

so the failures on 18.04 are expected. Perhaps we should improve the messaging about which Ubuntu versions are supported?

@chapulina
Copy link
Contributor

What @scpeters said is right. Let me know how we can make this clearer.

We've announced the supported platforms on this post, which links to this issue:

We've also explicitly disabled Bionic CI on the main branches, i.e.

I'll close this issue, but please reopen if the problem comes up in a supported platform.

@chapulina chapulina added the geospatial Geospatial component label Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working geospatial Geospatial component
Projects
None yet
Development

No branches or pull requests

3 participants