SkiaSharp
SkiaSharp copied to clipboard
[FEATURE] linux-bionic flavor of libSkiaSharp and libHarfBuzzSharp
Description
e.g. https://nuget.info/packages/SQLitePCLRaw.lib.e_sqlite3/2.1.11 doesn't have runtimes/linux-bionic . Something can be done for SkiaSharp. toolchains are available in modern ubuntu/debian, fedora and alpine.
for ref https://github.com/ericsink/cb/commit/fe4e4255c9ccd10e298ed5b0f1f47478fa34982a https://github.com/ericsink/SQLitePCL.raw/commit/685942a31a9e43db85366a719b3b30547f90ef79
ideally infra should be DRY'd so it's just a matter of adding a single line in shell or cake script for new platform: define_platform(dotnetArch, nativeArch, osName) {. ... expand ... } which will expand to rubberstamped stuff for clang -target .... e.g.
Code
existing
define_platform("arm64", "aarch64", "linux") define_platform("arm64", "aarch64", "linux-musl")
for this feature request
define_platform("arm64", "x64", "linux-bionic")
Expected Behavior
No response
Actual Behavior
No response
Version of SkiaSharp
3.116.0 (Current)
Last Known Good Version of SkiaSharp
2.88.9 (Previous)
IDE / Editor
Other (Please indicate in the description)
Platform / Operating System
Android
Platform / Operating System Version
- Android 16 (Termux)
Devices
Samsung Galaxy S25 Ultra
Relevant Screenshots
No response
Relevant Log Output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
We've found some similar issues:
- #3191 , similarity score: 92%
- #3197 , similarity score: 82%
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
Note: You can give me feedback by 👍 or 👎 this comment.
linux-bionic isn't riscv64, it is implementation of C library for Android, primarily needed in Termux
Thanks for the issue. Do you have any idea how to build this? We got some cross Compiling going for musl and resc, is there a bionic compiler for debian?
Do you have any idea how to build this?
Sorry I don't, I have no knowledge about C#
off-topic
there is a first class build script to build dotnet for bionic. https://github.com/termux/termux-packages/tree/8f1eba3b48/packages/dotnet9.0/build.sh for dotnet v9 https://github.com/termux/termux-packages/tree/d11fb6d078/packages/dotnet8.0/build.sh for dotnet v8 (Other build script for aspnetcore, runtime, tageting-pack etc. - https://github.com/termux/termux-packages/tree/d11fb6d078/packages/dotnet8.0 ) If you are curious how is dotnet packaged for linux-bionic , look at the scripts & Dockerfile in this repo https://github.com/termux/termux-packages/
If cross compiled binary/library won't run in bionic, I think I've the idea how get it fixed, we can use termux/termux-docker:latest docker
While there maybe assumption that android-{arch} is same as linux-bionic-{arch} , there is huge difference b/w them, android-{arch} is only Mobile .Net stack but linux-bionic-{arch} is Full .Net Stack, consider it equivalent to linux-{arch}
Thank you
https://github.com/OmniSharp/omnisharp-roslyn/pull/2653
Any progress?
I would like to request the maintainer to research https://github.com/termux/termux-packages/ for linux-bionic-{arch} build
@kasperk81
i'm not interested in linux-bionic, sorry.
We've found some similar issues:
your issue description is a copy of https://github.com/mono/SkiaSharp/issues/3191 where i was making a point to show how it's implemented elsewhere and you copied it to make a point how it is not implemented? weird
https://github.com/mono/SkiaSharp/issues/3197 is no different. both these requirements just happened to show up soon as i started the work. i'm not sure if this is some sort of a bot account campaign, but it's not rubbing me right
Hello Mr. @kasperk81 , I'm legit human, I'm not bot, I've genuine reasons for the request I'm requesting for linux-bionic-arm64 because I'm a package maintainer in termux and I'm trying to package jellyfin which has SkiaSharp dependency.
The reason for my copying the issue it that I've zero knowledge of .Net/C# I apologize for that.
That's why I'm begging for linux-bionic-arm64 build
#3197 is no different. both these requirements just happened to show up soon as i started the work. i'm not sure if this is some sort of a bot account campaign, but it's not rubbing me right
This issue for Chinese processor is bot, I can cofirm, he's a 50 cent army of Chinese Communist Party. They are From CCP to IT Cell to spread technology propaganda of Chinese products loongarch is made by CCP to attack Taiwan chip industry. Please ignore that issue, loongarch is a meme cpu
I hope you understand and can differentiate between a tech enthusiast and Chinese bot
Hello Mr. @kasperk81 , I'm legit human, I'm not bot, I've genuine reasons for the request I'm requesting for
linux-bionic-arm64because I'm a package maintainer in termux and I'm trying to package jellyfin which has SkiaSharp dependency.The reason for my copying the issue it that I've zero knowledge of .Net/C# I apologize for that. That's why I'm begging for
linux-bionic-arm64build#3197 is no different. both these requirements just happened to show up soon as i started the work. i'm not sure if this is some sort of a bot account campaign, but it's not rubbing me right
This issue for Chinese processor is bot, I can cofirm, he's a 50 cent army of Chinese Communist Party. They are From CCP to IT Cell to spread technology propaganda of Chinese products loongarch is made by CCP to attack Taiwan chip industry. Please ignore that issue, loongarch is a meme cpu
Really funny political joke
This comment comes from Loongson 3A6000. LoongArch is absolutely exist and being supported by Debian.
_,met$$$$$gg. shenmo-thunder@Amber-CE-SID
,g$$$$$$$$$$$$$$$P. ---------------------------
,g$$P"" """Y$$.". OS: Debian GNU/Linux trixie/sid loongarch64
,$$P' `$$$. Host: Loongson-3A6000-HV-7A2000-XA61200
',$$P ,ggs. `$$b: Kernel: Linux 6.6.80-loong64-4k-pagesize-gxde
`d$$' ,$P"' . $$$ Uptime: 5 hours, 17 mins
$$P d$' , $$P Packages: 462 (dpkg)
$$: $$. - ,d$$' Shell: bash 5.2.37
`$$b "-.__ Icons: deepin [GTK2/3]
`Y$$b Cursor: Adwaita
`Y$$. Terminal: bwrap
`$$b. CPU: Loongson-3A6000-HV (8) @ 2.50 GHz
`Y$$b. GPU: AMD Radeon R7 200 Series [Discrete]
`"Y$b._ Memory: 579.85 MiB / 15.58 GiB (4%)
`"""" Swap: Disabled
Disk (/): 64.97 GiB / 109.19 GiB (60%) - ext4
Disk (/host/boot/efi): 692.00 KiB / 299.39 MiB (0%) - vfat
Local IP (wlx000cb2106b8c): 192.168.123.31/24
Locale: zh_CN.utf8
Blaming others will not help your situation.
Keep away from political discussions, refuse fictional facts, and keep talking only about technology pls
Folks. I am disappointed.
I understand we all have our own options and beliefs and political affiliations. But, this is not the forum for the discussion or debate of them in any form.
SkiaSharp is a project to allow everyone to do great things on any hardware they chose from any manufacturer. Unless adding a CPU architecture is objectively evil and will cause harm to a human life, we should not attack individuals wanting to use it.
I would like to remind everyone here that you are potentially violating the code of conduct of SkiaSharp and .NET https://dotnetfoundation.org/about/policies/code-of-conduct
Please refrain from all non-technical and non-SkiaSharp discussions in this repository.
And now back to SkiaSharp and bionic.
We could potentially add bionic and since it is a distro more than an arch, we probably can just use some docker image?
If anyone has more info on bionic because my searches keep pushing the Ubuntu os version.
@mattleibow this is where 2,500 packages for linux-bionic-{arch} are built. They use this script in docker container to build packaged. More info can be found here Detailed instructions can be found here https://github.com/termux/termux-packages/wiki/Build-environment and https://github.com/termux/termux-packages/wiki/Building-packages Project repo - https://github.com/termux/termux-packages
another docker image
http://hub.docker.com/r/termux/termux-docker
Repo- https://github.com/termux/termux-docker
Someone had tried to run it in github actions - https://github.com/guijan/termux-on-gha
@rene-descartes2021 wonderful thank you very much. I was a package maintainer in termux-packages repo I was trying to package jellyfin(server) for android/termux which has libskiasharp.so & SQlitePCL.raw (libe_sqlite3.so) dependency. I'll try to build libe_sqlite3.so using vcpkg
@aicynide Ok that works. Sorry deleted my comment wasn't really sure it was appropriate solution on this forum. But yes, vcpkg works for me in Terumx without depending on natives distributed through NuGet as none I've seen have linux-bionic-{arch}.
@rene-descartes2021 SkiaSharp is interested to provide native libraries for linux-bionic-arm64 in NuGet.
@aicynide I'm using C# in Termux and I think the status-quo is that there are zero NuGet packages with native libraries for linux-bionic-{arch}. Personally I in general don't really like the idea and implications of packaging or consuming NuGet packages for native code (in the runtimes/subdirs). Though for managed code I think NuGet is great. Everyone has their own opinions though.
Rather than try to ask the maintainers of the many NuGet packages to package a linux-bionic-{arch} native library (bloating them up for everyone...), I've had great luck with vcpkg. I see there is a vcpkg port for skia, the .so outputs can be copied over the top of the SkiaSharp. This is what I've done for other NuGet packages lacking a linux-bionic-{arch} binary (typically shared library).
vcpkg in manifest mode won't work for C# (or any dotnet projects), I use it in classic mode. Sometimes I have to patch the port, and I had to make a patch to vcpkg to get it to work in Termux. See my patchfile gist link below for info on this.
git clone https://github.com/microsoft/vcpkg.git cd vcpkg wget https://gist.github.com/rene-descartes2021/31f0e05885538d7bf97d1631064b183f patch vcpkg.patch ./bootstrap-vcpkg.sh ./vcpkg install skiia --triplet=arm64-android-dynamic --clean-after-build vcpkg says to define the environmental variable VCPKG_ROOT to where it was cloned to.
Then in a YOURPROJECT.csproj.user file add a Content element for each native shared library, something like (this is what I did for libsodium which is just a native library, no managed code):
For me the skia port fails to compile a dependency, icu, and stops there. Needs some sort of patch to work in Termux. You can look at my patch in the above gist link to see what sort of changes to a port are typically necessary, typically just an edit to CMakeLists.txt, which could also be submitted upstream to either the vcpkg port or the upstream project (e.g. skia) to allow for compiling the library on Termux without error. When I encounter build problems I've looked in termux-packages before to see what adjustments to the port may need to be made to get it to compile on Termux.
vcpkg in classic mode has some limitations though, like inability to adjust features (i.e. configure flags), which requires a patch/fork of the port or manifest mode (but manifest mode not supported for C# or .NET really, I could write more on that but out-of-scope to this comment).
Dunno if you'd be interested in writing this approach somewhere for Termux users using dotnet.
The vcpkg skia is different to the skia used by SkiaSharp. There are custom apis and different changes to make the interop better.
With regards to bloat, I found a way that is even going to improve the current status https://github.com/mono/SkiaSharp/discussions/3210
And finally, bundling native binaries in nugets is the way we do things. Dotnet devs are lazy and anything other install is too much to do. 😂
The vcpkg skia is different to the skia used by SkiaSharp. There are custom apis and different changes to make the interop better.
With regards to bloat, I found a way that is even going to improve the current status #3210
And finally, bundling native binaries in nugets is the way we do things. Dotnet devs are lazy and anything other install is too much to do. 😂
https://github.com/mono/SkiaSharp/pull/3217