Building dxx-rebirth in Haiku

I’ve been trying to figure out for a couple of days how to build the source of the DXX-Rebirth project, a F/OSS engine implementation of Descent I and II, under Haiku. However, I’m not very familiar with the Scons build system that the project uses for building.

All of the needed tools and libraries are available in HaikuPorts (full list on GitHub here), which is great, but I have to figure out how to add Haiku support into the Sconstruct file itself so that the build will succeed.

Can anyone share a pointer or two about how to work with Sconstruct files and adding Haiku support to one? I’d love to see DXX-Rebirth working in Haiku, and it would add to the growing list of games available for the platform.

Well, for starters, SCons is a Python library and the SConstruct file is a Python script that calls it. Python 3.x broke compatibility with Python 2.x so if you call SConstruct from the wrong version of Python that could cause problems. What version of Python are you using?

My Haiku VM has both Python 2.7.17 and Python 3.7.10 installed.

The issue isn’t the version of Python I have here; it’s declaring Haiku as a valid build host platform so that DXX-Rebirth can build. This is what happens currently when you run scons in Haiku:

~/dxx-rebirth> scons d1x-rebirth scons: Reading SConscript files ... ===== D1X-Rebirth v0.61.0 0.60.0-beta2-870-g0b141ea122a4 0b141ea122a4a5bd1d9cce546e5e3b26d2232a5b ===== ===== D2X-Rebirth v0.61.0 0.60.0-beta2-870-g0b141ea122a4 0b141ea122a4a5bd1d9cce546e5e3b26d2232a5b ===== scons: *** Invalid value for option host_platform: haiku1. Valid values are: ('darwin', 'linux', 'freebsd', 'openbsd', 'win32') File "/boot/home/dxx-rebirth/SConstruct", line 5331, in main

maybe this?

1 Like

Pull request created; hopefully all that was needed was adding haiku1 as an allowed value.

Looks like dxx-rebirth may not build on 32-bit Haiku:

scons: Reading SConscript files ...
===== D1X-Rebirth v0.61.0 0.60.0-beta2-1336-ge226623ebe7e*e226623ebe7e9d01ab0e00c8d30fc076091ecb12 =====
===== D2X-Rebirth v0.61.0 0.60.0-beta2-1336-ge226623ebe7e* e226623ebe7e9d01ab0e00c8d30fc076091ecb12 =====
DXX-Archive.3: compiling on 'haiku1'/'BePC' for 'haiku1' into .
DXX-Archive.3: checking version of C++ compiler 'g++' ... '2.95.3-haiku-2017_07_20'
g++: unrecognized option `-pthread'
DXX-Archive.3: checking path to assembler ... b'/packages/gcc-2.95.3_2017_07_20-2/.self/develop/tools/i586-pc-haiku/bin/as'
DXX-Archive.3: checking version of assembler b'/packages/gcc-2.95.3_2017_07_20-2/.self/develop/tools/i586-pc-haiku/bin/as' ... 'GNU assembler 2.17-haiku-2013_04_21'
g++: unrecognized option `-pthread'
DXX-Archive.3: checking path to linker ... b'/packages/gcc-2.95.3_2017_07_20-2/.self/develop/tools/i586-pc-haiku/bin/ld'
DXX-Archive.3: checking version of linker b'/packages/gcc-2.95.3_2017_07_20-2/.self/develop/tools/i586-pc-haiku/bin/ld' ... 'GNU ld version 2.17-haiku-2013_04_21'
DXX-Archive.3:  CHOST: None
DXX-Archive.3:  CXX: 'g++'
DXX-Archive.3:  CPPDEFINES: [('PHYSFS_DEPRECATED', '')]
DXX-Archive.3:  CPPPATH: ['common/include', 'common/main', '.']
DXX-Archive.3:  CPPFLAGS: ['-Wno-sign-compare']
DXX-Archive.3:  CXXFLAGS: ['-g', '-O2', '-ftabstop=4', '-Wall', '-Werror=extra', '-Werror=format=2', '-Werror=missing-braces', '-Werror=missing-include-dirs', '-Werror=uninitialized', '-Werror=undef', '-Werror=pointer-arith', '-Werror=cast-qual', '-Werror=missing-declarations', '-Werror=vla', '-pthread', '-funsigned-char']
DXX-Archive.3:  LIBS: None
DXX-Archive.3:  LINKFLAGS: []
DXX-Archive.3:  $CCACHE_PREFIX: None
DXX-Archive.3:  $DISTCC_HOSTS: None
DXX-Archive.3: checking whether C++ compiler and linker work...no
DXX-Archive.3: checking whether C++ compiler works...no
DXX-Archive.3: checking whether C++ compiler works with blank $CXXFLAGS...yes
scons: *** C++ compiler works with blank $CXXFLAGS.  C++ compiler does not work with specified $CXXFLAGS.  See sconf.log for details.  Stop.
~/dxx-rebirth> 

