Menu

#2608 Compilation issues with CycloneDDS and GDAL (fix provided)

None
NeedInfo
nobody
Low
2024-11-08
2021-07-05
No

Hi All,

I'm using Debian 10.
I try to compile SimGear (HEAD of next) with CycloneDDS and GDAL but it fails: issues with include files. I've attached a fix.

The fix should be portable but I didn't test.

1 Attachments

Related

Tickets: #2608

Discussion

  • James Turner

    James Turner - 2021-07-06

    DDS fix is fine.

    For GDAL, I am clueless: what is official correct: with the <gdal/ or without? Becuase inside SGDemTile_gdal.cxx, we have:

    include <gdal.h>
    include <gdalwarper.h>
    include <gdal_priv.h></gdal_priv.h></gdalwarper.h></gdal.h>

    So I would soner we use same path for all GDAL includes, otherwise life is tricky...

     
  • Gaétan Allaert

    Gaétan Allaert - 2021-07-11

    Hi James,

    Actually it is better not to add 'gdal/' in the source code as FindGDAL.cmake module provides the full include path with gdal/ included.

    |I've attached another patch that also fix the same issue in FlightGear but part of SimGear.

     
  • James Turner

    James Turner - 2021-07-12

    I've done some checking: FindGDal indeed sets the directory with the full path as you wrote, so the #includes in SGDemTile.hxx are correct.

    Using include_directories() is no longer good CMake practice. The GDAL dependenyc is supposed to be handled by this logic in SimGear.cmake.in:

    set(ENABLE_GDAL @ENABLE_GDAL@)
    if (ENABLE_GDAL)
    find_dependency(GDAL)
    endif()

    ... which should find GDAL when Simgear is imported into FlightGear, if GDAL is enabeld of course.

    Can you post the build errors you are seeing in FlightGear? You can also edit the installed SimGear.cmake (probabyl lives at /use/local/lib/cmake/SimGear/SimgearConfig.cmake) to check it looks correct, eg the @ substituion worked.

     
  • Gaétan Allaert

    Gaétan Allaert - 2021-07-29

    When I remove the include_directories of GDAL_INCLUDE_DIRS from the generated lib/cmake/SimGear/SimGearConfig.cmake, <gdal.h> can't be found when compiling flightgear/src/Airports/AirportBuilder.cxx:41.</gdal.h>

    My manually modified lib/cmake/SimGear/SimGearConfig.cmake:

    set(ENABLE_GDAL ON)
    if (ENABLE_GDAL)
      find_dependency(GDAL)
      #include_directories(SYSTEM ${GDAL_INCLUDE_DIRS})
    endif()
    

    The error from the compiler is:

    /usr/bin/c++  -DHAVE_CONFIG_H -DWITH_EVENTINPUT -I/FlightGear.next/src/fg_build/src/Include -I/FlightGear.next/src/fg_build/src -I/FlightGear.next/src/flightgear/src -I/FlightGear.next/include -I/FlightGear.next/src/flightgear/3rdparty/hidapi -I/FlightGear.next/src/flightgear/3rdparty/sqlite3 -I/FlightGear.next/src/flightgear/3rdparty/iaxclient/lib -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/FlightGear.next/src/flightgear/3rdparty/joystick -I/FlightGear.next/src/flightgear/3rdparty/fonts -I/FlightGear.next/src/flightgear/src/FDM/JSBSim -I/FlightGear.next/src/flightgear/3rdparty/cjson -I/FlightGear.next/src/flightgear/3rdparty/mongoose  -msse2 -mfpmath=sse -ftree-vectorize -ftree-slp-vectorize -Wall  -D_REENTRANT -DBOOST_BIMAP_DISABLE_SERIALIZATION -DBOOST_NO_STDLIB_CONFIG -DBOOST_NO_AUTO_PTR -DBOOST_NO_CXX98_BINDERS -O3 -DNDEBUG -msse2 -mfpmath=sse -ftree-vectorize -ftree-slp-vectorize -fPIC   -std=gnu++17 -o CMakeFiles/fgfsObjects.dir/src/Airports/AirportBuilder.cxx.o -c /FlightGear.next/src/flightgear/src/Airports/AirportBuilder.cxx
    In file included from /FlightGear.next/include/simgear/scene/dem/SGDemRoot.hxx:5,
                     from /FlightGear.next/include/simgear/scene/dem/SGDem.hxx:31,
                     from /FlightGear.next/include/simgear/scene/util/SGReaderWriterOptions.hxx:30,
                     from /FlightGear.next/src/flightgeary/src/Airports/AirportBuilder.cxx:41:
    /FlightGear.next/include/simgear/scene/dem/SGDemTile.hxx:4:10: fatal error: gdal.h: No such file or directory
     #include <gdal.h>
              ^~~~~~~~
    

    I don't think adding include_directories is a mistake because the 'gdal' include subdirectory needs to be added when FlightGear is compiling with GDAL.

     
  • James Turner

    James Turner - 2021-07-29

    This is supposed to happen automatically: becuase we declare GALD as a PUBLIC dependency of Simgear:

        target_link_libraries(SimGearScene PUBLIC GDAL::GDAL)
    

    ... then anything that links against SimGear will get the INCLUDE properties declared by the GDAL imported target automatically. So the current code is already correct in theorey: we just need to work out why it's not worked as designed.

    Adding 'include_directory' manual is a work-around, but not the correct fix.

     
    • Gaétan Allaert

      Gaétan Allaert - 2021-07-30

      Hi James,

      I think I found the issue. FlightGear was not able to get the
      include directory using the module GDAL::GDAL (see
      flightgear/CMakeModules/SetupFGFSLibraries.cmake line 80): may be this
      could be fixed (not sure it's even possible). For this reason, I've to
      add the include path and the lib with the path to
      simgear/CMakeLists.txt. This is already done like that for other
      libraries.

      I've attached the patch.

      On Thu, 29 Jul 2021 09:35:19 -0000
      "James Turner" jmturner@users.sourceforge.net wrote:

      This is supposed to happen automatically: becuase we declare GALD as
      a PUBLIC dependency of Simgear:

          target_link_libraries(SimGearScene PUBLIC GDAL::GDAL)
      

      ... then anything that links against SimGear will get the INCLUDE
      properties declared by the GDAL imported target automatically. So the
      current code is already correct in theorey: we just need to work out
      why it's not worked as designed.

      Adding 'include_directory' manual is a work-around, but not the
      correct fix.


      ** [codetickets:#2608] Compilation issues with CycloneDDS and GDAL
      (fix provided)**

      Status: New
      Milestone: None
      Labels: GDAL CycloneDDS
      Created: Mon Jul 05, 2021 06:53 AM UTC by Gaétan Allaert
      Last Updated: Thu Jul 29, 2021 09:19 AM UTC
      Owner: nobody
      Attachments:

      -
      dds_gdal.patch (sourceforge.net)
      (811 Bytes; text/x-patch)

      Hi All,

      I'm using Debian 10.
      I try to compile SimGear (HEAD of next) with CycloneDDS and GDAL but
      it fails: issues with include files. I've attached a fix.

      The fix should be portable but I didn't test.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/flightgear/codetickets/2608/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      ||/ There are only 10 kinds of people:
      /~ ~\ -Those who understand binary
      |@ @| -Those who don't
      |-oooO----(_)---Oooo---------------------------------------|
      Gaétan Allaert

      Key server : https://keyserver2.pgp.com/vkd/GetWelcomeScreen.event
      Key ID : 55472127

       

      Related

      Tickets: #2608

  • Gijs

    Gijs - 2024-11-08
    • status: New --> NeedInfo
     
  • Gijs

    Gijs - 2024-11-08

    Hi Gaétan, is this still an issue with the current code state? If not, we can close it.

     
  • James Turner

    James Turner - 2024-11-08

    Note that we plan to remove GDAL support on next, unless someone wants to maintain it. It will remain on 2024.1 branch, however.

     

Log in to post a comment.

MongoDB Logo MongoDB