32bit linux now works again using pas2c.
A bit of history. With Hedgewars 0.9.23, we shifted to SDL2. While there were a fair # of SDL2 related issues that had to be addressed, there was one we didn't notice. Unbeknownst to us, FreePascal had an alignment bug. This was triggered by a CPU feature detection in SDL2 which could not be disabled, causing instant crashes.
It took a while for us to be aware of this since there aren't many 32 bit linux users, and many of them were on a long-term stable like Debian. Eventually they caught up and the error report feedback flooded in, this year in particular with 0.9.24.
I did reply to many of these feedbacks, but Google tends to send my emails to the Spam folder (which GMail users never check), so I got few responses.
With 0.9.25, we reenabled pas2c. What is pas2c? It was a tokeniser written in Haskell long ago by unc0rr to support the emscripten toolchain. At the time it went something like this. Pascal source —(Haskell tokeniser)→ C sources —(Clang)→ LLVM —(Emscripten)→ Javascript.
This worked, and we got an actual playable hedgewars in web browsers. Unfortunately the project has not been maintained.
Fortunately, pas2c still exists, so after some tweaking of the source code and fixing a few errors, it was usable once more for build purposes. You can use it to target any platform clang supports, extending the supported platforms for distros quite a bit.
We also attempted to force-enable it in CMakeLists.txt for 32 bit linux - you can see that here:
https://hg.hedgewars.org/hedgewars/file/06672690d71b/CMakeLists.txt#l72
The upshot is that Haskell is now a required dependency for 32 bit linux builds. The good news is that clang is a bit better at optimisation than FreePascal, so in general things load and run faster if you build using pas2c. AI thinks faster etc.
Hopefully the FreePascal bug is eventually addressed upstream, although at present the engine is being rewritten in Rust anyway.
https://hg.hedgewars.org/hedgewars/file/tip/rust
... an addendum since this came up in the Gentoo release (which is now behind Slackware, Ubuntu, Debian, Fedora..)
Using pas2c for the 64 bit build is not recommended. This is a fallback mechanism, not as extensively tested, that we are using just to work around the bug above. We had to update the release tarball twice already to fix a screenshot crash and a haskell locale build problem. It is currently missing video recording and png screenshotting. It adds a haskell dependency which is not present if you aren't building the server. It *is* likely to perform a little better, but is still a "better than nothing" mechanism.
- nemo's blog
- Login or register to post comments
francot514
Hey good to know pas2c is a very useful for this cases.
zargul
Hedgewars is moving, and I'm falling behind!