A simple (as is) build engine of GDAL 3.0 library for .NET Core.
NuGet: MaxRev.Gdal.Core
NuGet: MaxRev.Gdal.LinuxRuntime.Minimal
NuGet: MaxRev.Gdal.WindowsRuntime.Minimal
- Only generates assemblies and binds everything into one package.
- Provides easy access to GDAL by installing only core and runtime package
- DOES NOT require installation of GDAL
- Does not compile all drivers. Only configured, they are listed below. By default GDAL has a lot of internal drivers.
- Does not change GDAL source code.
- Does not extend GDAL methods.
It's quite tricky. Enter win directory to find out how.
Current version targets GDAL 3.0.1 with minimal drivers
Drivers included PROJ6, SQLITE3, GEOS(3.8), HDF4, HDF5, GEOTIFF, JPEG, PNG, LIBZ, LERC, CURL
Configure summary of current version
GDAL is now configured for x86_64-pc-linux-gnu
Installation directory: /mnt/e/dev/builds/gdal-netcore/build-unix/gdal-build
C compiler: gcc -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -fPIC -fvisibility=hidden
C++ compiler: g++ -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2 -fvisibility=hidden
C++14 support: no
LIBTOOL support: yes
LIBZ support: internal
LIBLZMA support: no
ZSTD support: no
cryptopp support: no
crypto/openssl support: no
GRASS support: no
CFITSIO support: no
PCRaster support: no
LIBPNG support: internal
DDS support: no
GTA support: no
LIBTIFF support: internal (BigTIFF=yes)
LIBGEOTIFF support: internal
LIBJPEG support: internal
12 bit JPEG: yes
12 bit JPEG-in-TIFF: yes
LIBGIF support: no
JPEG-Lossless/CharLS: no
OGDI support: no
HDF4 support: yes
HDF5 support: yes
Kea support: no
NetCDF support: no
Kakadu support: no
JasPer support: no
OpenJPEG support: no
ECW support: no
MrSID support: no
MrSID/MG4 Lidar support: no
JP2Lura support: no
MSG support: no
EPSILON support: no
WebP support: no
cURL support (wms/wcs/...):yes
PostgreSQL support: no
LERC support: yes
MySQL support: no
Ingres support: no
Xerces-C support: no
Expat support: no
libxml2 support: no
Google libkml support: no
ODBC support: no
FGDB support: no
MDB support: no
PCIDSK support: no
OCI support: no
GEORASTER support: no
SDE support: no
Rasdaman support: no
DODS support: no
SQLite support: yes
PCRE support: no
SpatiaLite support: no
RasterLite2 support: no
Teigha (DWG and DGNv8): no
INFORMIX DataBlade support:no
GEOS support: yes
SFCGAL support: no
QHull support: no
Poppler support: no
Podofo support: no
PDFium support: no
OpenCL support: no
Armadillo support: no
FreeXL support: no
SOSI support: no
MongoDB support: no
MongoCXX v3 support: no
HDFS support: no
TileDB support: no
userfaultfd support: yes
misc. gdal formats: aaigrid adrg aigrid airsar arg blx bmp bsb cals ceos ceos2 coasp cosar ctg dimap dted e00grid elas envisat ers fit gff gsg gxf hf2 idrisi ignfheightasciigrid ilwis ingr iris iso8211 jaxapalsar jdem kmlsuperoverlay l1b leveller map mrf msgn ngsgeoid nitf northwood pds prf r raw rmf rs2 safe saga sdts sentinel2 sgi sigdem srtmhgt terragen til tsx usgsdem xpm xyz zmap rik ozi grib eeda plmosaic rda wcs wms wmts daas rasterlite mbtiles pdf
disabled gdal formats:
misc. ogr formats: aeronavfaa arcgen avc bna cad csv dgn dxf edigeo geoconcept georss gml gmt gpsbabel gpx gtm htf jml mvt ntf openair openfilegdb pgdump rec s57 segukooa segy selafin shape sua svg sxf tiger vdv wasp xplane idrisi pds sdts amigocloud carto cloudant couchdb csw elastic gft ngw plscenes wfs gpkg vfk osm
disabled ogr formats:
SWIG Bindings: no
PROJ >= 6: yes
enable GNM building: no
enable pthread support: yes
enable POSIX iconv support:yes
hide internal symbols: yes
NOTE: Windows and Linux drivers availability may differ, ask me of specific driver for runtime. Please issue, if I forgot to mention any other packages.
First of all I wish you to be patient & bring your snacks. Compilation from scratch takes nearly for 2 hours.
Environment: I'm compiling in WSL on CentOS 7 with GLIBC 2.17 (2012)
yum install tcl tcl-devel -y
- for building sqlite3yum install patchelf -y
- dynamic linking
If you have installed libsqlite3-dev and proj6 - go forward to step #3
If you have libsqlite3-dev installed you may skip the first step.
Set a root variable for convenience
export gc_root=`pwd`
Soo.. Let's start
Assuming you have tclsh
for compiling sqlite3
make -f GdalMakefile
this will compile sqlite3, proj6, geos
and gdal
from scratch
-
Download SQLite3 Autoconf & unpack (GdalMakefile uses git for this)
mkdir $gc_root/build-unix curl -o sqlite.tar.gz "https://www.sqlite.org/2019/sqlite-autoconf-3290000.tar.gz" tar xfv sqlite.tar.gz && mv sqlite-autoconf-3290000 sqlite3-source && cd sqlite3-source
-
Configure sqlite3
./configure --prefix=$gc_root/sqlite3-build
-
Compile and install
make && make install && cd $gc_root
-
Download proj & unpack (GdalMakefile uses git for this)
mkdir $gc_root/build-unix curl -o proj-6.1.0.tar.gz "https://download.osgeo.org/proj/proj-6.1.0.tar.gz" tar xfv proj-6.1.0.tar.gz && mv proj-6.1.0 proj6-source && cd proj6-source
-
./configure CFLAGS="-fPIC" --prefix=$gc_root/proj6-build
-
make LDFLAGS="-Wl,-rpath '-Wl,\$\$ORIGIN' -L$gc_root/sqlite3-build/lib" && make install && cd $gc_root
Note: you must specify the sqlite3 library custom location with -L flag
You can build gdal using GdalMakefile, but before you must setup paths in GdalCore.opt file. Also you must change configuregdal.sh script to setup necessary drivers.
Then you may just call make -f GdalMakefile gdal
- this will sync gdal repository, configure it and finaly build.
Or alternatively... (assuming you are in the root of this repo)
-
git clone https://github.com/OSGeo/gdal.git $gc_root/build-unix/gdal-source
-
cd $gc_root && make -f GdalMakefile configure_gdal #calls ./configuregdal.sh
-
make -f GdalMakefile build_gdal
After you have gdal installed, you can proceed to netcore bindings build.
-
Edit library path for proj & gdal (configured above) in GNUMakefile
-
cd $gc_root && make interface
-
make RID=linux-x64 #NOTE: You must call it TWICE. Thas a bug in linker
-
Cheers!
- Install .NET Core SDK and Nuget.exe - for building and publishing packages
- You have already built everything
- I'm using debian for example:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/9/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get install apt-transport-https && apt-get update && apt-get install dotnet-sdk-2.2
- And then just
make pack
A: Feel free to contribute and I will help you you to add them. Here's the my additional answer.
A: Try to search an issue on github. In 98% cases, I'm sure they are working fine.
A: Yes, currently there are some redundant types in OGR namespace. This will be fixed in the next builds.
A: I've built it on my machine several times from scratch. Do you have installed all SDKs? If you know cmake or nmake you can help to port batch files that are buggy.
A: The main reason I'm compiling it on CentOS - glibc of version 2.17. It's the lowest version (in my opinion) that suits for all common systems (Ubuntu, Debian, Fedora)
A: Use of older version of GLIBC might be a reason. But It's not a fault of build engine.
based on https://github.com/OSGeo/gdal && https://github.com/jgoday/gdal
Contact me: Telegram - MaxRev
Enjoy!