[QGIS-Developer] Compiling QGIS with Debug: error with pdal_wrench and gdal_fwd.h

Even Rouault even.rouault at spatialys.com
Wed Apr 2 08:56:04 PDT 2025


Jorge,

can you give a try at https://github.com/qgis/QGIS/pull/61316 ?

Even

Le 02/04/2025 à 17:36, Jorge Gustavo Rocha via QGIS-Developer a écrit :
> Hi devs,
>
> I'm not able to compile QGIS with -DCMAKE_BUILD_TYPE=Debug. No problem 
> to build QGIS with -DCMAKE_BUILD_TYPE=Release.
>
> I think this happens since the change in GDAL's gdal_fwd.h to support:
>
> #if defined(GDAL_DEBUG)
> /** Opaque type for a spatial reference system */
> typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
> /** Opaque type for a coordinate transformation object */
> typedef struct OGRCoordinateTransformationHS 
> *OGRCoordinateTransformationH;
> #else
> /** Opaque type for a spatial reference system */
> typedef void *OGRSpatialReferenceH;
> /** Opaque type for a coordinate transformation object */
> typedef void *OGRCoordinateTransformationH;
> #endif
>
> The error I'm getting is:
>
> FAILED: 
> src/providers/pdal/CMakeFiles/pdal_wrench.dir/__/__/__/external/pdal_wrench/main.cpp.o 
>
> ccache 
> sloppiness=pch_defines,time_macros,include_file_mtime,include_file_ctime 
> /usr/bin/c++ -DGDAL_DEBUG -DQT_NO_CAST_TO_ASCII 
> -DQT_NO_DEPRECATED_WARNINGS -DQT_USE_QSTRINGBUILDER 
> -DSIP_VERSION=0x060806 
> -I/home/jgr/dev/cpp/build-qgis-qt6/src/providers/pdal/pdal_wrench_autogen/include 
> -I/home/jgr/dev/cpp/build-qgis-qt6 
> -I/home/jgr/dev/cpp/QGIS/external/untwine/api 
> -I/home/jgr/dev/cpp/QGIS/external -Wall -Wextra -Wno-long-long 
> -Wformat-security -Wno-strict-aliasing -Wnon-virtual-dtor 
> -Wno-redundant-move -Wno-misleading-indentation 
> -Wreturn-type-c-linkage -Woverloaded-virtual -Wimplicit-fallthrough 
> -Qunused-arguments -g -std=gnu++17 -fvisibility=hidden -MD -MT 
> src/providers/pdal/CMakeFiles/pdal_wrench.dir/__/__/__/external/pdal_wrench/main.cpp.o 
> -MF 
> src/providers/pdal/CMakeFiles/pdal_wrench.dir/__/__/__/external/pdal_wrench/main.cpp.o.d 
> -o 
> src/providers/pdal/CMakeFiles/pdal_wrench.dir/__/__/__/external/pdal_wrench/main.cpp.o 
> -c /home/jgr/dev/cpp/QGIS/external/pdal_wrench/main.cpp
> In file included from 
> /home/jgr/dev/cpp/QGIS/external/pdal_wrench/main.cpp:24:
> In file included from 
> /home/jgr/dev/cpp/QGIS/external/pdal_wrench/alg.hpp:18:
> /home/jgr/dev/cpp/QGIS/external/pdal_wrench/utils.hpp:125:16: error: 
> static_cast from 'OGRSpatialReferenceH' (aka 'OGRSpatialReferenceHS 
> *') to 'OGRSpatialReference *', which are not related by inheritance, 
> is not allowed
>   125 |     ptr.reset( 
> static_cast<OGRSpatialReference*>(OSRNewSpatialReference(s.size() ? 
> s.c_str() : nullptr)) );
>       | 
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/local/include/gdal_fwd.h:187:16: note: 'OGRSpatialReferenceHS' is 
> incomplete
>   187 | typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
>       |                ^
> In file included from 
> /home/jgr/dev/cpp/QGIS/external/pdal_wrench/main.cpp:24:
> In file included from 
> /home/jgr/dev/cpp/QGIS/external/pdal_wrench/alg.hpp:18:
> /home/jgr/dev/cpp/QGIS/external/pdal_wrench/utils.hpp:170:11: error: 
> no matching function for call to 'OSRDestroySpatialReference'
>   170 |           OSRDestroySpatialReference(o);
>       |           ^~~~~~~~~~~~~~~~~~~~~~~~~~
>
> The options I'm using to build QGIS are:
>
> cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=On 
> -DENABLE_PGTEST=OFF -DWITH_SERVER=TRUE -DWITH_QSPATIALITE=TRUE 
> -DWITH_3D=TRUE -DGDAL_CONFIG=/usr/local/bin/gdal-config 
> -DPROJ_INCLUDE_DIR=/usr/local/include 
> -DPROJ_LIBRARY=/usr/local/lib/libproj.so -DWITH_PDAL=TRUE 
> -DWITH_EPT=TRUE -DBUILD_WITH_QT6=TRUE -DWITH_QTWEBKIT=FALSE 
> -DQWT_LIBRARY=/usr/local/qwt-6.2.0/lib/libqwt.so 
> -DQWT_INCLUDE_DIR=/usr/local/qwt-6.2.0/include/ 
> -DWITH_CUSTOM_WIDGETS=TRUE ../QGIS
>
> I'm using GDAL and PDAL built from master.
>
> Any clues about the best way to avoid this error?
>
> Thanks,
>
> Jorge
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the QGIS-Developer mailing list