Hi Even,

It didn’t help. I got the similar error:

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/gdalalgorithm.h:19,
                  from /scratch/gdal/gdal/apps/gdalalg_clip_common.h:16,
                  from /scratch/gdal/gdal/apps/gdalalg_clip_common.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:3668: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]: *** [apps/CMakeFiles/appslib.dir/build.make:90: apps/CMakeFiles/      
appslib.dir/gdalalg_clip_common.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:8072: apps/CMakeFiles/appslib.dir/all]      
Error 2

If I put gdal_rat.h at the top of gdal_priv.h as you suggested before, the 
build proceeds a little further but failed with the similar error but on a 
different type:

[  1%] Building CXX object apps/CMakeFiles/appslib.dir/gdalalg_pipeline.cpp.o
In file included from /usr/include/c++/8/memory:80,
                 from /scratch/gdal/gdal/port/cpl_error.h:372,
                 from /scratch/gdal/gdal/apps/gdalalg_pipeline.cpp:13:
/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ?void std::default_del
ete<_Tp>::operator()(_Tp*) const [with _Tp = MEMDataset]?:
/usr/include/c++/8/bits/unique_ptr.h:277:17:   required from ?std::unique_ptr<_T
p, _Dp>::~unique_ptr() [with _Tp = MEMDataset; _Dp = std::default_delete<MEMData
set>]?
/scratch/gdal/gdal/apps/gdalalg_vector_pipeline.h:193:38:   required from here
/usr/include/c++/8/bits/unique_ptr.h:79:16: error: invalid application of ?sizeo
f? to incomplete type ?MEMDataset?
  static_assert(sizeof(_Tp)>0,
                ^~~~~~~~~~~
gmake[2]: *** [apps/CMakeFiles/appslib.dir/build.make:258: apps/CMakeFiles/appsl
ib.dir/gdalalg_pipeline.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:8072: apps/CMakeFiles/appslib.dir/all] Error
2

Thanks,
-Fengting

From: Even Rouault <even.roua...@spatialys.com>
Date: Wednesday, July 30, 2025 at 4:08 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

Fengting,

would 
https://github.com/OSGeo/gdal/pull/12830<https://urldefense.com/v3/__https:/github.com/OSGeo/gdal/pull/12830__;!!ACWV5N9M2RV99hQ!IQ-4A2c9x6A3nauMg-dyaTF1RRdUUfXZMhY8McqwBkKoA1G2K5ZeLJ0EN1k3FH38b-mhlkQz8cjr0NROPFZRU4kA4fvI$>
 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://urldefense.com/v3/__https:/en.cppreference.com/w/cpp/language/type-id.html*Incomplete_type__;Iw!!ACWV5N9M2RV99hQ!IQ-4A2c9x6A3nauMg-dyaTF1RRdUUfXZMhY8McqwBkKoA1G2K5ZeLJ0EN1k3FH38b-mhlkQz8cjr0NROPFZRU7ywDM87$>
 T, such as to facilitate the use as a handle in the pImpl 
idiom<https://urldefense.com/v3/__https:/en.cppreference.com/w/cpp/language/pimpl.html__;!!ACWV5N9M2RV99hQ!IQ-4A2c9x6A3nauMg-dyaTF1RRdUUfXZMhY8McqwBkKoA1G2K5ZeLJ0EN1k3FH38b-mhlkQz8cjr0NROPFZRU968o7GK$>.
 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><mailto:even.roua...@spatialys.com>
Date: Wednesday, July 23, 2025 at 4:59 PM
To: Fengting Chen <fengting.c...@oracle.com><mailto:fengting.c...@oracle.com>, 
gdal dev <gdal-dev@lists.osgeo.org><mailto: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<https://urldefense.com/v3/__http:/www.spatialys.com__;!!ACWV5N9M2RV99hQ!IQ-4A2c9x6A3nauMg-dyaTF1RRdUUfXZMhY8McqwBkKoA1G2K5ZeLJ0EN1k3FH38b-mhlkQz8cjr0NROPFZRUwjBn9F2$>

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