Bug 297316 - multimedia/jellyfin: Jellyfin unable to load shared library 'libHarfBuzzSharp'
Summary: multimedia/jellyfin: Jellyfin unable to load shared library 'libHarfBuzzSharp'
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Baptiste Daroussin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-08-06 19:22 UTC by Will
Modified: 2026-08-26 07:46 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (bapt)


Attachments
patch for libskiasharp to also build libharfbuzzsharp (3.39 KB, patch)
2026-08-06 19:22 UTC, Will
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Will 2026-08-06 19:22:24 UTC
Created attachment 273508 [details]
patch for libskiasharp to also build libharfbuzzsharp

Summary: Jellyfin fails to generate dynamic images containing text overlay. This is caused by a missing system font and a missing .NET wrapper for HarfBuzz (libHarfBuzzSharp). The issue is resolved by installing the dejavu font and building libHarfBuzzSharp via the libskiasharp port.

I've been using Jellyfin with VA-API acceleration in a jail for several months happily, so first: thanks for making that possible! I did run into one problem that I think might affect other folks, so I wanted to report it here in case that's correct. I know there's been recent Jellyfin work related to SkiaSharp in bug #290460, so also wanted to call that out up front.

I first noticed that Jellyfin was not automatically generating the images for my media groups: "Collections", "Movies", "Shows". On my previous Jellyfin host, which ran Linux, it would automatically generate an image for each media type, which notably included text overlaid on whatever artwork it randomly chose from the media type. Other artwork showed up just fine. I tracked down this error in Jellyfin's log whenever it tried to generate the problematic artwork:

>>>
[2026-07-10 01:15:26.695 -04:00] [ERR] Error in "Dynamic Image Provider"
System.ArgumentNullException: Value cannot be null. (Parameter 'typeface')
   at SkiaSharp.HarfBuzz.SKShaper..ctor(SKTypeface typeface)
   at SkiaSharp.HarfBuzz.CanvasExtensions.DrawShapedText(SKCanvas canvas, String text, Single x, Single y, SKTextAlign textAlign, SKFont font, SKPaint paint)
   at Jellyfin.Drawing.Skia.StripCollageBuilder.DrawText(SKCanvas canvas, Single x, Single y, String text, SKPaint textPaint, SKFont textFont, Boolean isRtl)
   at Jellyfin.Drawing.Skia.StripCollageBuilder.BuildThumbCollageBitmap(IReadOnlyList`1 paths, Int32 width, Int32 height, String libraryName)
   at Jellyfin.Drawing.Skia.StripCollageBuilder.BuildThumbCollage(IReadOnlyList`1 paths, String outputPath, Int32 width, Int32 height, String libraryName)
   at Jellyfin.Drawing.Skia.SkiaEncoder.CreateImageCollage(ImageCollageOptions options, String libraryName)
   at Jellyfin.Drawing.ImageProcessor.CreateImageCollage(ImageCollageOptions options, String libraryName)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.CreateCollage(BaseItem primaryItem, IEnumerable`1 items, String outputPath, Int32 width, Int32 height)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.CreateThumbCollage(BaseItem primaryItem, IEnumerable`1 items, String outputPath, Int32 width, Int32 height)
   at Emby.Server.Implementations.Images.CollectionFolderImageProvider.CreateImage(BaseItem item, IReadOnlyCollection`1 itemsWithImages, String outputPathWithoutExtension, ImageType imageType, Int32 imageIndex)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.FetchToFileInternal(BaseItem item, IReadOnlyList`1 itemsWithImages, ImageType imageType, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.FetchAsync(T item, MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken)
<<<

I resolved this by installing the "dejavu" package, but it was replaced by a new error:

>>>
[2026-07-11 01:45:02.966 -04:00] [ERR] Error in "Dynamic Image Provider"
System.DllNotFoundException: Unable to load shared library 'libHarfBuzzSharp' 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: 
Cannot open "/usr/local/jellyfin/libHarfBuzzSharp.so"
Shared object "libHarfBuzzSharp.so" not found, required by "jellyfin"
Cannot open "/usr/local/jellyfin/liblibHarfBuzzSharp.so"
Shared object "liblibHarfBuzzSharp.so" not found, required by "jellyfin"
Cannot open "/usr/local/jellyfin/libHarfBuzzSharp"
Shared object "libHarfBuzzSharp" not found, required by "jellyfin"
Cannot open "/usr/local/jellyfin/liblibHarfBuzzSharp"
Shared object "liblibHarfBuzzSharp" not found, required by "jellyfin"

   at HarfBuzzSharp.HarfBuzzApi.hb_blob_create(Void* data, UInt32 length, MemoryMode mode, Void* user_data, Void* destroy)
   at HarfBuzzSharp.HarfBuzzApi.hb_blob_create(Void* data, UInt32 length, MemoryMode mode, Void* user_data, Void* destroy)
   at HarfBuzzSharp.Blob.Create(IntPtr data, Int32 length, MemoryMode mode, ReleaseDelegate releaseProc)
   at HarfBuzzSharp.Blob..ctor(IntPtr data, Int32 length, MemoryMode mode, ReleaseDelegate releaseDelegate)
   at SkiaSharp.HarfBuzz.BlobExtensions.ToHarfBuzzBlob(SKStreamAsset asset)
   at SkiaSharp.HarfBuzz.SKShaper..ctor(SKTypeface typeface)
   at SkiaSharp.HarfBuzz.CanvasExtensions.DrawShapedText(SKCanvas canvas, String text, Single x, Single y, SKTextAlign textAlign, SKFont font, SKPaint paint)
   at Jellyfin.Drawing.Skia.StripCollageBuilder.MeasureAndDrawText(SKCanvas canvas, Single x, Single y, String text, SKPaint textPaint, SKFont textFont, SKTextAlign alignment)
   at Jellyfin.Drawing.Skia.StripCollageBuilder.DrawText(SKCanvas canvas, Single x, Single y, String text, SKPaint textPaint, SKFont textFont, Boolean isRtl)
   at Jellyfin.Drawing.Skia.StripCollageBuilder.BuildThumbCollageBitmap(IReadOnlyList`1 paths, Int32 width, Int32 height, String libraryName)
   at Jellyfin.Drawing.Skia.StripCollageBuilder.BuildThumbCollage(IReadOnlyList`1 paths, String outputPath, Int32 width, Int32 height, String libraryName)
   at Jellyfin.Drawing.Skia.SkiaEncoder.CreateImageCollage(ImageCollageOptions options, String libraryName)
   at Jellyfin.Drawing.ImageProcessor.CreateImageCollage(ImageCollageOptions options, String libraryName)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.CreateCollage(BaseItem primaryItem, IEnumerable`1 items, String outputPath, Int32 width, Int32 height)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.CreateThumbCollage(BaseItem primaryItem, IEnumerable`1 items, String outputPath, Int32 width, Int32 height)
   at Emby.Server.Implementations.Images.CollectionFolderImageProvider.CreateImage(BaseItem item, IReadOnlyCollection`1 itemsWithImages, String outputPathWithoutExtension, ImageType imageType, Int32 imageIndex)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.FetchToFileInternal(BaseItem item, IReadOnlyList`1 itemsWithImages, ImageType imageType, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.FetchAsync(T item, MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken)
<<<

It seems the issue here is Skia is trying to use HarfBuzz to do the text overlay, but lacks a .NET ("sharp") wrapper for HarfBuzz. (Apologies if I'm butchering the terminology here, I'm not super familiar with .NET.) The libSkiaSharp port provides such a wrapper for Skia, but there appears to be no equivalent to the libSkiaSharp port for HarfBuzz. Some searching led me to:

https://github.com/SnapXL/freebsd-libskiasharp3/blob/main/Makefile

...where someone modified graphics/libskiasharp to also build a HarfBuzz .NET wrapper. I tweaked this a bit to remove the jpeg-turbo part and just do the libHarfBuzzSharp build, and that seems to have resolved my original issue: Jellyfin is now able to generate the images with overlaid text as expected. I've attached my final diff of the libSkiaSharp port not as a proposed patch, but just to show how I resolved my issues. It may include some options that aren't strictly needed.

Zooming back out, I wanted to put forward a few questions here. I know these issues cross a couple different ports, so apologies for muddying the line between them but hopefully it's okay since they're intertwined here and they share the same maintainer:

1. Should Jellyfin declare a dependency on a font? My Jellyfin installation is in a jail that only runs Jellyfin, so it is perhaps more stripped-down than other people's and they happen to already have a usable font installed by something else. But it does seem like not having any usable font installed caused Jellyfin to error, so wanted to raise that.

2. Is my issue with missing libHarfBuzzSharp one that other people could experience? I was a bit surprised to not find evidence of other folks experiencing the same issue, so I wonder if this is somehow specific to me, though I'm unable to imagine why that would be.

3. If my issue is relevant to others, should we try to fix that? And if so, where? Adding libHarfBuzzSharp into the libSkiaSharp port like I did doesn't feel right to me, given that they're separate pieces of software and the non-.NET ports graphics/skia and print/harfbuzz are separate. So perhaps it should be its own, new port? Or is it reasonable to assume that anyone who needs libSkiaSharp would also need libHarfBuzzSharp, and thus makes sense to include?

Sorry to bring such a half-baked solution here, it just took some effort to find the solution so I wanted to start the conversation in case it can help other folks avoid the same trouble. I'm hoping the maintainer's greater expertise can help focus this into a smart path forward! Thank you for the help.
Comment 1 Jekyll Chen 2026-08-13 05:28:19 UTC
(In reply to Will from comment #0)
> 2. Is my issue with missing libHarfBuzzSharp one that other people could experience? I was a bit surprised to not find evidence of other folks experiencing the same issue, so I wonder if this is somehow specific to me, though I'm unable to imagine why that would be.

I'm glad to know it's not only me using jellyfin on FreeBSD and facing the same issue.

BTW, would you please check if you're also getting the error in the logs?
[2026-08-13 00:54:15.335 +08:00] [ERR] [52] Emby.Server.Implementations.Updates.InstallationManager: An error occurred while accessing the plugin manifest: "https://repo.jellyfin.org/files/plugin/manifest.json"
System.Net.Http.HttpRequestException: Operation timed out (sgp1.mirror.jellyfin.org:443)
 ---> System.Net.Sockets.SocketException (60): Operation timed out
Comment 2 Will 2026-08-13 17:24:08 UTC
(In reply to Jekyll Chen from comment #1)

I've checked my logs but am afraid I don't see those time outs when retrieving the plugin manifest. I searched for anything related and I do see these messages once a day:

[2026-08-12 20:41:10.090 -04:00] [DBG] "IntervalTrigger" fired for task: "Update Plugins"
[2026-08-12 20:41:10.090 -04:00] [DBG] Queuing task "PluginUpdateTask"
[2026-08-12 20:41:10.090 -04:00] [DBG] Executing "Update Plugins"
[2026-08-12 20:41:10.362 -04:00] [INF] "Update Plugins" Completed after 0 minute(s) and 0 seconds

My guess is that's the same call, except on my host it's working. Sorry that I don't have anything more helpful than that!

Just to confirm, are you seeing the same null typeface/missing libHarfBuzzSharp errors described in this bug?
Comment 3 Jekyll Chen 2026-08-14 00:56:23 UTC
(In reply to Will from comment #2)
> Just to confirm, are you seeing the same null typeface/missing libHarfBuzzSharp errors described in this bug?

Yes, exactly the same error here.

And thanks for checking the unrelated error for me.
Comment 4 Baptiste Daroussin freebsd_committer freebsd_triage 2026-08-24 09:48:52 UTC
First of all, good catch and thank you for the notice.

I have been able to reproduce here, but after investigation there is nothing used by jellyfin which is specific to libharfbuzzsharp, we actually don't have to use it, all the symbols used by jellyfin are satisfied by vanilla libharfbuzz.

What I have done locally is:
ln -sf /usr/local/lib/libharfbuzz.so /usr/local/jellyfin/libHarfBuzzSharp.so

Can you confirm this fixes the issue for you as well? if yes I will simply add this symlinks (and the dependencies on harfbuzz and dejavu) to the jellyfin port.
Comment 5 Baptiste Daroussin freebsd_committer freebsd_triage 2026-08-25 08:36:04 UTC
I have been able to test on several setups and it fixes the issue. thanks for reporting
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-08-25 08:36:16 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fbe153d008a822eb0d28aa1edd5b3453b87094ba

commit fbe153d008a822eb0d28aa1edd5b3453b87094ba
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-08-24 13:41:51 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-08-25 08:35:13 +0000

    multimedia/jellyfin: fix text rendering

    Jellyfin uses libHarfBuzzSharp.so to render text on thumbnails, like
    it uses libskiasharp. After analyses it appears nothing in jellyfin
    is calling any symbols out of the symbols exposed by vanilla
    libharfbuzz.so, instead of building a full libHarfBuzzSharp.so, just
    resuse the share libarfbuz.so create a symlink in a place where jellyfin
    will be able to dlopen it.

    PR:             297316
    Reported by:    freebsd.geography231@slmails.com

 multimedia/jellyfin/Makefile  | 5 +++++
 multimedia/jellyfin/pkg-plist | 1 +
 2 files changed, 6 insertions(+)
Comment 7 Matthew Wener 2026-08-25 17:23:27 UTC
(In reply to commit-hook from comment #6)
Building this version failed on my set up in run depends:

[151Ramd64-HEAD-job-06] Installing harfbuzz-14.2.1...
the most recent version of harfbuzz-14.2.1 is already installed
===>   jellyfin-10.11.11_1 depends on executable: libharfbuzz.so - not found
*** Error code 1
Comment 8 Will 2026-08-26 07:46:11 UTC
I can confirm that removing my alterations and adding just the link you suggested works, I do not experience my issue. I also updated my ports tree and built Jellyfin from that and confirmed that also works, no issue. I noticed there was a commit titled “fix the harfbuzz dependency” two hours ago, perhaps that’s why I didn’t experience the build error Matthew did?

Thanks very much for the fix!