Hi Abel,

I can recommend vcpkg (https://vcpkg.io/) if you’d like to build GDAL on 
Windows with Visual Studio or Visual Studio Community Edition.

vcpkg builds packages from sources and can build the mandatory dependencies of 
GDAL (and a lot of optional ones). You get a working starting set via

vcpkg --triplet=x64-windows install curl expat geos lerc libdeflate libgeotiff 
libiconv libpng libxml2 openssl proj qhull sqlite3[rtree] xerces-c zlib

You can then open GDAL’s CMakeLists.txt file in Visual Studio via File -> Open 
-> CMake… After configuration, you can just start the build:

>------ Build All started: Project: gdal, Configuration: x64-Debug ------
  [1/1351] Building C object frmts\zlib\CMakeFiles\libz.dir\crc32.c.obj
  [2/1351] Building C object frmts\zlib\CMakeFiles\libz.dir\trees.c.obj
  [3/1351] Building C object frmts\zlib\CMakeFiles\libz.dir\uncompr.c.obj
...
  [1348/1351] Linking CXX executable fuzzers\tests\test_ogr_fuzzer.exe
  [1349/1351] Linking CXX executable fuzzers\tests\test_gdal_fuzzer.exe
  [1350/1351] Linking CXX executable perftests\bench_ogr_c_api.exe
  [1351/1351] Linking CXX executable 
fuzzers\tests\test_osr_set_from_user_input_fuzzer.exe

Build All succeeded.

vcpkg builds debug and release versions of the packages. As the packages are 
built from source, you can even debug into the dependencies because the source 
code is on your machine. That can be really helpful from time to time.

I’d recommend starting from a clean environment though. I guess you tweaked 
quite a lot to get GDAL building.

Cheers,
Stefan

From: gdal-dev <gdal-dev-boun...@lists.osgeo.org> On Behalf Of Abel Pau via 
gdal-dev
Sent: Monday, September 25, 2023 5:25 PM
To: Even Rouault <even.roua...@spatialys.com>; gdal dev 
<gdal-dev@lists.osgeo.org>
Subject: Re: [gdal-dev] About installing EXPAT

Hi again,
well after using CONDA_PREFIX some errors appear about packages that are not 
included (I suppose).

archive.dll
libcrypto-3-x64.dll
libssl-3-x64.dll
liblz4.dll

Are they familiar to you?


De: Even Rouault <even.roua...@spatialys.com<mailto:even.roua...@spatialys.com>>
Enviado el: dilluns, 25 de setembre de 2023 16:32
Para: Abel Pau <a....@creaf.uab.cat<mailto:a....@creaf.uab.cat>>; gdal dev 
<gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>>
Asunto: Re: [gdal-dev] About installing EXPAT


Add -DCMAKE_PREFIX_PATH="$CONDA_PREFIX" to your CMake invokation (assuming your 
have activate your Conda environment, so CONDA_PREFIX is set)

My suggestion is inspired from our CI Conda based Windows build: 
https://github.com/OSGeo/gdal/blob/7fc7bb59d2b2de1dca03dd18c14005f2b64adb49/.github/workflows/cmake_builds.yml#L463

You should also probably clear your existing CMakeCache.txt before doing the 
abve, to avoid mixing with variables set from your previous experiments
Le 25/09/2023 à 16:21, Abel Pau a écrit :
Hi Even,
I really appreciate your help.

I prefer going by the easy way so once installed miniconda and applied all the 
described in download.htm.

To have the EXPAT installed I do that: conda install expat

And the, when I try the cmake .. some issues appear

D:\GitHub-repository\GDAL\build>cmake ..
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
-- GDAL_VERSION          = 3.8.0dev
-- GDAL_ABI_FULL_VERSION = 38
-- GDAL_SOVERSION        =
-- Could NOT find MSSQL_NCLI (missing: MSSQL_NCLI_LIBRARY 
MSSQL_NCLI_INCLUDE_DIR MSSQL_NCLI_VERSION)
-- Could NOT find MSSQL_ODBC (missing: MSSQL_ODBC_LIBRARY 
MSSQL_ODBC_INCLUDE_DIR MSSQL_ODBC_VERSION)
-- Could NOT find MySQL (missing: MYSQL_LIBRARY MYSQL_INCLUDE_DIR)
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
-- Could NOT find Iconv (missing: Iconv_LIBRARY Iconv_CHARSET_LIBRARY 
Iconv_INCLUDE_DIR)
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
-- Could NOT find EXPAT (missing: EXPAT_DIR)
-- Could NOT find EXPAT (missing: EXPAT_LIBRARY EXPAT_INCLUDE_DIR)
CMake Error at cmake/helpers/CheckDependentLibraries.cmake:202 (message):
  Configured to use EXPAT, but not found
Call Stack (most recent call first):
  cmake/helpers/CheckDependentLibraries.cmake:348 (gdal_check_package)
  gdal.cmake:265 (include)
  CMakeLists.txt:280 (include)


-- Configuring incomplete, errors occurred!

D:\GitHub-repository\GDAL\build>

There is something I don’t understand because I don’t know what to do now.
Why after doing an gdal_master_env and installing everything and expat it 
doesn’t work?

Once again, I appreciate your help :)


De: Even Rouault <even.roua...@spatialys.com><mailto:even.roua...@spatialys.com>
Enviado el: dilluns, 25 de setembre de 2023 14:30
Para: Abel Pau <a....@creaf.uab.cat><mailto:a....@creaf.uab.cat>; gdal dev 
<gdal-dev@lists.osgeo.org><mailto:gdal-dev@lists.osgeo.org>
Asunto: Re: [gdal-dev] About installing EXPAT


Abel,

In Cmakefile.txt of the project I’ve configured this (below # Developer may 
want to specify some variable to find proper version.):
set(EXPAT_INCLUDE_DIR "D:/GitHub-repository/libexpat/expat/lib")
set(EXPAT_LIBRARY 
"D:/GitHub-repository/libexpat/expat/build/Debug/libexpatd.lib")
Is this .lib a static library, or an import library of the .dll ? My assumption 
(I may be wrong) is that it is an import lib of the .dll. In which case you 
must not set EXPAT_USE_STATIC_LIBS

set(EXPAT_LIBRARY 
"D:/GitHub-repository/libexpat/expat/build/Debug/libexpatd.dll")

That won't work. This needs to be a .lib

You'd better run cmake again on expat with a 
-DCMAKE_INSTALL_PREFIX=d:/install-prefix   and run "cmake --build . --target 
install", and then when building GDAL, use "cmake .. 
-DCMAKE_PREFIX_PATH=d:/install-prefix", so it automatically configures things 
from what is found in d:/install-prefix

You could also potentially use vcpkg or conda to install GDAL dependencies 
instead of building them from scratch: https://gdal.org/download.html

Even

--

http://www.spatialys.com<http://www.spatialys.com/>

My software is free, but my time generally not.

--

http://www.spatialys.com<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