gpt4 book ai didi

.net-core - 在 Linux 上使用 SkiaSharp 1.68 的 DllNotFoundException

转载 作者:行者123 更新时间:2023-12-03 22:12:03 25 4
gpt4 key购买 nike

在 Linux 上使用带有 .NET Core 2.2 的 SkiaSharp 1.68.0 并在尝试在 jpeg-memory-stream 上使用解码时出现此错误(相同的代码适用于 Windows):

System.TypeInitializationException: The type initializer for 'SkiaSharp.SKAbstractManagedStream' threw an exception. ---> 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_managedstream_set_delegates(IntPtr pRead, IntPtr pPeek, IntPtr pIsAtEnd, IntPtr pHasPosition, IntPtr pHasLength, IntPtr pRewind, IntPtr pGetPosition, IntPtr pSeek, IntPtr pMove, IntPtr pGetLength, IntPtr pCreateNew, IntPtr pDestroy)
at SkiaSharp.SKAbstractManagedStream..cctor()
--- End of inner exception stack trace ---
at SkiaSharp.SKAbstractManagedStream..ctor(Boolean owns)
at SkiaSharp.SKManagedStream..ctor(Stream managedStream, Boolean disposeManagedStream, Boolean owns)
at SkiaSharp.SKManagedStream..ctor(Stream managedStream, Boolean disposeManagedStream)
at SkiaSharp.SKCodec.WrapManagedStream(Stream stream)
at SkiaSharp.SKCodec.Create(Stream stream, SKCodecResult& result)
at SkiaSharp.SKCodec.Create(Stream stream)
at SkiaSharp.SKBitmap.Decode(Stream stream)

最内部的错误消息似乎是“没有这样的文件或目录”,这很奇怪,因为我正在解码内存流。这适用于 Windows,在我升级到 .NET Core 2.2 和最新的 SkiaSharp 之前,它已经在 Linux 上工作。

我已尝试按照错误消息中的建议设置 LD_DEBUG 环境变量,但这并没有太大作用。不知道真正将它设置为什么。尝试了“全部”,但这并没有产生更详细的日志。

找到了一个 thread这建议安装 SkiaSharp.NativeAssets.Linux 作为解决方案,但不幸的是这没有帮助。构建/发布时是否需要针对 Linux-x64 运行时?尝试了不同的组合,但无法检测到任何差异。 (我在 Linux 上的 Docker 文件中使用 dotnet cli 通过 ssh 和 putty 进行构建。几乎是由 VS:latest 生成的默认 Docker 文件)

另一个建议是安装 libSkiaSharp.so手动和 apt-get install libfontconfig1 ,但遗憾的是 apt-get 在 Synology DSM 上不可用。

最佳答案

安装 Linux 依赖 NuGet 包会解决这个问题SkiaSharp.NativeAssets.Linux.NoDependencies https://www.nuget.org/packages/SkiaSharp.NativeAssets.Linux.NoDependencies

关于.net-core - 在 Linux 上使用 SkiaSharp 1.68 的 DllNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53693042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com