MaxRev-Dev / gdal.netcore

GDAL 3.x C#/F# bindings for .NET apps
MIT License
161 stars 36 forks source link

symbol lookup error: ./bin/Debug/net6.0/runtimes/linux-x64/native/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE #100

Closed bjornharrtell closed 1 year ago

bjornharrtell commented 1 year ago

Getting this error both with 3.6.1.120 and 3.6.3.100.

My OS is Ubuntu 23.04.

dotnet sdk: 6.0.116 [/usr/lib/dotnet/sdk]

dotnet runtime: Microsoft.AspNetCore.App 6.0.16 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.16 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

MaxRev-Dev commented 1 year ago

Hi @bjornharrtell. Your setup might be missing something. Here are the tests from the main branch. I'm using WSL2 with Ubuntu 22.04 installed (bare distro) upgraded to 23.04. Note that this was installed in 5 min. and without any additional dependencies but .NET 7.

image

MaxRev-Dev commented 1 year ago

I've found this also - https://github.com/ros2/ros2/issues/1406 Please, tell me if this works for you.

bjornharrtell commented 1 year ago

No luck yet. That referenced issue seems to have to do with snap installed versions and as far as I can tell that is not my situation.

bjornharrtell commented 1 year ago

I will see if I can setup a reproduction in a CI/docker setup.

bjornharrtell commented 1 year ago

Minimal reproduction at https://github.com/bjornharrtell/gdal.netcore.issue100.

It runs without issue when using docker image mcr.microsoft.com/dotnet/sdk:7.0 but fails with image ubuntu:23.04 (and dotnet7 added). It also fails when changed to .net6 target on image ubuntu:22.04 and dotnet6 (7 not readily available on 22.04).

bjornharrtell commented 1 year ago

However I cannot reproduce when run on ubuntu 22.04 as github action (https://github.com/bjornharrtell/gdal.netcore.issue100/actions/runs/4900739972/jobs/8751605421#step:6:9). Very strange...

bjornharrtell commented 1 year ago

I suspect the ubuntu packaged dotnet. It's not used at github actions because a newer version is bundled in their ubuntu images.

bjornharrtell commented 1 year ago

Confirmed, if I install dotnet using packages.microsoft.com I cannot reproduce this issue.

MaxRev-Dev commented 1 year ago

I've found a collision between the system's libpthread.so.0 and the packaged one. The workaround is to remove the packaged libpthread.so.0 before starting the app.

This is quite similar to #68. I will patch LinuxRuntime packages removing system-specific dependencies (yet again).

For newcomers: the libpthread library should be available in the system by default as a base package. But if it's missing, you can always install this package with sudo apt-get install libpthread-stubs0-dev

bjornharrtell commented 1 year ago

Confirmed, adding this to csproj to workaround for now:

<Target Name="FixIssue100" AfterTargets="AfterBuild">
  <Delete Files="bin/Debug/net6.0/runtimes/linux-x64/native/libpthread.so.0" />
</Target>