[gdal-dev] Building distributable files and bindings with CMake

adamgutonski adamgutonski at protonmail.com
Sun Feb 26 06:12:21 PST 2023


Hello,

I am having trouble with CMake and creating the GDAL configuration that I desire. My goal is to be able to distribute GDAL to a few colleagues so they can immediately use the GDAL bindings in Java code without them having to build and install GDAL directly. The GDAL build should be minimal and only include the OpenFileGDB driver.

I run the following CMake configuration and build:

cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_JAVA_BINDINGS=ON -DGDAL_BUILD_OPTIONAL_DRIVERS:BOOL=OFF -DOGR_BUILD_OPTIONAL_DRIVERS:BOOL=OFF -DOGR_ENABLE_DRIVER_OPENFILEGDB:BOOL=ON -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_APPS=NO -DGDAL_USE_EXTERNAL_LIBS=OFF

cmake --build .

After this, I am able to add the Java bindings (.jar) to my Java project on my machine without installing GDAL. After setting java.library.path to the gdalalljni directory (gdal-version/build/swig/java) the bindings work. I want my colleagues to be able to do the same by simply sending them a folder of the build I create. Currently when I send my build to a colleague and they set up their Java project to include the bindings, they get this error:

java.lang.UnsatisfiedLinkError: no gdalalljni in java.library.path

Is it even possible to distribute GDAL this way on MacOS/Ubuntu? Especially given PROJ as a runtime dependency? I would be grateful for any advice about how I can get close to be able to distributing GDAL in this manner. Perhaps using a docker container is the way to go? However I have been unable to find any documentation about how to use the Java bindings with docker since it does not look like they are included in the latest alpine release.

Kind regards,
Adam Gutonski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230226/a9115612/attachment.htm>


More information about the gdal-dev mailing list