Skip to content

[AOT] Native AOT support for X11 #20532

Closed
Closed

Description

@jeromelaban

Curent Bugs

  • In the Reviews tab, shows a difference: the NativeAOT build is missing numbers next to the "thumbs up" and "thumbs down" icons
  • Search doesn't work. You can go to the Search page, but entering text and pressing [ENTER] doesn't show results.

Runtime Comparisons

Uno.Sdk Runtime App Publish Size 1 Startup Times (s) 2 Notes
Uno.Sdk 6.6.0-dev.168 .NET 10 CoreCLR 3 unoplatform/uno.chefs@d54bceea 451M 3.31 user 0.46 system 3.57 total
Uno.Sdk 6.6.0-dev.168 .NET 10 NativeAOT 4 unoplatform/uno.chefs@d54bceea 534M 0.54 user 0.19 system 0.78 total
Uno.Sdk 6.6.0-dev.168 .NET 10 CoreCLR 5 unoplatform/Uno.Gallery@54a08b15 393M 1.24 user 0.16 system 1.93 total
Uno.Sdk 6.6.0-dev.168 .NET 10 NativeAOT 6 unoplatform/Uno.Gallery@54a08b15 429M 0.22 user 0.06 system 0.34 total
Uno.Sdk 6.6.0-dev.127 .NET 10 CoreCLR 3 unoplatform/uno.chefs@06f4f804 460556
450M
1.99 user 0.37 system 2.58 total
Uno.Sdk 6.6.0-dev.127 .NET 10 NativeAOT 4 unoplatform/uno.chefs@06f4f804 545684
533M
0.46 user 0.13 system 1.06 total
Uno.Sdk 6.6.0-dev.3 .NET 10 CoreCLR 3 unoplatform/uno.chefs@e838af94 459364
449M
2.03 user 0.25 system 2.10 total
Uno.Sdk 6.6.0-dev.3 .NET 10 NativeAOT 4 unoplatform/uno.chefs@e838af94 539952
528M
0.33 user 0.08 system 0.52 total Issues

Footnotes

  1. Size as reported by du -sk Chefs/bin/Release/net10.0-desktop/linux-x64/publish and du -sh Chefs/bin/Release/net10.0-desktop/linux-x64/publish, or du -sh Uno.Gallery/bin/Release/net10.0-desktop/linux-x64/publish ↩

  2. Time as reported by: /usr/bin/time "--format=%U user %S system %e total" Chefs/bin/Release/net10.0-desktop/linux-x64/publish/Chefs --exit or /usr/bin/time "--format=%U user %S system %e total" Uno.Gallery/bin/Release/net10.0-desktop/linux-x64/publish/Uno.Gallery --exit ↩

  3. Uno.Chefs CoreCLR Build command

    dotnet publish -c Release -r linux-x64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
      -bl Chefs/Chefs.csproj -p:UseSkiaRendering=true -p:SelfContained=true \
      -p:EmitCompilerGeneratedFiles=true "-p:CompilerGeneratedFilesOutputPath=`pwd`/_gen"
    
    ↩ ↩2 ↩3
  4. Uno.Chefs NativeAOT Build command

    dotnet publish -c Release -r linux-x64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
      -bl Chefs/Chefs.csproj -p:UseSkiaRendering=true -p:SelfContained=true \
      -p:SkiaPublishAot=true -p:IsAotCompatible=true -p:TrimmerSingleWarn=false -p:_ExtraTrimmerArgs=--verbose \
      -p:IlcGenerateMapFile=true -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMetadataLog=true \
      -p:EmitCompilerGeneratedFiles=true "-p:CompilerGeneratedFilesOutputPath=`pwd`/_gen"
    
    ↩ ↩2 ↩3
  5. Uno.Gallery CoreCLR Build command

    dotnet publish -c Release -r linux-x64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
      -bl Uno.Gallery/Uno.Gallery.csproj -p:UseSkiaRendering=true -p:SelfContained=true
    
    ↩
  6. Uno.Gallery NativeAOT Build command

    dotnet publish -c Release -r linux-x64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
      -bl Uno.Gallery/Uno.Gallery.csproj -p:UseSkiaRendering=true -p:SelfContained=true \
      -p:SkiaPublishAot=true
    
    ↩

