Application not loading on Linux after adding SkiaSharp native packages (works fine on Windows)

Hello Aspose Support Team,

We are facing an issue when running our .NET Core 3.1 application on Linux.
The same application works fine on Windows, but after encountering a SkiaSharp error log, we added SkiaSharp native packages to our project.

After adding these packages and testing locally on Windows, everything works fine. However, on Linux, the application fails to load.

:gear: Environment Details

OS (Working): Windows 10

OS (Failing): Amazon Linux 2 (EC2)

.NET Version: .NET Core 3.1

Aspose Components:

Aspose.PDF 21.6.0

Aspose.Words 21.6.0

Aspose.Cells 21.6.0

Aspose.Email 21.6.0

Aspose.Imaging 21.6.0

Aspose.Slides.NET 21.6.0

:jigsaw: Error Log

Oct 22 09:23:04 ip-10-12-16-28.us-east-2.compute.internal mis-wf[28314]: Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
Oct 22 09:23:04 ip-10-12-16-28.us-east-2.compute.internal mis-wf[28314]: ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. 
In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: 
liblibSkiaSharp: cannot open shared object file: No such file or directory
   at SkiaSharp.SkiaApi.sk_version_get_milestone()
   at SkiaSharp.SkiaSharpVersion.get_Native()
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
   at SkiaSharp.SKObject..cctor()
--- End of inner exception stack trace ---
   at SkiaSharp.SKObject.DeregisterHandle(IntPtr handle, SKObject instance)
   at SkiaSharp.SKObject.set_Handle(IntPtr value)
   at SkiaSharp.SKNativeObject.Dispose(Boolean disposing)
   at SkiaSharp.SKObject.Dispose(Boolean disposing)
   at SkiaSharp.SKBitmap.Dispose(Boolean disposing)
   at SkiaSharp.SKNativeObject.Finalize()

:brick: Project File (csproj)

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspose.PDF" Version="21.6.0" />
    <PackageReference Include="Aspose.Words" Version="21.6.0" />
    <PackageReference Include="Aspose.Cells" Version="21.6.0" />
    <PackageReference Include="Aspose.Email" Version="21.6.0" />
    <PackageReference Include="Aspose.Imaging" Version="21.6.0" />
    <PackageReference Include="Aspose.Slides.NET" Version="21.6.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.5" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.32" />

    <!-- Added SkiaSharp packages -->
    <PackageReference Include="SkiaSharp" Version="3.119.1" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.1" />
    <PackageReference Include="SkiaSharp.NativeAssets.macOS" Version="3.119.1" />
    <PackageReference Include="SkiaSharp.NativeAssets.Win32" Version="3.119.1" />
  </ItemGroup>

</Project>

:warning: Behavior Summary

:white_check_mark: Windows: Application runs successfully after adding SkiaSharp packages.

:x: Linux: Application fails to load after adding SkiaSharp packages.

:repeat: If we revert the SkiaSharp package additions, the application loads again on Linux, but the original libSkiaSharp error reappears during file conversions.

:question: Questions

Is there a known compatibility issue between Aspose 21.6.0 components and SkiaSharp 3.x on Linux?

What is the recommended way to configure SkiaSharp dependencies for Aspose.Slides / Aspose.Imaging on Linux?

Are there specific native libraries or environment variables required for proper SkiaSharp initialization on Linux?

Would upgrading to newer Aspose versions (e.g., 24.x) resolve this dependency issue?

@ragu2736 Aspose.Words 21.6 is not compatible with the latest 3.119.1 version of SkiaSharp. With 21.6 version of Aspose.Words you should use 2.80.1 version of SkiaSharp.NativeAssets . There were breaking API changes in 3.119.1 of SkiaSharp. So they are not compatible.

1 Like

@ragu2736,

Regarding Aspose.Cells, since you are currently using .NET Core 3.1 along with an older version of Aspose.Cells (21.6.0), please note that at that time, the component relied on System.Drawing.Common instead of SkiaSharp. This may result in limited support on non-Windows operating systems. Starting from Aspose.Cells version 22.10.1 for .NET 6+ platforms, SkiaSharp was introduced to enhance compatibility for non-Windows environments. To ensure optimal functionality and long-term compatibility, we kindly recommend upgrading to .NET 6 (or later) and updating Aspose.Cells to a newer version that fully supports SkiaSharp on Linux, while also deploying the necessary native assets appropriately.

