[gdal-dev] cmake status update - 99% good news!

Even Rouault even.rouault at spatialys.com
Wed Jan 26 09:45:49 PST 2022


Le 26/01/2022 à 17:26, Joaquim Manuel Freire Luís a écrit :
>
> Joaquim,
>> But I found two other new issues when adding more dependencies
>>
>> 1.
>> C:\programs\compa_libs\gdal_GIT\frmts\mbtiles\mbtilesdataset.cpp(45): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory
>>
>> To work around this, I temporarily added zlib.h and zconf.h to frmts\mbtiles
> Should be fixed by the first commit of
> https://github.com/OSGeo/gdal/pull/5179
>
> I'm afraid it got worst

-- Configuring done
-- Generating done
-- Build files have been written to: C:/programs/compa_libs/gdal_GIT/build
ninja: error: 'ws2_32.lib', needed by 'gdal_w64.dll', missing and no known rule to make it

I'd say on the contrary that it helped the build to go further, didn't 
it ? My fixes are totally unrelated to a ws2_32.lib missing

I see in configure.ac that we had the following logic

dnl 
---------------------------------------------------------------------------
dnl Check if we need -lws2_32 (mingw)
dnl 
---------------------------------------------------------------------------

echo "#include <winsock2.h>" > test_ws2_32.c
echo "#include <ws2tcpip.h>" >> test_ws2_32.c
echo "void foo() {}" >> test_ws2_32.c

if test -z "`${CC} -c test_ws2_32.c 2>&1`" ; then
   LIBS="$LIBS -lws2_32"
fi
rm -f test_ws2_32*

dnl 
---------------------------------------------------------------------------
dnl Check if we need -lpsapi (mingw)
dnl 
---------------------------------------------------------------------------

echo "#include <windows.h>" > test_psapi.c
echo "#include <psapi.h>" >> test_psapi.c
echo "void foo() {}" >> test_psapi.c

if test -z "`${CC} -c test_psapi.c 2>&1`" ; then
   LIBS="$LIBS -lpsapi"
fi
rm -f test_psapi*

This hasn't been ported yet to cmake builds.

I've ticketed that in https://github.com/OSGeo/gdal/issues/5180.

Hum, upon reflection, the error message would seem to indicate that we 
try to link to ws2_32.lib but it is not found in your environemnt

Looking for ws2_32 in cmake build scripts, I see it is referenced in

cmake/modules/packages/FindODBC.cmake: set(_odbc_required_libs_names 
odbccp32;ws2_32)
cmake/modules/packages/FindHDF4.cmake:        list(APPEND HDF4_LIBRARIES 
ws2_32.lib)

Do you use any of ODBC or HDF4 in your build ? Could you try to disable 
them and see if it makes a difference ?

Or maybe if you've HDF4, try to change the ws2_32.lib to ws2_32 in 
cmake/modules/packages/FindHDF4.cmake ?

Even

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



More information about the gdal-dev mailing list