[QGIS-Developer] Compiling against homebuilt GDAL

Richard Duivenvoorde rdmailings at duif.net
Wed Feb 28 23:39:24 PST 2024


Hi Thomas,

Not sure if it is usefull, but some time ago I build (always in ~/git/foo) and install (always in ~/bin/foo) PROJ, GDAL and then build QGIS (in ~/git/qgisgdal)  with those.

This is what I then use:

cd /home/richard/git/qgisgdal;

export LD_LIBRARY_PATH=/home/richard/bin/qgis/qgisgdal/debug/lib/:/usr/lib/grass76/lib/;export LD_LIBRARY_PATH=/home/richard/bin/gdal/lib:/home/richard/bin/proj/lib:$LD_LIBRARY_PATH

mkdir build;cd build;ccmake -DBUILD_TESTING=FALSE -DENABLE_TESTS=OFF -DWITH_SERVER=TRUE -DWITH_3D=TRUE -DCMAKE_INSTALL_PREFIX=/home/richard/bin/qgis/qgisgdal/debug -DWITH_QWTPOLAR=OFF -DCMAKE_BUILD_TYPE=Debug -DPROJ_INCLUDE_DIR=/home/richard/bin/proj/include/ -DPROJ_LIBRARY=/home/richard/bin/proj/lib/libinternalproj.so.15 -DGDAL_CONFIG=/home/richard/bin/gdal/bin/gdal-config -DGDAL_INCLUDE_DIR=/home/richard/bin/gdal/include/ -DGDAL_LIBRARY=/home/richard/bin/gdal/lib/libgdal.so -DQT5_3DEXTRA_LIBRARY=/usr/lib/x86_64-linux-gnu/libQt53DExtras.so -DCMAKE_PREFIX_PATH=/home/richard/git/qgisgdal/external/qt3dextra-headers/cmake -DQT5_3DEXTRA_INCLUDE_DIR=/home/richard/git/qgisgdal/external/qt3dextra-headers ..

Then to run QGIS you also have to make sure that QGIS picks up the right libs by using the LD_LIBRARY_PATH above.

Hope this is helpful.

Regards,

Richard Duivenvoorde


On 2/28/24 7:45 PM, Even Rouault via QGIS-Developer wrote:
> Thomas,
> 
> Le 28/02/2024 à 19:33, Thomas Larsen Wessel via QGIS-Developer a écrit :
>> I have successfully built QGIS and GDAL (3.7.2) separately. Now I want to build QGIS against this GDAL. This is what I tried:
>>
>> git clone git at github.com:qgis/QGIS.git
>> cd QGIS
>> mkdir build
>> cd build
>> GDAL_DIR=/home/velle/gdal3.7.2/build cmake ..
>>
>> The output contains the following error for GDAL:
>>
>> CMake Error at /home/velle/gdal-3.7.2/build/GDALConfig.cmake:24 (include):
>>   include could not find requested file:
>>     /home/velle/gdal-3.7.2/build/GDAL-targets.cmake
>> Call Stack (most recent call first):
>>   cmake/FindGDAL.cmake:16 (find_package)
>>   CMakeLists.txt:365 (find_package)
>>
>> Could someone please tell me if I'm even doing it right?
> 
> You need to *install* GDAL first. You can't just point QGIS to the GDAL build directory
> 
> So in the GDAL build directory, do "cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/install-gdal-3.7.2 ; make -j$(nproc); make install"
> 
> and then when configuring QGIS, use GDAL_DIR=$HOME/install-gdal-3.7.2 . I'm not totally sure about that last part. may require tweaking. you could alter the PATH to point to $HOME/install-gdal-3.7.2/bin so that "gdal-config" from your installed GDAL is picked up
> 
> Even
> 
> -- 
> http://www.spatialys.com
> My software is free, but my time generally not.
> 
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



More information about the QGIS-Developer mailing list