1 Like

@ragu2736,
Regarding Aspose.Slides for .NET: prior to version 25.3, on non-Windows platforms, you needed to use the .NET Standard 2.0 DLL from the Aspose.Slides ZIP package.

Recently, we updated the System Requirements information.

1 Like

Thanks for the clarification regarding the SkiaSharp compatibility with Aspose.Words 21.6.

After downgrading the SkiaSharp and SkiaSharp.NativeAssets.Linux packages to version 2.80.3, our application started loading properly on Linux. However, we are now facing a new issue during the file conversion and stamping jobs.


Environment Details

  • .NET Core Version: 3.1
  • OS: Linux (Amazon Linux 2)
  • Aspose Versions:
    • File Conversion → Aspose 21.6
    • Stamping → Aspose 22.12.0
  • SkiaSharp Versions: 2.80.3 (with SkiaSharp.NativeAssets.Linux 2.80.3)

Current Workflow

  1. FileConversion job → Converts files to PDF using Aspose 21.6.
  2. Stamping job → Processes the converted PDFs using Aspose 22.12.0.

Both projects target .NET Core 3.1.

FileConversion.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspose.PDF" Version="21.6.0" />
    <PackageReference Include="Aspose.Words" Version="21.6.0" />
    <PackageReference Include="Aspose.Cells" Version="21.6.0" />
    <PackageReference Include="Aspose.Email" Version="21.6.0" />
    <PackageReference Include="Aspose.Imaging" Version="21.6.0" />
    <PackageReference Include="Aspose.Slides.NET" Version="21.6.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.5" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.32" />
    <PackageReference Include="SkiaSharp" Version="2.80.3" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.3" />
  </ItemGroup>
</Project>

StampingJob.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.1.3" />
    <PackageReference Include="PdfSharp.Core" Version="1.0.0" />
    <PackageReference Include="PdfiumViewer" Version="2.13.0" />
    <PackageReference Include="AWSSDK.Textract" Version="3.7.501.4" />
    <PackageReference Include="Aspose.PDF" Version="22.12.0" />
  </ItemGroup>
</Project>

Observations on Linux

  • When we trigger the file conversion or stamping jobs, the server unexpectedly restarts.
  • Hangfire marks the jobs as completed, but the actual conversion/stamping does not occur.
  • Initially, we encountered the following error in the logs (shown below).
  • After installing native dependencies, the error disappeared — but the conversion and stamping still do not execute properly.

Commands Executed

sudo yum install -y cairo cairo-devel pango pango-devel freetype freetype-devel libpng libpng-devel
sudo yum install -y skia-sharp

After these installations, no further SkiaSharp errors appeared in logs, but the jobs silently fail and trigger a system restart.


Log Snippet

Below is the relevant portion from our logs before we installed the native dependencies:

System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies.
   at SkiaSharp.SkiaApi.sk_version_get_milestone()
   at SkiaSharp.SkiaSharpVersion.get_Native()
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
   at SkiaSharp.SKObject..cctor()
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies.
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaApi.sk_version_get_milestone()
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaSharpVersion.get_Native()
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal mis-wf[2868]: at SkiaSharp.SKObject..cctor()

After installing cairo, pango, freetype, and skia-sharp packages, this error stopped occurring — but now both file conversion and stamping jobs are not actually processing, and the Linux server restarts during the operation.

On Windows, everything works as expected.


Request for Guidance

Could you please advise on the following points:

  • Are there any additional native dependencies or environment configurations required for SkiaSharp or Aspose to work reliably on Linux?
  • Could mixing Aspose 21.6 (for conversion) and Aspose 22.12 (for stamping) within the same workflow cause any native or API conflicts?
  • Would upgrading both jobs to a consistent Aspose version (e.g., 22.12) help stabilize execution?

This issue is currently blocking our production workflow, so any immediate workaround or recommendation would be highly appreciated.

Thanks for the clarification regarding the SkiaSharp compatibility .

After downgrading the SkiaSharp and SkiaSharp.NativeAssets.Linux packages to version 2.80.3, our application started loading properly on Linux. However, we are now facing a new issue during the file conversion and stamping jobs.


Environment Details

  • .NET Core Version: 3.1
  • OS: Linux (Amazon Linux 2)
  • Aspose Versions:
    • File Conversion → Aspose 21.6
    • Stamping → Aspose 22.12.0
  • SkiaSharp Versions: 2.80.3 (with SkiaSharp.NativeAssets.Linux 2.80.3)

