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

SkiaSharp.NativeAssets.Android contains a shared library 'libSkiaSharp.so' which is not correctly aligned #3025

Open
1 task done
bcaceiro opened this issue Oct 1, 2024 · 10 comments · May be fixed by #3096
Open
1 task done

Comments

@bcaceiro
Copy link

bcaceiro commented Oct 1, 2024

Is your feature request related to a problem?

Building a .net MAUI project with Skia gives these warnings

NuGet package 'SkiaSharp.NativeAssets.Android' version '3.0.0-preview.3.1' contains a shared library 'libSkiaSharp.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details

Describe the solution you would like

Alignment issues solved for .net 9

Describe alternatives you have considered

It's not ab locking issue, since it can compile, just to leave this into consideration

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mattleibow
Copy link
Contributor

@jonathanpeppers any thoughts on what this means?

@jonathanpeppers
Copy link
Member

This is the upcoming 16kb alignment requirement for Google Play, and probably Android 16 / API 36 next year.

@grendello were you looking at this for SkiaSharp?

@grendello
Copy link
Member

@jonathanpeppers I tried to, but couldn't build it locally and then I got distracted by other tasks. I'll try to look into it soon.

@mattleibow
Copy link
Contributor

Is there some compiler/linker flag? If this is a Google requirement, then I am sure the latest skia code will have it somewhere and I could find it with a code search and backport.

@grendello
Copy link
Member

Is there some compiler/linker flag? If this is a Google requirement, then I am sure the latest skia code will have it somewhere and I could find it with a code search and backport.

If building with the NDK r28 (not yet released), the 16k alignment would be enabled automatically. With older NDK versions, one has to pass the -Wl,-z,max-page-size=16384 flag to the compiler when linking (or -z max-page-size=16384 when invoking the linker directly)

You can find more details here and here

NateMerritt added a commit to BiblioNexusStudio/bible-well that referenced this issue Nov 20, 2024
There are no HarfBuzzSharp or SkiaSharp packages available which correctly use 16 kb alignment.  It looks like they should release in the future, though.  Using them will be a requirement to publish to Google next year.  See:
* mono/SkiaSharp#3025
* dotnet/android#9075
NateMerritt added a commit to BiblioNexusStudio/bible-well that referenced this issue Nov 20, 2024
* Add basic GitHub Action workflows to build/test pre and post-merge.

* Switch to Windows image which comes with more workloads pre-installed.

See https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#workloads-components-and-extensions.  Ubuntu doesn't have the android workload installed by default.

* Remove Desktop and Browser targets to improve build times.

* Ignore XA0141 warning.

There are no HarfBuzzSharp or SkiaSharp packages available which correctly use 16 kb alignment.  It looks like they should release in the future, though.  Using them will be a requirement to publish to Google next year.  See:
* mono/SkiaSharp#3025
* dotnet/android#9075

* Ensure necessary .net workloads are present during build.

* Create Release-Optimized build configuration for post-merge.

Use Release for PR pre-merge checks and Release-Optimized for post-merge deployment package builds.

* Attempt to reduce workload install time.
@mattleibow mattleibow reopened this Nov 26, 2024
@mattleibow mattleibow added this to the 3.118.0 milestone Nov 26, 2024
@maonaoda
Copy link

maonaoda commented Dec 2, 2024

Any news? Currently I can't start any page using SkiaSharp on the emulator that API over 35

    /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.7/tools/Xamarin.Android.Common.targets(2076,3): warning XA0141: NuGet package 'HarfBuzzSharp.NativeAssets.Android' version '7.3.0.2' contains a shared library 'libHarfBuzzSharp.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details
    /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.7/tools/Xamarin.Android.Common.targets(2076,3): warning XA0141: NuGet package 'SkiaSharp.NativeAssets.Android' version '3.118.0-preview.1.2' contains a shared library 'libSkiaSharp.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details
    /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.7/tools/Xamarin.Android.Common.targets(2076,3): warning XA0141: NuGet package 'HarfBuzzSharp.NativeAssets.Android' version '7.3.0.2' contains a shared library 'libHarfBuzzSharp.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details
    /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.7/tools/Xamarin.Android.Common.targets(2076,3): warning XA0141: NuGet package 'SkiaSharp.NativeAssets.Android' version '3.118.0-preview.1.2' contains a shared library 'libSkiaSharp.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details
    /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.7/tools/Xamarin.Android.Common.targets(2076,3): warning XA0141: NuGet package '<unknown>' version '<unknown>' contains a shared library 'libbarhopper_v3.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details
    /usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/35.0.7/tools/Xamarin.Android.Common.targets(2076,3): warning XA0141: NuGet package '<unknown>' version '<unknown>' contains a shared library 'libbarhopper_v3.so' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details

image

@NickDufour
Copy link

We are also encountering the 16 KB page size issue on Android 15 (API 35) with SkiaSharp when running our application on devices that require 16 KB paging

@mattleibow
Copy link
Contributor

@jonathanpeppers is this true? The sims won't even launch an app with non-aligned binaries?

@fntc
Copy link

fntc commented Dec 3, 2024

Tried it yesterday. Can confirm that the very same apk can launch in emulator with image V34 but not with V35. However, I have a few other native libraries the build process complains about

@mattleibow mattleibow changed the title [FEATURE] <.NET9> contains a shared library 'libSkiaSharp.so' which is not correctly aligned. SkiaSharp.NativeAssets.Android contains a shared library 'libSkiaSharp.so' which is not correctly aligned Dec 3, 2024
@mattleibow mattleibow linked a pull request Dec 3, 2024 that will close this issue
5 tasks
@grendello
Copy link
Member

@jonathanpeppers is this true? The sims won't even launch an app with non-aligned binaries?

Yes, they won't. However, in the emulator one can disable the 16k alignment (in x86_64 images at least)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready For Work
Development

Successfully merging a pull request may close this issue.

7 participants