Activity

  1. added theissue type on Jul 16, 2025
  2. changed the title [-][Skia] Native AOT support for X11[/-] [+][AOT] Native AOT support for X11[/+] on Nov 25, 2025
  3. jonpryor commented on Jan 23, 2026

    @jonpryor
    Contributor

    2026-01-23 State of Affairs

    Starting with unoplatform/uno.chefs@e838af9 and the following patch applied:

    diff --git a/global.json b/global.json
    index 6611d206..de610af3 100644
    --- a/global.json
    +++ b/global.json
    @@ -1,6 +1,6 @@
     {
       "msbuild-sdks": {
    -    "Uno.Sdk": "6.4.53"
    +    "Uno.Sdk": "6.6.0-dev.3"
       },
       "sdk": {
         "allowPrerelease": false

    Build for NativeAOT:

    dotnet publish -c Release -r linux-x64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
      -bl Chefs/Chefs.csproj -p:UseSkiaRendering=true -p:SelfContained=true \
      -p:SkiaPublishAot=true -p:IsAotCompatible=true -p:TrimmerSingleWarn=false -p:_ExtraTrimmerArgs=--verbose \
      -p:IlcGenerateMapFile=true -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMetadataLog=true \
      -p:EmitCompilerGeneratedFiles=true "-p:CompilerGeneratedFilesOutputPath=`pwd`/_gen"
    

    Run:

    ./Chefs/bin/Release/net10.0-desktop/linux-x64/publish/Chefs
    

    Interestingly (to me), it produces more fail messages than I see elsewhere:

    fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
          The [Pages] property getter does not exist on type [Chefs.Presentation.ShellViewModel]
    fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
          The [Pages] property getter does not exist on type [Chefs.Presentation.ShellViewModel]
    

    I don't see any UI or behavioral differences between the CoreCLR and NativeAOT builds due to these messages.

    Clicking on a recipe, then clicking the Reviews tab, shows a difference: the CoreCLR build shows numbers next to the "thumbs up" and "thumbs down" icons, while the NativeAOT build is missing those numbers.

    Linux doesn't support media playback.

    fail: Microsoft.UI.Xaml.Controls.MediaPlayerPresenter[0]
          The MediaPlayer extension is not installed. For more information aka.platform.uno/mediaplayerelement
    

    This happens with CoreCLR as well, so this is not a NativeAOT bug.

    Search doesn't work properly:

    • Go to the 🔍Search tab, type "mom", press [ENTER]
    • CoreCLR shows 1 result plus a link to that result.
    • NativeAOT shows "33 results" plus "An error occurred". No recipes are shown.

    After clicking around a bit, additional fail messages are printed:

    fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
          The [Count] property getter does not exist on type [System.Collections.Immutable.ImmutableList`1[System.Guid]]
    fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
          The [Search] property getter does not exist on type [Chefs.Presentation.SearchViewModel]
    
  4. jonpryor commented on Mar 11, 2026

    @jonpryor
    Contributor

    2026-Mar-10: Uno.Chefs State of Affairs

    Starting with unoplatform/uno.chefs@06f4f80 and using Uno.Sdk 6.6.0-dev.127:

    sed -i '' 's/"Uno.Sdk": ".*"/"Uno.Sdk": "6.6.0-dev.127"/g' global.json

    All previously mentioned issues have been fixed.

  5. jonpryor commented on Apr 14, 2026

    @jonpryor
    Contributor

    What about arm64?

    All my prior testing has been done within an x64 VM.

    Now that I have access to arm64 hardware, how do things fare in linux-arm64?

    The answer? Not immediately good.

    Starting with unoplatform/uno.chefs@d54bcee and using Uno.Sdk 6.6.0-dev.128:

    sed -i '' 's/"Uno.Sdk": ".*"/"Uno.Sdk": "6.6.0-dev.168"/g' global.json

    Build and run for linux-arm64:

    dotnet publish -c Release -r linux-arm64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
      -bl Chefs/Chefs.csproj -p:UseSkiaRendering=true -p:SelfContained=true \
      -p:SkiaPublishAot=true -p:IsAotCompatible=true -p:TrimmerSingleWarn=false -p:_ExtraTrimmerArgs=--verbose \
      -p:IlcGenerateMapFile=true -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMetadataLog=true \
      -p:EmitCompilerGeneratedFiles=true "-p:CompilerGeneratedFilesOutputPath=`pwd`/_gen"
    ./Chefs/bin/Release/net10.0-desktop/linux-arm64/publish/Chefs
    

    Note: building requires more than 2GB RAM; I built it on a VM with 8GB RAM.

    The app immediately crashes, in Skia:

    $ ./Chefs/bin/Release/net10.0-desktop/linux-arm64/publish/Chefs
    fail: Uno.UI.MediaPlayer.Skia.X11.X11MediaPlayerPresenterExtension[0]
          libvlc.so was not found. Therefore, MediaPlayerElement will not be available. Visit https://platform.uno/docs/articles/controls/MediaPlayerElement.html to learn more about the needed dependencies.
    Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
    ./Chefs/bin/Release/net10.0-desktop/linux-arm64/publish/Chefs: symbol lookup error: /home/parallels/Developer/src/unoplatform/uno.chefs/Chefs/bin/Release/net10.0-desktop/linux-arm64/publish/libSkiaSharp.so: undefined symbol: FT_Get_BDF_Property
    

    "Funnily enough", Jerome reported this on SkiaSharp already: mono/SkiaSharp#3229 (comment)

    I'm using an Ubuntu 24.04.3 VM, which appears to include libfreetype 6.20.1.

    $ find /usr/lib -iname \*freetype\*
    /usr/lib/aarch64-linux-gnu/libfreetype.so.6.20.1
    /usr/lib/aarch64-linux-gnu/girepository-1.0/freetype2-2.0.typelib
    /usr/lib/aarch64-linux-gnu/libfreetype.so.6

    This comment suggests that freetype2 2.15 or later is required.

    6.20.1 is newer than 2.15; what's going on here?

    Does the symbol exist?

    $ nm -D /usr/lib/aarch64-linux-gnu/libfreetype.so.6.20.1 | grep FT_Get_BDF_Property
    0000000000019020 T FT_Get_BDF_Property

    Yes.

    Yet apparently it's not found, presumably because libfreetype.so.6 isn't being loaded.

    We can force it to be loaded, via LD_PRELOAD. That works:

    LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libfreetype.so.6.20.1 ./Chefs/bin/Release/net10.0-desktop/linux-arm64/publish/Chefs
    # no crash!

    Thus, the question: why isn't libfreetype.so.6 loaded?

    Answer: because libSkiaSharp.so doesn't link against it!

    $ readelf -d /home/parallels/Developer/src/unoplatform/uno.chefs/Chefs/bin/Release/net10.0-desktop/linux-arm64/publish/libSkiaSharp.so | grep NEEDED
     0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
     0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [ld-linux-aarch64.so.1]

    Notably absent: libfreetype.so.6.

    This appears to be fixed upstream: mono/SkiaSharp#3494

    However, there have been no new releases which include that fix.

    If I check the build for a recent commit to mono/SkiaSharp@03f6d25: https://dev.azure.com/xamarin/public/_build/results?buildId=156657&view=results

    libSkiaSharp.so.132.0.0 does contain a NEEDED ref for libfontconfig.so.1, and libfontconfig.so.1 has a NEEDED ref to libfreetype.so.6, which contains the symbol:

    $ nm -D /usr/lib/aarch64-linux-gnu/libfontconfig.so.1 | grep FT_Get_BDF_Property
                     U FT_Get_BDF_Property
    
    $ readelf -d /usr/lib/aarch64-linux-gnu/libfontconfig.so.1 | grep NEED
     0x0000000000000001 (NEEDED)             Shared library: [libfreetype.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [libexpat.so.1]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
     0x0000000000000001 (NEEDED)             Shared library: [ld-linux-aarch64.so.1]
     0x000000006ffffffe (VERNEED)            0x4ad0
    
    $ nm -D /usr/lib/aarch64-linux-gnu/libfreetype.so.6.20.1 | grep FT_Get_BDF_Property
    0000000000019020 T FT_Get_BDF_Property
  6. jonpryor commented on Apr 14, 2026

    @jonpryor
    Contributor

    Earlier I said:

    However, there have been no new releases which include that fix.

    This is not true; the SkiaSharp.NativeAssets.Linux 3.119.3-preview.1.1 package contains the fix:

    % unzip skiasharp.nativeassets.linux.3.119.3-preview.1.1.nupkg runtimes/linux-arm64/native/libSkiaSharp.so
    % readelf -d runtimes/linux-arm64/native/libSkiaSharp.so | grep NEEDED
      0x0000000000000001 (NEEDED)       Shared library: [libpthread.so.0]
      0x0000000000000001 (NEEDED)       Shared library: [libfontconfig.so.1]
      0x0000000000000001 (NEEDED)       Shared library: [libdl.so.2]
      0x0000000000000001 (NEEDED)       Shared library: [libm.so.6]
      0x0000000000000001 (NEEDED)       Shared library: [libc.so.6]

    The workaround, then, is to build Chefs while referencing the SkiaSharp 3.119.3-preview.1.1 package. This can be done by setting the $(SkiaSharpVersion) MSBuild property:

    dotnet publish -c Release -r linux-arm64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
      -bl Chefs/Chefs.csproj -p:UseSkiaRendering=true -p:SkiaSharpVersion=3.119.3-preview.1.1 -p:SelfContained=true \
      -p:SkiaPublishAot=true -p:IsAotCompatible=true -p:TrimmerSingleWarn=false -p:_ExtraTrimmerArgs=--verbose \
      -p:IlcGenerateMapFile=true -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMetadataLog=true \
      -p:EmitCompilerGeneratedFiles=true "-p:CompilerGeneratedFilesOutputPath=`pwd`/_gen"
    

    With that change, the app launches without crashing, and without requiring LD_PRELOAD:

    $ ./Chefs/bin/Release/net10.0-desktop/linux-arm64/publish/Chefs
    $ time ./Chefs/bin/Release/net10.0-desktop/linux-arm64/publish/Chefs --exit
    …
    real	0m0.336s
    user	0m0.193s
    sys	0m0.074s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions