Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux libraries not being found in the DotNet 8 Managed Runtime #1724

Closed
genifycom opened this issue Apr 10, 2024 · 2 comments
Closed

Linux libraries not being found in the DotNet 8 Managed Runtime #1724

genifycom opened this issue Apr 10, 2024 · 2 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@genifycom
Copy link

genifycom commented Apr 10, 2024

Describe the bug

We have a dotnet 6 Lambda AWS Application that uses QuestPDF (and hence SkiaSharp and HarfbuzzSharp) libraries. They include the Linux libraries required to run in Lambda and have been in production for a while.

On upgrading to dotnet 8, the Managed runtime seems to be unable to find them:

` ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' 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:

libfontconfig.so.1: cannot open shared object file: No such file or directory
/var/lang/bin/shared/Microsoft.NETCore.App/8.0.3/libSkiaSharp.so: cannot open shared object file: No such file or directory
/var/task/liblibSkiaSharp.so: cannot open shared object file: No such file or directory
/var/lang/bin/shared/Microsoft.NETCore.App/8.0.3/liblibSkiaSharp.so: cannot open shared object file: No such file or directory

/var/task/libSkiaSharp: cannot open shared object file: No such file or directory
/var/lang/bin/shared/Microsoft.NETCore.App/8.0.3/libSkiaSharp: cannot open shared object file: No such file or directory
/var/task/liblibSkiaSharp: cannot open shared object file: No such file or directory
/var/lang/bin/shared/Microsoft.NETCore.App/8.0.3/liblibSkiaSharp: cannot open shared object file: No such file or directory`

We have confirmed that the libraries libSkiaSharp.so and libHarfbuzzSharp.so are in the Zip file sent to AWS Lambda (from Visual Studio 2022 AWS Toolkit).

It seems like there might be an issue with the DotNet 8 Managed Lambda runtime in placing these .so file.
Also please note the added lib i.e. the name liblibSkiaSharp.so (which is NOT in the Zip file).

Expected Behavior

To work as per the DotNet 6 Managed Runtime

Current Behavior

Exception has been thrown by the target of an invocation.

---> System.TypeInitializationException: The type initializer for 'QuestPDF.Settings' threw an exception.

---> QuestPDF.Drawing.Exceptions.InitializationException: The QuestPDF library has encountered an issue while loading one of its dependencies. This type of error often occurs when the current runtime is missing necessary NuGet packages.

Reproduction Steps

Create a Lambda DotNet Application with included Linux libraries

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2.3" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.3" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.3" />

Targeted .NET Platform

.NET Core 8.0

Operating System and version

AWS Lambda

@genifycom genifycom added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 10, 2024
@genifycom
Copy link
Author

To fix this, remove:

There is also the SkiaSharp.NativeAssets.Linux.NoDependencies that you can use instead of SkiaSharp.NativeAssets.Linux to avoid this, but you lose out on some advanced font features.

Copy link
Contributor

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant