My progress at porting Ladybird, the SerenityOS Browser

Hello everyone,
I have been waiting for this moment for months, after fixing the Ladybird ports on FreeBSD, OpenBSD and NetBSD and creating a port to OpenIndiana (a Solaris derivate).
Some of you maybe remember that there was a downstream port by @3dEyes at HaikuPorts a year ago already, but SerenityOS’ compiler requirements became higher so that we couldn’t build any newer version of it later.
Now with GCC 13 finally being available on Haiku, I started an attempt to build the latest Ladybird version on Haiku and made big progress already.
This time I’m trying to upstream my porting efforts, as I’ve done that for all other systems as well and the SerenityOS people seem quite welcoming to unusual systems (would be quite ironic if they weren’t, I mean they’re also building a niche OS from scratch).

I’ve already created a draft pull request with my work from the last two days: [WIP] Everywhere: Add support for the Haiku platform by nipos · Pull Request #20808 · SerenityOS/serenity · GitHub
At the current state, Ladybird builds successful and even opens its main window, but the WebContent process immediately crashes without any useful error message, so I have no idea what’s going wrong here.
I’m sure it’s trivial to fix at this point, for the other systems only minor patches were required and I’ve already done all of them for Haiku as well.
There must only be some little thing I’m missing…

Here’s the console log from running Ladybird:

~/serenity> ninja -C Build/ladybird run
ninja: Entering directory `Build/ladybird'
[0/2] Re-checking globbed directories...
[0/1] cd /boot/home/serenity/Build/ladybird && /boot/system/bin/cmake -E env SERENITY_SOURCE_DIR=/boot/home/serenity /boot/home/serenity/Build/ladybird/bin/ladybird
IPC::ConnectionBase (0x0000121bf1f1a3c0) had an error (sendmsg: Socket is not connected (errno=-2147454946)), disconnecting.
WebContent process crashed!
QSocketNotifier: Invalid socket 11 with type Read, disabling...
Failed to parse a message
Local endpoint error: recvmsg: Bad file descriptor (errno=-2147459072)
Peer endpoint error: Endpoint magic number mismatch, not my message!
ConnectionFromClient(0x000010af7dead500) (id=1) had an error (send: Broken pipe (errno=-2147459059)), disconnecting.
ConnectionFromClient(0x00001209921c5500) (id=1) had an error (send: Broken pipe (errno=-2147459059)), disconnecting.

I’m happy if anyone has ideas what could be causing the crash and how it can be fixed?
Otherwise I’ll keep experimenting with that thing in my spare time, I really want to get this to work.

If you want to try it out yourself:

git clone https://github.com/nipos/serenity
git checkout add_haiku_platform
cmake -GNinja -S Ladybird -B Build/ladybird
cmake --build Build/ladybird
ninja -C Build/ladybird run

Qt6 and its _devel packages, as well as GCC 13 must be installed for that to work.

27 Likes

Is this on beta4 or up to date nightlies? Support for unix domain sockets improved a lot recently (because they are used also in the .net port).

3 Likes

It’s on Beta4.
I didn’t see any missing socket features (that should have resulted in build errors) but maybe some do not work good enough for the WebContent process to run.
I will retry that on my Laptop with the latest Nightly soon.

5 Likes

Not everything results in a build error, in this case R’m fairly sure it won’t. For example it was not possible to use SOCK_DGRAM and AF_UNIX together

2 Likes

@3dEyes also reached this stage and may give a tip or two regarding the current blockers.

3 Likes

Previous – HDS available – version were installed at me - I installed all bvrowsers of Haiku , those available in package except ancient Firefox and maybe Falkon as I had not found it for Haiku 32 bit.

It is really cute browser - who likes minimalistic those can be very happy.
First I thought it is ideal for offline content reading … but later I’ve seen how much tool for web page development and test integrated in it !..
This way a classic style web developer also can be happy with it. Very developer alike …

I’m quite courious how it is after improvement - so what are the new features. However HTML5 test crashed the browser right now (if someone interested, I can send in mail the crash report file. Once again : this is for the earlier version !).
I just became courious how it rolls with HTML5 features - well it was quite surprise that it had crashed of it …

I’m going to install it if Haiku 32bit version would be available as well.

Guys,
I wish a successful building anyway !.

Kudos !

1 Like

I tried it on my laptop with nightly yesterday.
Took 4 hours to compile there (old Intel Pentium dual-core).
At that try,first the WebContent process crashed and then Ladybird crashed as well.
Then I retried it on my computer using exactly the source from my pull request and the same happened.
Looks like I forgot to copy&paste something when I cleaned up my work and split it into multiple commits.

1 Like

It works!


After manually copying the patch I’ve overlooked,which was just a single line,but a very important one,over to my laptop,Ladybird does now run and display websites just fine.
The web standard support is not enough for using this forum yet,but the Haiku webpage looks nice here already.

39 Likes

Actually, Andreas spent some time fixing issues in Ladybird to make Haiku website displaying more or less properly https://twitter.com/awesomekling/status/1678817238655160320

14 Likes

Dear @nipos ,

Could you paste the URL …

https://html5test.com/

… into Ladybird browser - your actual one - and make a screenshot about results ?

I did it with earlier released version and got 232 points as a result, but the report details rendering was a mess, unfortunately.
I’m really curious about rendering the page - not really the score itself.

Had it been improved or not ?

Thank you in advance -

1 Like

Latest Ladybird:

27 Likes

Thank you very much, @3dEyes
It had improved a lot …

EDIT:
I hope 32bit version …
once it would hit HaikuDepot -

2 Likes

The simplest native UI for Ladybird (no Qt, only Haiku API):

24 Likes

That looks great! :smiley:
Creating a native UI for it was my next plan after getting the patches upstreamed.
Now with Ladybird supporting different UIs anyway (besides Qt,there’s now also one for MacOS AppKit),it should be rather easy to add even more.

3 Likes

Maybe it would be more logical to make a liblagom package with the SerenityOS library set? And separate browser packages that use it? Qt’s LadyBird, native UI, etc.

The Serenity codebase is a very fast moving target,so I always try to get my work accepted upstream.
If I create a Haiku-native browser on top of their LibWeb in a separate Git repository,it will likely stop working in only a few days if I don’t catch up with their changes fast enough.
If I get the BeAPI UI accepted,you’ll still be able to build the Qt UI on Haiku,it’s only a switch in a CMake file.
Speaking of Haiku HPKG packages,I don’t plan to create any,actually.
SerenityOS doesn’t have any release numbers yet and it’s moving and improving very fast,so that a package taken from a Git commit will be outdated very soon.
If anyone else wants to package it,feel free to do so,but I recommend building it directly from the master branch,as the SerenityOS project also recommends.

3 Likes

I also have a problem with the on_ready_to_paint collback. It is never called for me. Although for example on_title_change always comes and the window title changes correctly. At the moment the image is redrawn by timer once per second (temporary workaround).

It doesn’t matter where the native Haiku UI code will be, it will still need to be patched behind the API changes. Whether in the Serenity upstream or in a separate project. I prefer to work separately because I don’t have to go through long code approvals before merging. At least until the stable release.

Sure,the question is who does the changes.
For code directly in the SerenityOS repo,it seems that those who make breaking changes often also unbreak other parts of the project that are affected by the change.
If the affected code is in another repository,the break will go unnoticed and I’ll have to clean it up when I notice it later.
The long code approvals are really a bit annoying,but they often give good hints for making my code better (and I’m not a C++ expert,so I’m thankful for that).

1 Like

No one is stopping us from doing two separate projects and sharing experience and looking for each other’s mistakes. I originally wanted to make a browser visually similar to NetPositive from BeOS and error messages in the form of haiku. Ha ha - and call it LadyPositive.

12 Likes