Current Workflow

  1. FileConversion job → Converts files to PDF using Aspose 21.6.
  2. Stamping job → Processes the converted PDFs using Aspose 22.12.0.

Both projects target .NET Core 3.1.

FileConversion.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspose.PDF" Version="21.6.0" />
    <PackageReference Include="Aspose.Words" Version="21.6.0" />
    <PackageReference Include="Aspose.Cells" Version="21.6.0" />
    <PackageReference Include="Aspose.Email" Version="21.6.0" />
    <PackageReference Include="Aspose.Imaging" Version="21.6.0" />
    <PackageReference Include="Aspose.Slides.NET" Version="21.6.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.5" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.32" />
    <PackageReference Include="SkiaSharp" Version="2.80.3" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.3" />
  </ItemGroup>
</Project>

StampingJob.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.1.3" />
    <PackageReference Include="PdfSharp.Core" Version="1.0.0" />
    <PackageReference Include="PdfiumViewer" Version="2.13.0" />
    <PackageReference Include="AWSSDK.Textract" Version="3.7.501.4" />
    <PackageReference Include="Aspose.PDF" Version="22.12.0" />
  </ItemGroup>
</Project>

Observations on Linux

  • When we trigger the file conversion or stamping jobs, the server unexpectedly restarts.
  • Hangfire marks the jobs as completed, but the actual conversion/stamping does not occur.
  • Initially, we encountered the following error in the logs (shown below).
  • After installing native dependencies, the error disappeared — but the conversion and stamping still do not execute properly.

Commands Executed

sudo yum install -y cairo cairo-devel pango pango-devel freetype freetype-devel libpng libpng-devel
sudo yum install -y skia-sharp

After these installations, no further SkiaSharp errors appeared in logs, but the jobs silently fail and trigger a system restart.


Log Snippet

Below is the relevant portion from our logs before we installed the native dependencies:

System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies.
   at SkiaSharp.SkiaApi.sk_version_get_milestone()
   at SkiaSharp.SkiaSharpVersion.get_Native()
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
   at SkiaSharp.SKObject..cctor()
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies.
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaApi.sk_version_get_milestone()
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaSharpVersion.get_Native()
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal x-x[2868]: at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
Oct 24 15:56:57 ip-x-x-x-x.us-east-2.compute.internal mis-wf[2868]: at SkiaSharp.SKObject..cctor()

After installing cairo, pango, freetype, and skia-sharp packages, this error stopped occurring — but now both file conversion and stamping jobs are not actually processing, and the Linux server restarts during the operation.

On Windows, everything works as expected.


Request for Guidance

Could you please advise on the following points:

  • Are there any additional native dependencies or environment configurations required for SkiaSharp or Aspose to work reliably on Linux?
  • Could mixing Aspose 21.6 (for conversion) and Aspose 22.12 (for stamping) within the same workflow cause any native or API conflicts?
  • Would upgrading both jobs to a consistent Aspose version (e.g., 22.12) help stabilize execution?

This issue is currently blocking our production workflow, so any immediate workaround or recommendation would be highly appreciated.[quote=“amjad.sahi, post:3, topic:320304, full:true”]
@ragu2736,

Regarding Aspose.Cells, since you are currently using .NET Core 3.1 along with an older version of Aspose.Cells (21.6.0), please note that at that time, the component relied on System.Drawing.Common instead of SkiaSharp. This may result in limited support on non-Windows operating systems. Starting from Aspose.Cells version 22.10.1 for .NET 6+ platforms, SkiaSharp was introduced to enhance compatibility for non-Windows environments. To ensure optimal functionality and long-term compatibility, we kindly recommend upgrading to .NET 6 (or later) and updating Aspose.Cells to a newer version that fully supports SkiaSharp on Linux, while also deploying the necessary native assets appropriately.
[/quote]

@ragu2736,

I think you should do:

  • We recommend upgrade both jobs to Aspose 22.12.0 (if you cannot upgrade to latest version (25.10)).
  • Try to use SkiaSharp 2.88.6 + NativeAssets.Linux.NoDependencies 2.88.6 (if possible).
  • Make sure to install fontconfig, harfbuzz, libjpeg-turbo on linux environment.
  • Restart and retest file conversion + stamping job.