.NET bindings to the Haiku API

The IDE should run, as it’s all Java based.

Hi @trungnt2910,
I tried to port CppSharp but I’m stuck on the last two steps (i.e. libStd-symbols.so does not build for some reason).
I also set up a Linux machine with the latest Ubuntu version but CppSharp doesn’t compile either, there are some errors while compiling LLVM perhaps due to the presence of gcc13 which doesn’t seem to be fully supported at the moment.
What is your exact setup of your Linux environment?

Having said that, do you have sometime to spend looking into the missing classes problem in the Haiku bindings?

Thanks!

What is your exact setup of your Linux environment?

It works on GitHub Actions ubuntu-latest, which is 22.04 LTS at the time of writing. Locally I used Ubuntu 23.04.

Having said that, do you have sometime to spend looking into the missing classes problem in the Haiku bindings?

I’ll see if I can find some time tonight.

1 Like

I have a fresh install of Ubuntu 23.10 on an old spare MacBook Air 2011.
There is no prebuilt llvm pack from CppSharp repo for Linux + GCC13 apparently so I had to clone and build from source which didn’t succeed.

On Haiku instead LLVM 18 builds fine but there must be a problem with the Premake scripts because the resulting Std-symbol.make is incomplete.

Moreover, if I inject the CppSharp deps on Haiku with nuget the generator project builds but crashes due to a missing assembly CppSharp.Generator.dll 1.1.0.0 while I have 1.1.5.x.

Initial analysis shows that CppSharp has indeed missed a few headers.

The API generator relies on a few “master includes”, such as this one for the Interface Kit.

The headers responsible for the missing classes (Layout.h) is not included in this master include.

So, we can actually get the list of headers already directly or indirectly included by the Interface Kit by running:

echo "#include <InterfaceKit.h>" | haiku_loader g++ -M -x c++ - | grep os/interface

(Assumes Linux with HyClone, for Haiku just remove haiku_loader)

Currently this gives:

trung@DESKTOP-5OCA2N2:~$ echo "#include <InterfaceKit.h>" | haiku_loader g++ -M -x c++ - | grep os/interface
 /boot/system/develop/headers/os/interface/Alert.h \
 /boot/system/develop/headers/os/interface/Window.h \
 /boot/system/develop/headers/os/interface/Rect.h \
 /boot/system/develop/headers/os/interface/Point.h \
 /boot/system/develop/headers/os/interface/Size.h \
 /boot/system/develop/headers/os/interface/View.h \
 /boot/system/develop/headers/os/interface/AffineTransform.h \
 /boot/system/develop/headers/os/interface/Alignment.h \
 /boot/system/develop/headers/os/interface/InterfaceDefs.h \
 /boot/system/develop/headers/os/interface/GraphicsDefs.h \
 /boot/system/develop/headers/os/interface/Font.h \
 /boot/system/develop/headers/os/interface/Gradient.h \
 /boot/system/develop/headers/os/interface/Bitmap.h \
 /boot/system/develop/headers/os/interface/Box.h \
 /boot/system/develop/headers/os/interface/Button.h \
 /boot/system/develop/headers/os/interface/Control.h \
 /boot/system/develop/headers/os/interface/CheckBox.h \
 /boot/system/develop/headers/os/interface/ColorControl.h \
 /boot/system/develop/headers/os/interface/Dragger.h \
 /boot/system/develop/headers/os/interface/Input.h \
 /boot/system/develop/headers/os/interface/ListItem.h \
 /boot/system/develop/headers/os/interface/StringItem.h \
 /boot/system/develop/headers/os/interface/ListView.h \
 /boot/system/develop/headers/os/interface/Menu.h \
 /boot/system/develop/headers/os/interface/MenuBar.h \
 /boot/system/develop/headers/os/interface/MenuField.h \
 /boot/system/develop/headers/os/interface/MenuItem.h \
 /boot/system/develop/headers/os/interface/SeparatorItem.h \
 /boot/system/develop/headers/os/interface/OutlineListView.h \
 /boot/system/develop/headers/os/interface/Picture.h \
 /boot/system/develop/headers/os/interface/PictureButton.h \
 /boot/system/develop/headers/os/interface/Polygon.h \
 /boot/system/develop/headers/os/interface/PopUpMenu.h \
 /boot/system/develop/headers/os/interface/PrintJob.h \
 /boot/system/develop/headers/os/interface/RadioButton.h \
 /boot/system/develop/headers/os/interface/Region.h \
 /boot/system/develop/headers/os/interface/Screen.h \
 /boot/system/develop/headers/os/interface/ScrollBar.h \
 /boot/system/develop/headers/os/interface/ScrollView.h \
 /boot/system/develop/headers/os/interface/Shape.h \
 /boot/system/develop/headers/os/interface/Shelf.h \
 /boot/system/develop/headers/os/interface/Slider.h \
 /boot/system/develop/headers/os/interface/StatusBar.h \
 /boot/system/develop/headers/os/interface/StringView.h \
 /boot/system/develop/headers/os/interface/TabView.h \
 /boot/system/develop/headers/os/interface/TextControl.h \
 /boot/system/develop/headers/os/interface/TextView.h

You might be interested in this: headers/os: Add missing Interface Kit includes (Id163e0e8) · Gerrit Code Review (haiku-os.org)

After this gets merged what we need to do is to dispatch a manual build of dotnet-haiku (and pray God that nothing breaks).

1 Like

I see. Thanks for taking care of this :hand_with_index_finger_and_thumb_crossed:
I’ll keep investigating on the issue with building CppSharp on Haiku. It would be awesome to build dotnet-haiku on Haiku itself.

2 Likes

The change is present in hrev57536; now waiting for the next nightly build…

1 Like

This branch should finally fix the missing classes issue.

Still waiting for #7377 to be resolved and merged though, otherwise builds will still fail.

2 Likes

That’s good news! Look forward to it.
In the meanwhile I managed to compile libStd-symbols.so on Haiku. Now the next step is to get the remaining managed part of CppSharp compiled and see if I can build the generator.

any news on this?

It’s merged now :slight_smile:
Sorry for the delay

2 Likes

No worries at all, thank you!

Changes have been pushed to master, but the GitHub Actions run was cancelled since I forgot that we need to wait until the hrev57570 nightly has been built.

4 Likes

New build has been released; you might want to try that.

It works! :confetti_ball:

11 Likes

Just one thing.
B_VERTICAL and B_HORIZONTAL are both available but I must pass Orientation.Vertical / Orientation.Horizontal to make it work:

BGroupLayout group = new BGroupLayout(Orientation.Vertical);

I’d expect that B_VERTICAL and B_HORIZONTAL are replaced by Orientation.Vertical and Orientation.Horizontal, respectively. Is that correct?

The constructor in C++ takes an enum orientation parameter, which is defined as:

Treatment of enum members has been documented by the workload:

Members of named enums have the B_ prefix removed. Their names are also converted to PascalCase to match C#'s convention.

B_VERTICAL and B_HORIZONTAL are also available, but as normal integers. In C#, integers cannot be implicitly converted into enums. However, something like this should still work in theory:

var group = new BGroupLayout((Orientation)B_VERTICAL);