As some of you may know/remember, in the last few months I’ve been trying on and off to port OpenRCT2, an engine capable of running Rollercoaster Tycoon 1 & 2 on modern OSes.
Lol, such a weird thing to happen.
But yeah, sure, here is the debug report and these are the patches used to build it.
I don’t think the issue is in the patches themselves, but maybe there’s bits of code that are needed but skipped on Haiku?
Anyway, in order to build it it has to be compiled with a recent clang version (19 is known to work) and nlohmann_json has to be patched or rolled back (3.12 has a bug that prevents compilation)
I haven’t tried building it with gcc recently but iirc that’s not supposed to work.
Sort of related, I have built myself a patched nlohmann_json to get rid of the bug but I’m not sure it’s haikuports material. The same patch will be included in nlohmann_json’s next release either way.
That would actually be GCC and libstdc++ implementation, as far as I know, we make no change to that code on Haiku side. And it’s the same code that everyone else uses as well.
Did you try using the guarded heap? Something like this:
I doubt it, on that front it’s actually one of the more stable SDL2 ports I’ve seen. Not everything works (“actual” fullscreen can crash) but its window can resize any way you want without crashing and that tends not to work usually.
I just ran a debug build through the guarded heap and the log does display some extra information this time around: I put it up here
This indicates pretty clearly that OpenRCT is performing a use-after-free. It looks like there might be a race of some sorts (note the freeing thread is different from the allocating thread.)
Haiku’s main malloc implementation is (now, on the nightlies) based on OpenBSD’s. Does OpenRCT2 run on OpenBSD? You can check if the same problem happens there.
As far as I know, gcc supports both ABI at the same time since this was introduced in gcc5. I don’t see any patches remaining that would force the old configuration (which would fail building a lot of things in modern c++ anyways). So I assume the migration to the new ABI has been completed a long time ago?
Maybe we should change that, at least for new architectures like RISC-V and ARM?
I’m not sure it would make any difference to the RCT2 crash, since that just changes the internal layout of the classes. It will just make things slower, but user code shouldn’t be poking at the internal of the string class.