Search code examples
c#linuxgdal

How to publish C# Gdal project to Debian


I have a .NET Core C# web project which uses GDAL and GDAL.Native packages. All works well locally, but after publishing to a Debian server, it reports a bunch of messages like

/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.0/osr_wrap.so: cannot open shared object file: No such file or directory /var/www/appRoot/osr_wrap.so: cannot open shared object file

My gitlab script is:

build-backend:
  stage: build-backend
  image: mcr.microsoft.com/dotnet/sdk:latest
  script:
    - cd appDir
    - dotnet restore
    - dotnet build --configuration Release
    - rsync -av --delete bin/Release/net8.0/ /var/www/appRoot/

Other components of the project work well after publishing. What am I missing?


Solution

  • From a brief look and from memory - the NuGet GDAL and GDAL.Native packages only work on Windows since they do not package the binaries for other platforms (and there are a lot of binaries needed).

    This is also shown by the error message calling for osr_wrap.so - if it was a multiplatform build it would be asking for libosr_wrap.so.

    The other available sources for C# are shown here https://gdal.org/api/csharp/index.html.

    I created and use the Conda package since I needed it for Unity and that does not use NuGet anyway. The other option you have - I believe - is the MaxRev solution.