My progress at porting Ladybird, the SerenityOS Browser

I think SerenityOS is mostly backporting compatible changes from the new Ladybird repo,but I don’t know for sure.
Maybe there will be bigger differences in the future,especially when the new Ladybird gets rewritten in another language,removing any compatibility to the SerenityOS project.
Don’t know what will happen with the SerenityOS version then,however,I mean if they’ll be able to keep up with changes of web standards alone.

after git clone, tried to build as under, as mentioned on git/serenityos…specifically for haiku

cmake -GNinja -S Ladybird -B Build/ladybird
cmake --build Build/ladybird
ninja -C Build/ladybird run

Build fails as shown below..

Cannot copy the content
6/2621: no directory: include <execinfo.h>



Are you using a current Nightly version or the Beta?
Ladybird only works on Nightly because it uses some features that have been added recently.

I am on latest Nightly.updated daily…as of today

I just retried it with a freshly cloned repo and again freshly updated OS and can’t reproduce this,sorry.
It hasn’t finished building yet,my computer is old and slow,but it’s well past the 6/2621 step where it failed for you.
The file execinfo.h is part of the system and should be at /system/develop/headers/execinfo.h - Can you please check that this file exists on your system?

Please also note that you need to run git am haiku-support.patch where haiku-support.patch is the file I shared above,before you run the cmake commands,or cmake --build will fail early.
Anyway,even without applying the patch I don’t get the execinfo.h error but something else.

1 Like

Will that really happen? I remember talks about designing a new language for Serenity a few years ago, that would just be basically a simpler/nicer syntax over the c++ subset that they use (kind of like Vala for C with glib). But I’m not sure anything happened eventually.

Is it the same idea in Ladybird now?

They did implement the language, called Jakt. At least the basics, I remember Andreas showing some examples on his Youtube channel. I think it got sidelined a bit when he started working on the browser that eventually became Ladybird.

I don´t think they will use Jakt for Ladybird, they already got enough on their plates I guess.
They did get some questions recently (after splitting Ladybird from SerenityOS) why it wasn’t written in Rust. Given Andreas’ outspoken preference for C++ I doubt they will switch to Rust and rewrite everything again. But that`s pure speculation on my side, of course. Let’s wait and see what happens.

All that we know of about a rewrite is this:

1 Like

How so? Almost every mainstream OS is written in C or C++ so they would be in the same boat surely?

I seem to recall (from back when it was announced) that this Jakt language was expected to “transpile” into C++ code and thus would not require them to change their underlying language. Nim already does this, and would perhaps also be a candidate. It is discussed in relation to Haiku here and even used for writing an OS.

Sorry,I was totally wrong with the assumption that the file is part of the system.
Just tried building Ladybird on another machine and hit the same error.
It’s part of the libexecinfo_devel package which is available at HaikuPorts.

Should I manually install this package from haikudepot?

Yes,install it and than the build should work.
Just retried it based on the latest commits,my last patchset still works with the latest source.

Ladybird is switching to Swift. What is the status of Swift on Haiku?

1 Like

Has Swift even been touched since 2017 on Haiku after the GSoC project porting it?

Oh,that’s not exactly great news,but I didn’t expect something great either.
I hoped that they’ll probably select Nim or something like that,with C++ binding support and already working on Haiku.
But I was quite sure that they’ll choose something from the GAFAM,and I’m a little bit happy that it’s at least not the Google crap (you shouldn’t have a major dependency on your biggest competitor,even if it’s open-source),but Swift being extremely focused on Apples own OSes probably won’t make things easy for us.
I wonder why they can’t just stay with C++,everyone already involved in the project must know C++ rather well and they have a lot existing code in that language.
Maybe it’s not hyped enough or something like that.

As far as I am concerned with my port,I don’t really care.
I’m already working with the sources from the Serenity repository,not the new Ladybird repository,and they’re backporting some of the changes,so it’s still maintained.
I’m still maintaining my patchset,and I will continue to do so,based on the changes from Serenity,not Ladybird.
I don’t expect big breaking changes here,so no need to worry.
It will most likely stay 100% C++ and free from external libraries.
I only hope that they’ll be able to keep up with the changes from Ladybird and backport everything to their C++ codebase…

It has been disabled

Let’s be honest, C++ just isn’t that great of a language, and Swift is indeed a very good replacement for it. It keeps the good ideas from C++ (and Objective-C, the two are quite similar) and solve several of the performance issues and typical errors that C++ makes easy to happen, as well as making the code simpler to write.

Just creating a class in C++, it seems quite simple, right? But you have to remember to disable default copy constructors and assignment operators, since the default generated code most likely won’t work. You have to add “const” everywhere possible because it is not the default (it would make so much more sense to add “mutable” where needed). Using safe pointers (unique_ptr or shared_ptr) is a bit more code than naked pointers. You need to explicitly initialize some things (such as integers) in constructors, but not others (such as objects which have a default constructor). If you use a unique_ptr it will be initialized to nullptr, but if you use a naked pointer, it will have a random value. This is just annoying and tedious.

If I were to start a new project, Swift would definitely be one of the languages I’d consider for it. By reading the documentation, you can see that the people who designed it have been getting hit by the same problems I encounter while working on Haiku and other C++ projects (while Rust was designed by mostly C developers, I think, which have a bit different set of problems to solve).

So, a reasonable and not very surprising choice.

12 Likes

3 posts were split to a new topic: Swift on and for Haiku

That’s very interesting. I had the impression that Rust was the more C++ like among the modern languages.

FWIW I understand from Wikipedia that Rust and Swift are contemporary of the mid 2010s; with Swift appearing in 2014 and Rust in 2015. As for whether one is more similar to C++ that is not something I am qualified to say.

I personally commend Ladybird in choosing to go against the current mindset in some quarters of “the answer is Rust, now what is the question”. Seeing how zealous people can get over such things I imagine that this must have set the cat amongst the pigeons for some of my fellow armchair followers of operating systems.

It might also be added that it is kind of ironic that Rust was developed by Mozilla specifically to write a browser and yet - despite its hype - is rejected for by Ladybird for this precise application.