I’ll have to make a 64-bit VM to test now.

Use setarch x86 on 32-bit before running scons. It’s unlikely GCC2 will compile the game, but GCC8 might.

Still no dice with gcc8.

I’m sharing the compile prerequisites here:

  • Python 3.x to run scons, the processor for SConstruct scripts. Python 3.6 is recommended.
  • C++ compiler with support for selected C++11 features. One of:
  • gcc 7.5
  • clang 9.0 or later
  • Microsoft Visual Studio is not supported at this time. Support for Microsoft Visual Studio will be added when it implements sufficient C++17 features for the code to build with few or no modifications.
  • SDL 1.2. SDL 2 is also supported, and will become the default soon.
  • PhysicsFS. PhysFS 3.x or later is required.

Optional, but recommended:

My current VM (32-bit) has gcc 2.9.5 and 8.3.0 installed, and I just installed clang (llvm12) from HaikuDepot. Going to try with clang to see if it’ll work.

1 Like

My pull request to add Haiku as a valid build host option was accepted into the dxx-rebirth master, so that’s a start!

What’s now needed is testing builds in 64-bit Haiku, taking notes, and learning how to create a HPKG.

7 Likes

Built a 64-bit Haiku VM, installed all the needed libraries, and tried compiling dxx-rebirth again, but I’m still coming up short; the screenshot below can illustrate the issues I’m having compiling in 64-bit Haiku.

Specifically, twice I get this error:
g++: error: unrecognized command line option “-pthread”

Searches aren’t turning up any info about this particular option, so I’m at a bit of a loss here.

However, I did Pastebin the sconf.log that was written, which is here if anyone wants to take a look at it: dxx-rebirth scons errors - Pastebin.com

VirtualBox_Haiku (64-bit)_14_06_2021_16_58_23

Replace -pthread with -lpthread.
Read the porting guides at HaikuPorts

2 Likes

Done! Try again and…

It’s working!? IT’S WORKIIIIIIIING!!!

VirtualBox_Haiku (64-bit)_14_06_2021_19_06_49

2 Likes

So close, and yet so far… :confused:

VirtualBox_Haiku (64-bit)_14_06_2021_19_14_05
VirtualBox_Haiku (64-bit)_14_06_2021_19_14_17

2 Likes

Add -lnetwork to the linker flags and read the porting guide at the HaikuPorts wiki and the BeOS : Porting UNIX Applications book.

3 Likes

It’s been a while since we were on this thread, hasn’t it?

Some recent commits to the dxx-rebirth project have gotten the build system to recognize Haiku as a platform, after some back and forth and through an issue I opened up on the GitHub repo:

I’m doing a test build to see if it works properly, or at least to see how far it gets before any failures. But now we’re a little closer to having Descent and Descent II available for Haiku! :grinning:

EDIT: Still closer, but not quite: