imageflow icon indicating copy to clipboard operation
imageflow copied to clipboard

Azure Web App (Code,Linux,Net7) Error: Looking for "libimageflow.so"

Open ollejacobsen opened this issue 2 years ago • 10 comments

Hi.

We have setup an Web App on Azure. Using:

  • Publish: Code
  • Runtime stack: .NET 7 (STS)
  • OS: Linux

After publish and trying to rescale an image we get the Exception:

DllNotFoundException: Looking for "libimageflow.so" RID="linux-x64", IsUnix=True, IsDotNetCore=True RelativeSearchPath="" 
Before searching: Unable to load shared library 'imageflow' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/home/site/wwwroot/imageflow.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/imageflow.so: cannot open shared object file: No such file or directory
/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /home/site/wwwroot/libimageflow.so)
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/libimageflow.so: cannot open shared object file: No such file or directory
/home/site/wwwroot/imageflow: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/imageflow: cannot open shared object file: No such file or directory
/home/site/wwwroot/libimageflow: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/libimageflow: cannot open shared object file: No such file or directory File not found: 
/home/site/wwwroot/x64/libimageflow.so Error "Success" (0) loading imageflow from /home/site/wwwroot/libimageflow.so File not found: 
/home/site/wwwroot/runtimes/linux-x64/native/libimageflow.so at Imageflow.Bindings.NativeMethods.imageflow_context_create(UInt32 imageflowAbiVerMajor, UInt32 imageflowAbiVerMinor) at Imageflow.Bindings.JobContextHandle.<>c.<.ctor>b__0_0() at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func`1 invokingOperation, IEnumerable`1 customSearchDirectories)

The Imageflow NuGet packages the project is referencing is:

<PackageReference Include="Imageflow.AllPlatforms" Version="0.10.0" />
<PackageReference Include="Imageflow.Server" Version="0.8.1" />
<PackageReference Include="Imageflow.Server.DiskCache" Version="0.8.1" />

Should Imageflow be able to run in this simplistic setup? Locally we are developing on both Windows and OSX without any issues.

Best regads, Olle

ollejacobsen avatar Aug 21 '23 10:08 ollejacobsen

Something is going wrong during publish because the transitive depedency isn't getting copied..

Try adding https://www.nuget.org/packages/Imageflow.NativeRuntime.ubuntu-x86_64/2.0.0-preview5 directly.

On Mon, Aug 21, 2023, 4:18 AM Olle Jacobsen @.***> wrote:

Hi.

We have setup an Web App on Azure. Using:

  • Publish: Code
  • Runtime stack: .NET 7 (STS)
  • OS: Linux

After publish and trying to rescale an image we get the Exception:

DllNotFoundException: Looking for "libimageflow.so" RID="linux-x64", IsUnix=True, IsDotNetCore=True RelativeSearchPath="" Before searching: Unable to load shared library 'imageflow' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: /home/site/wwwroot/imageflow.so: cannot open shared object file: No such file or directory /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/imageflow.so: cannot open shared object file: No such file or directory /lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.29' not found (required by /home/site/wwwroot/libimageflow.so) /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/libimageflow.so: cannot open shared object file: No such file or directory /home/site/wwwroot/imageflow: cannot open shared object file: No such file or directory /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/imageflow: cannot open shared object file: No such file or directory /home/site/wwwroot/libimageflow: cannot open shared object file: No such file or directory /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/libimageflow: cannot open shared object file: No such file or directory File not found: /home/site/wwwroot/x64/libimageflow.so Error "Success" (0) loading imageflow from /home/site/wwwroot/libimageflow.so File not found: /home/site/wwwroot/runtimes/linux-x64/native/libimageflow.so at Imageflow.Bindings.NativeMethods.imageflow_context_create(UInt32 imageflowAbiVerMajor, UInt32 imageflowAbiVerMinor) at Imageflow.Bindings.JobContextHandle.<>c.<.ctor>b__0_0() at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func1 invokingOperation, IEnumerable`1 customSearchDirectories)

The Imageflow NuGet packages the project is referencing is:

Should Imageflow be able to run in this simplistic setup? Locally we are developing on both Windows and OSX without any issues.

Best regads, Olle

— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow/issues/634, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LH3RB7RSQU3M5NQEOX3XWMYWXANCNFSM6AAAAAA3YE2WKY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

lilith avatar Aug 21 '23 12:08 lilith

Thanks for the quick reply.

I've tested with the package above with the same result.

If I SSH into the host from the Kudo console and run cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Looks that the default container for using an Azure Web App with .NET 7 in Linux is using Debian.

ollejacobsen avatar Aug 21 '23 12:08 ollejacobsen

It targets RID linux-x64

Even if for some reason your platform didn’t have libc it should still copy (it is built on Ubuntu 20, but statically links dependencies except for that one)

