[gdal-dev] float16 woes on solaris

Even Rouault even.rouault at spatialys.com
Tue May 20 06:12:07 PDT 2025


Greg,

HAVE_STD_FLOAT16_T tests only the C++ part of Float16 support. Later in 
the log I can see:

-- Performing Test HAVE__FLOAT16
-- Performing Test HAVE__FLOAT16 - Success

which is this test in cmake/helpers/configure.cmake


# Check whether the type `_Float16` exists, and whether type
# conversions work (there might be linker problems)
check_cxx_source_compiles(
     "
       #ifdef GDAL_DISABLE_FLOAT16
         Explicitly disable _Float16 support
       #endif
       int main() {
         _Float16 h = 1;
         float f = h;
         double d = h;
         return f != 0 && d != 0 ? 0 : 1;
       }
     "
     HAVE__FLOAT16)

I've no idea how to fix linking issues on Solaris'ish systems, but you 
may just add -DGDAL_DISABLE_FLOAT16 in  CMAKE_C_FLAGS / CMAKE_CXX_FLAGS 
to prevent GDAL from using the builtin _Float16 C type.

Even

Le 20/05/2025 à 13:28, Greg Troxel via gdal-dev a écrit :
> The pkgsrc package isn't building on SmartOS (which is illumos, which is
> OpenSolaris, more or less).
>
> Full build at the last link:
>
>    https://reports.pkgci.org/SmartOS/upstream/trunk/20250518.2249/meta/report.html
>    https://reports.pkgci.org/SmartOS/upstream/trunk/20250518.2249/gdal-lib-3.11.0/configure.log
>    https://reports.pkgci.org/SmartOS/upstream/trunk/20250518.2249/gdal-lib-3.11.0/build.log
>
> but the key points are:
>
>    configure:
>      -- Performing Test HAVE_STD_FLOAT16_T
>      -- Performing Test HAVE_STD_FLOAT16_T - Failed
>
>    build:
>      [ 94%] Linking CXX shared library libgdal.so
>      Undefined			first referenced
>       symbol  			    in file
>      __extendhfsf2                       port/CMakeFiles/cpl.dir/cpl_json_streaming_writer.cpp.o
>      __extendhfxf2                       /home/pbulk/build/geography/gdal-lib/work/.buildlink/lib/libhdf5.so.310
>      __extendhfdf2                       port/CMakeFiles/cpl.dir/cpl_json_streaming_writer.cpp.o
>      __truncdfhf2                        alg/CMakeFiles/alg.dir/gdalrasterize.cpp.o
>      __truncxfhf2                        gcore/CMakeFiles/gcore.dir/rasterio.cpp.o
>      __truncsfhf2                        gcore/CMakeFiles/gcore.dir/gdalrasterband.cpp.o
>      __eqhf2                             alg/CMakeFiles/alg.dir/gdalwarpkernel.cpp.o
>      __nehf2                             alg/CMakeFiles/alg.dir/gdalwarpkernel.cpp.o
>      ld: fatal: symbol referencing errors. No output written to libgdal.so.37.3.11.0
>
> I think this is:
>
>    https://github.com/llvm/llvm-project/issues/105181
>
> Looking in gdal 3.11.0's CMakeLists.txt, the test for Float16 is
>
>    # Check whether std::float16_t is available and is working
>    include(CheckCXXSourceCompiles)
>    check_cxx_source_compiles(
>      "
>        #include <cmath>
>        #include <stdfloat>
>        int main() {
>          std::float16_t x = 0;
>          using std::nextafter;
>          std::float16_t y = nextafter(x, x);
>          return y == 0 ? 0 : 1;
>        }
>      "
>      HAVE_STD_FLOAT16_T
>    )
>
> It fails, whcih is good because it seems this platform has troubled
> float16.
>
> But somehow, float16 functions get added to to link.
>
> Has anyone built/tested gdal on Solaris-ish?
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

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



More information about the gdal-dev mailing list