Fengting,

would https://github.com/OSGeo/gdal/pull/12830 help ?

Even

Le 30/07/2025 à 21:35, Fengting Chen a écrit :

Hi Even,

I have been trying to upgrade my compiler to resolve the GDAL compilation issue but without success.

According to the documentation of unique_ptr,

|unique_ptr| may be constructed for an incomplete type <https://en.cppreference.com/w/cpp/language/type-id.html#Incomplete_type> |T|, such as to facilitate the use as a handle in the pImpl idiom <https://en.cppreference.com/w/cpp/language/pimpl.html>. If the default deleter is used, |T| must be complete at the point in code where the deleter is invoked, which happens in the destructor, move assignment operator, and |reset| member function of |unique_ptr|.

The error I encountered during the compilation shows that the deleter of GDALRasterAttributeTable was invoked when the type was not complete:

In file included from /usr/include/c++/8/memory:80,

from /scratch/gdal/gdal/port/cpl_error.h:372,

from /scratch/gdal/gdal/gcore/gdal.h:30,

from /scratch/gdal/gdal/gcore/gdal_priv.h:45,

from /scratch/gdal/gdal/frmts/pdf/pdfdrivercore.h:16,

from /scratch/gdal/gdal/frmts/pdf/pdfdrivercore.cpp:13:

/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ?~@~Xvoid std:: default_delete<_Tp>::operator()(_Tp*) const [with _Tp =                         GDALRasterAttributeTable]?~@~Y:

/usr/include/c++/8/bits/unique_ptr.h:277:17: required from ?~@~Xstd::         unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = GDALRasterAttributeTable; _Dp   = std::default_delete<GDALRasterAttributeTable>]?~@~Y

/scratch/gdal/gdal/gcore/gdal_priv.h:3664:55: required from here

/usr/include/c++/8/bits/unique_ptr.h:79:16: error: invalid application of       ?~@~Xsizeof?~@~Y to incomplete type ?~@~XGDALRasterAttributeTable?~@~Y

static_assert(sizeof(_Tp)>0,

^~~~~~~~~~~

gmake[2]: *** [frmts/pdf/CMakeFiles/gdal_PDF_core.dir/build.make:76: frmts/pdf/ CMakeFiles/gdal_PDF_core.dir/pdfdrivercore.cpp.o] Error 1

Is there any other way to work around it?

Thanks,

-Fengting

*From: *Even Rouault <even.roua...@spatialys.com>
*Date: *Wednesday, July 23, 2025 at 4:59 PM
*To: *Fengting Chen <fengting.c...@oracle.com>, gdal dev <gdal-dev@lists.osgeo.org> *Subject: *Re: [External] : Re: [gdal-dev] Error on building from master branch on linux

Le 23/07/2025 à 22:51, Fengting Chen a écrit :

    Hi Even,

    After resolving error on “GDALRasterAttributeTable” by adding
    “gdal_rat.h” to gdal_priv.h, the compilation failed again.

    The compiler on my machine was working fine with GDAL on the
    master branch this early May.  Could there be anything changed in
    the GDAL master that caused the compilation failure?

yes, the addition of std::unique_ptr<GDALRasterAttributeTable> m_poRAT{}; at line 3664 of gdal_priv.h

You should try to update to a more recent compiler.

Even



--
http://www.spatialys.com  
<https://urldefense.com/v3/__http:/www.spatialys.com__;!!ACWV5N9M2RV99hQ!IV0UbTzTiheCT_RtAke5Lf5jehgWvysNhzGSf-s6QzosmATNDjTe2xTp17hAk7QEaHW-P68knUEP-DxLDC1FZG4RX5oU$>
My software is free, but my time generally not.

--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to