Buster is 2019 era, an odd choice, but this is a 64 bit build right?

On Mon, Aug 21, 2023, 6:47 AM Olle Jacobsen @.***> wrote:

Thanks for the quick reply.

I've tested with the package above with the same result.

If I SSH into the host from the Kudo console and run cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

Looks that the default container for using an Azure Web App with .NET 7 in Linux is using Debian.

— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow/issues/634#issuecomment-1686264128, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LH3524CZZCZQDSDMKVLXWNKF5ANCNFSM6AAAAAA3YE2WKY . You are receiving this because you commented.Message ID: @.***>

lilith avatar Aug 21 '23 13:08 lilith

The build/publish is done in GitHub Actions. And the artifact is copied over to the "Debian" instance. The job is specifying: runs-on: ubuntu-latest And the publish step is: dotnet publish {projectname}.csproj -c Release -r linux-x64 --self-contained false I've also tried to omit the -r flag (build for all) and also set --self-contained true. With out any luck.

ollejacobsen avatar Aug 21 '23 19:08 ollejacobsen

The libimageflow.so file is there and seems to be found (last row).

/home/site/wwwroot/runtimes/linux-x64/native/libimageflow.so at Imageflow.Bindings.NativeMethods.imageflow_context_create(UInt32 imageflowAbiVerMajor, UInt32 imageflowAbiVerMinor) at Imageflow.Bindings.JobContextHandle.<>c.<.ctor>b__0_0() at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func`1 invokingOperation, IEnumerable`1 customSearchDirectories)

Isn't it the depencency GLIBC_2.29 that's the problem?

ollejacobsen avatar Aug 21 '23 20:08 ollejacobsen

I don't know from the stacktrace, but have you tried a modern debian?

On Mon, Aug 21, 2023, 2:43 PM Olle Jacobsen @.***> wrote:

The libimageflow.so file is there and seems to be found (last row).

/home/site/wwwroot/runtimes/linux-x64/native/libimageflow.so at Imageflow.Bindings.NativeMethods.imageflow_context_create(UInt32 imageflowAbiVerMajor, UInt32 imageflowAbiVerMinor) at Imageflow.Bindings.JobContextHandle.<>c.<.ctor>b__0_0() at Imageflow.Bindings.NativeLibraryLoader.FixDllNotFoundException[T](String basename, Func1 invokingOperation, IEnumerable1 customSearchDirectories)

Isn't it the depencency GLIBC_2.29 that's the problem?

— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow/issues/634#issuecomment-1687016605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LHZUBSYBW3JU3ANYJNDXWPB6TANCNFSM6AAAAAA3YE2WKY . You are receiving this because you commented.Message ID: @.***>

lilith avatar Aug 21 '23 20:08 lilith

I'm sorry, I just realized the wrapping on my phone occluded the important bit. You are correct, you have a glibc that is too old.
/lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.29' not found`

We build Imageflow on Ubuntu 20.04, the oldest Github Actions offers (and the oldest Ubuntu still patched), which uses libc 2.31-0ubuntu9.9

I'd like more info on how Azure put you on such an old platform, Buster EOL was 2022-09-10

lilith avatar Aug 22 '23 04:08 lilith

Exactly @lilith it seems a bit weird. I'll try to create a new Web App and check if they have updated the container. I'll post here again when I have more info.

ollejacobsen avatar Aug 22 '23 07:08 ollejacobsen

I confirm the same issue with v0.10 running on a Linux Azure App Service. App services are all the default Debian, provisioned approximately a year ago, with the same host info as @ollejacobsen. I suppose workarounds are custom containers, creating fresh, or running apt-get to update glibc, but seems like either may be too much if in a production environment for most.

bwaldron-spectrum avatar Aug 26 '23 04:08 bwaldron-spectrum

Hmm, that is a challenge. While my own code can switch to linking against MUSL, it may be tricky for dependencies like mozjpeg/libpng/libwebp. I'll have to explore options.

No idea why they're deploying an EOL OS.

On Fri, Aug 25, 2023, 10:21 PM bwaldron-spectrum @.***> wrote:

I confirm the same issue with v0.10 running on a Linux Azure App Service. App services are all the default Debian, provisioned approximately a year ago, with the same host info as @ollejacobsen https://github.com/ollejacobsen. I suppose workarounds are custom containers, creating fresh, or running apt-get to update glibc, but seems like either may be too much if in a production environment for most.

— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow/issues/634#issuecomment-1694154320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LH5HDPN3IS2RF7LHSS3XXF2WLANCNFSM6AAAAAA3YE2WKY . You are receiving this because you were mentioned.Message ID: @.***>

lilith avatar Aug 26 '23 04:08 lilith