C#: building GtkSharp with lang/dotnet and cake

Background: The first roadblock of porting Ryujinx is the failing initialization of Gtk. It uses GtkSharp, a C# wrapper for Gtk. The problem is in Source/Libs/Shared/FuncLoader.cs, where it loads the shared library which includes dlopen. It uses different libraries for different platforms, e.g. kernel32.dll for Windows or libdl.so.2 for Linux. Eight months ago it gained "support for unknown unix", which loads libc. This is the program path FreeBSD would take. The problem is that Ryujinx uses a local copy of GtkSharp which it hasn't updated in two years and therefore doesn't include the unix addition. Before I approach upstream I want to compile and test a newer GtkSharp with Ryujinx myself.

Problem: The build of GtkSharp fails and I am a bit clueless, because I'm still not proficient with the C#/dotnet toolchain. I follow the build instructions:
Code:
git clone https://github.com/GtkSharp/GtkSharp.git gtksharp
cd gtksharp
dotnet tool restore
dotnet cake build.cake
I get:
Code:
No scripts found at /usr/home/user/gtksharp/CakeScripts/GAssembly.cake.
No scripts found at /usr/home/user/gtksharp/CakeScripts/Settings.cake.
No scripts found at /usr/home/user/gtksharp/CakeScripts/TargetEnvironment.cake.
No scripts found at /usr/home/user/gtksharp/CakeScripts/GAssembly.cake.
No scripts found at /usr/home/user/gtksharp/CakeScripts/Settings.cake.
No scripts found at /usr/home/user/gtksharp/CakeScripts/TargetEnvironment.cake.
Error: Failed to install addin 'Cake.FileHelpers'.

The question is: am I missing something obvious, like some environment variable I need to set, or is there some FreeBSD related incompatibility? Does somebody have a better insight in C# and cake?
 
The underlying problem is that Cake does not know that FreeBSD exists as it builds against NETStandard 2.1 and lacks explicit detection for it on newer standards.

I have PR to resolve that issue but be aware many third party tools/projects also do not know about FreeBSD and will need specific patching to resolve. This can get rather complicated.

As an example from Cake itself:
To build Cake you need a tool called GitVersion (which does not know about FreeBSD as it uses Cake!) which uses Lib2GitSharp (which does not know about FreeBSD) which is a dotNET wrapper for Lib2Git which, while there is a FreeBSD version in ports, is not built from Lib2Git.NativeBinaries as there are no FreeBSD runners on Github and the build flow uses a standalone Windows NuGet binary to bundle the libraries from Lib2Git.NativeBinaries for consumption.

Once all of that is resolved you can actually get Cake to dogfood!
 
The underlying problem is that Cake does not know that FreeBSD exists as it builds against NETStandard 2.1 and lacks explicit detection for it on newer standards.

I have PR to resolve that issue but be aware many third party tools/projects also do not know about FreeBSD and will need specific patching to resolve. This can get rather complicated.

As an example from Cake itself:
To build Cake you need a tool called GitVersion (which does not know about FreeBSD as it uses Cake!) which uses Lib2GitSharp (which does not know about FreeBSD) which is a dotNET wrapper for Lib2Git which, while there is a FreeBSD version in ports, is not built from Lib2Git.NativeBinaries as there are no FreeBSD runners on Github and the build flow uses a standalone Windows NuGet binary to bundle the libraries from Lib2Git.NativeBinaries for consumption.

Once all of that is resolved you can actually get Cake to dogfood!

Thank you for your explanations! Yeah I feared it wouldn't be that easy.
 
Tested with lang/dotnet version 9.0.0_2. Installing Cake 5.0.0 with dotnet tool install cake.tool. The original error doesn't occur anymore, unfortunately there's a new error when building with dotnet cake build.cake:
Code:
The assembly 'Cake.FileHelpers, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null'
is referencing an older version of Cake.Core (2.0.0).
For best compatibility it should target Cake.Core version 5.0.0.
The assembly 'Cake.Incubator, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'
is referencing an older version of Cake.Core (2.0.0).
For best compatibility it should target Cake.Core version 5.0.0.
Error: Could not load type 'Cake.Common.Tools.DotNetCore.Test.DotNetCoreTestSettings' from assembly 'Cake.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null'.
Need to dig further, but because of the discontinuation of Ryujinx my motivation is not as high anymore...
 
Need to dig further, but because of the discontinuation of Ryujinx my motivation is not as high anymore...
I love Ryujinx very much and I love FreeBSDs simplicity and efficiency so, I have very high motivations to port it over to FreeBSD 14.x onwards.
Once tested and completed, I am going to continue to maintain it.
Although almost perfect for the most part of games, there are still games like Mario & Luigi: Brothership, Xenoblade 3, and Super Mario Party Jamboree, which needs to be fixed.
 
bsdcode, didier, nxjoseph
I got the chance yesterday to securely talk to GDK Chan the founder of the Ryujinx Switch emulator.
Since he worked on the Core stuff mainly, he cannot say anything about GTK3, but he recommended to try the headless version first, then the GTK3 stuff.
For the headless version only devel/sdl20 is needed.

Now here comes the problem.
He initially developed Ryujinx for windows, then ported it to Linux.
That means, Application Binary Interfaces, and platform specific memory management syscalls needs to be created for FreeBSD.
He would recommend to tackle that first, rather than a pretty GUI.
Since ABIs, and platfrom speficic memory management syscalls are already present for Linux, it would not be so hard to translate them to FreeBSD, I guess.

On a sidenote.
I cannot guarantee it, but I am trying to get some of the old members together to revive with me the emulator, making the whole project my responsibility.
Posting any new emu updates under my name.

I will do everything for Ryujinx !!!
It took me very long to find GDK Chan, and convincing him to share his knowledge was not easy....
He recommended me to contact rip in peri peri, a member which did many important things like writing the Vulkan, OpenGL backends, managing memory, etc, and left me some ways to contact him.

Ok...
Right now, I am finishing the Absolute FreeBSD book from Michael W. Lucas.
My FreeBSD system is almost ready for day to day usage, I only started since January 31st to familiarize myself with FreeBSD so, it was not easy at all.
But thanks to the forum, I got many things working faster than I could imagine.

Since there is now a lead about how to port the emulator over, I have now some questions.
Regarding ABIs, and platform specific memory management syscalls, which resource, book ?, you could recommend me ?
I thought about: Design and Implementation of the FreeBSD Operating System.
But maybe there are more better resources, books for fulfilling the purpose.

If you like, you could of course, too, try to work on the emulator.
It is not that I am insisting on doing everything myself :)
Afterall the more people behind a project, the better the project will be.
And humans are always the driving force behind things, like rip in peri peri said, before Ryujinx shutdown.
 
Back
Top