Haiku OS?

Post Reply
cknappiowa
Posts: 4
Joined: Sun Oct 29, 2017 3:04 am

Haiku OS?

Post by cknappiowa » Sun Oct 29, 2017 3:12 am

I know this will be a bit of an obscure topic, but I've recently begun toying around with the Haiku operating system- currently in alpha, nearing beta. Haiku seeks to recreate compatibility with the BeOS, but their software library is a bit lacking at the moment. They've recently added support for QT applications, though, which has the potential to expand the software library considerably.

However, as of this writing Haiku offers NO pre-built option for a MUD client. I'd like to see about rectifying this, and since Mudlet is my client of choice on both Windows and Linux, I was wondering if anyone had any insight as to how to go about achieving portability to Haiku as well. I've tried poking around with QT Creator on Haiku, but I'm afraid I'm a bit too rusty in my C/C++ to know instictively what I'm looking for. I've had success compiling Mudlet on Linux before (during the early delta release of 3.5), but it would seem to need some tweaking for Haiku.

User avatar
SlySven
Posts: 909
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Haiku OS?

Post by SlySven » Sun Oct 29, 2017 4:05 am

As someone who has toyed with porting Mudlet to cygwin and at the moment FreeBSD, this sounds interesting - though looking at the Wikipedia article for the Haiku (Operating System) suggests the old GCC2 and 4 hybrid may hurt things. Is there a lua 5.1 port as well? Mudlet has a run-time dependency on some lua modules - though as lua should be compilable on any ANSI C compiler it should be something that ought to be around. The 3D part of the map widget also uses some (rather ancient) OpenGL (1.x) code via a Qt interface so you may also get issues if there is not suitable openGl support in Haiku.

cknappiowa
Posts: 4
Joined: Sun Oct 29, 2017 3:04 am

Re: Haiku OS?

Post by cknappiowa » Sun Oct 29, 2017 4:57 am

I actually run the 64 bit version instead of the hybrid. The hybrid has compatibility with old BeOS binaries, but honestly; there's not much in the way of old BeOS software that either hasn't been improved on since during the development of Haiku or can't be easily replaced with more modern software. The 64bit version uses GCC 5.4.0, has Qt5 support, and, in my opinion, represents more of a What-Haiku-COULD-Be state of progress than the old hybrid version. Some of the devs do seem a bit hung up on keeping compatibility with archaic BeOS software when they could be focusing more on modernization of the BeOS ethos instead.

Nightly/Dev builds are the recommended install at this point since the R1 Alpha is wildly out of date. I'd have to check to see if Lua 5.1 is supported, though I do know that at least some version of Lua is- I just didn't check the version number and I'm on my Linux partition at the moment. To my knowledge, there is OpenGL support already.

User avatar
Vadi
Posts: 4643
Joined: Sat Mar 14, 2009 3:13 pm

Re: Haiku OS?

Post by Vadi » Sun Oct 29, 2017 7:05 am

Well, it's just like you described - start trying to compile it and fix any errors that come up.

User avatar
SlySven
Posts: 909
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Haiku OS?

Post by SlySven » Tue Oct 31, 2017 5:25 am

If you get some results you may wish to write it up in the Compiling Mudlet part of the Wiki if you can!

cknappiowa
Posts: 4
Joined: Sun Oct 29, 2017 3:04 am

Re: Haiku OS?

Post by cknappiowa » Thu Nov 09, 2017 1:26 am

Making some headway after tracking down the proper locations to find headers and libraries for those packages with request files in the Cmake folder. Mostly it seemed to be an issue of finding and installing all the proper libraries into Haiku and changing a reference directory here and there.

Compiling got off to a good start once the cmake file completed with no errors, until I ran into this about 71% through the compile:
CMakeFiles/mudlet.dir/dlgPackageExporter.cpp.o: In function `dlgPackageExporter::slot_export_package()':
dlgPackageExporter.cpp:(.text+0x2b05): undefined reference to `zip_open'
dlgPackageExporter.cpp:(.text+0x2b46): undefined reference to `zip_error_to_str'
dlgPackageExporter.cpp:(.text+0x2d11): undefined reference to `zip_source_file'
dlgPackageExporter.cpp:(.text+0x2d5b): undefined reference to `zip_error_get'
dlgPackageExporter.cpp:(.text+0x2d7c): undefined reference to `zip_error_to_str'
dlgPackageExporter.cpp:(.text+0x2dc0): undefined reference to `zip_add'
dlgPackageExporter.cpp:(.text+0x2e0a): undefined reference to `zip_error_get'
dlgPackageExporter.cpp:(.text+0x2e2b): undefined reference to `zip_error_to_str'
dlgPackageExporter.cpp:(.text+0x2e6a): undefined reference to `zip_close'
dlgPackageExporter.cpp:(.text+0x2e9b): undefined reference to `zip_error_to_str'
CMakeFiles/mudlet.dir/Host.cpp.o: In function `Host::saveModules(int)':
Host.cpp:(.text+0x1f03): undefined reference to `zip_open'
Host.cpp:(.text+0x21ad): undefined reference to `zip_source_file'
Host.cpp:(.text+0x2228): undefined reference to `zip_add'
Host.cpp:(.text+0x2256): undefined reference to `zip_close'
CMakeFiles/mudlet.dir/mudlet.cpp.o: In function `mudlet::unzip(QString const&, QString const&, QDir const&)':
mudlet.cpp:(.text+0x16227): undefined reference to `zip_open'
mudlet.cpp:(.text+0x16265): undefined reference to `zip_error_to_str'
mudlet.cpp:(.text+0x16297): undefined reference to `zip_get_num_entries'
mudlet.cpp:(.text+0x162c8): undefined reference to `zip_stat_index'
mudlet.cpp:(.text+0x16581): undefined reference to `zip_close'
mudlet.cpp:(.text+0x165db): undefined reference to `zip_get_num_entries'
mudlet.cpp:(.text+0x1660c): undefined reference to `zip_stat_index'
mudlet.cpp:(.text+0x16696): undefined reference to `zip_fopen_index'
mudlet.cpp:(.text+0x166ad): undefined reference to `zip_close'
mudlet.cpp:(.text+0x1674b): undefined reference to `zip_fclose'
mudlet.cpp:(.text+0x16757): undefined reference to `zip_close'
mudlet.cpp:(.text+0x167c6): undefined reference to `zip_fread'
mudlet.cpp:(.text+0x167ec): undefined reference to `zip_fclose'
mudlet.cpp:(.text+0x167f8): undefined reference to `zip_close'
mudlet.cpp:(.text+0x1684b): undefined reference to `zip_fclose'
mudlet.cpp:(.text+0x16857): undefined reference to `zip_close'
mudlet.cpp:(.text+0x1688c): undefined reference to `zip_fclose'
mudlet.cpp:(.text+0x168e2): undefined reference to `zip_close'
mudlet.cpp:(.text+0x16913): undefined reference to `zip_error_to_str'
collect2: error: ld returned 1 exit status
src/CMakeFiles/mudlet.dir/build.make:3369: recipe for target 'src/mudlet' failed
make[2]: *** [src/mudlet] Error 1
CMakeFiles/Makefile2:358: recipe for target 'src/CMakeFiles/mudlet.dir/all' failed
make[1]: *** [src/CMakeFiles/mudlet.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2
I have, as far as I can tell, the appropriate libzip as requested during cmake, but haven't gone diving into the cpp files yet. Any ideas what I should be looking for?

User avatar
SlySven
Posts: 909
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Haiku OS?

Post by SlySven » Thu Nov 09, 2017 4:35 pm

Have you got the development headers - on a Linux platform I'd be looking for "libzip-dev" or "libzip-develop" packages.... {Have you got the header file zip.h in a place where the compiler will see it - oh hang on, the undefined reference thing means that libzip*.so {where * may not be anything but could be some numbers) is not being found during linking - which means that you will likely have to mess around with an -L path/to/libfile flag for the compiler/linker if the libzip is not in the right place {qmake does this with a LIBS variable but I can't recall the incantation for cmake}...

cknappiowa
Posts: 4
Joined: Sun Oct 29, 2017 3:04 am

Re: Haiku OS?

Post by cknappiowa » Tue Nov 21, 2017 4:35 am

Update!

Eventually I did get all lib requirements sorted and compiling underway, but I was missing a few key alterations to get it running properly on Haiku.

Luckily, one of the helpful folks over at the Haiku forums whipped up a recipe for Haikuporter and we were off to the races. Once Haikuporter is installed, compiling is now as simple as "haikuporter -S --get-dependencies --no-source-packages mudlet".

It works for most functionality so far, though it complains about missing some Lua libraries even if they're installed on the system. My best guess at the moment is that judging from this output text in Mudlet itself:


[ ERROR ] - Cannot find Lua module rex_pcre.
Some functions may not be available.
Lua error:[string "require "rex_pcre""]:1: module 'rex_pcre' not found:
no field package.preload['rex_pcre']
no file './rex_pcre.lua'
no file '/usr/local/share/lua/5.1/rex_pcre.lua'
no file '/usr/local/share/lua/5.1/rex_pcre/init.lua'
no file '/usr/local/lib/lua/5.1/rex_pcre.lua'
no file '/usr/local/lib/lua/5.1/rex_pcre/init.lua'
no file './rex_pcre,so'
no file '/usr/local/lib/lua/5.1/rex_pcre,so'
no file '/usr/local/lib/lua/5.1/loadall,so'


Mudlet seems to simply be looking in the wrong place once the app itself is compiled. I'm guessing this is coded into Mudlet someplace that wasn't anticipated by the guy who threw together the porter recipe, so it should be resolvable. I'll have to poke around when I have more time after this holiday week.

User avatar
Vadi
Posts: 4643
Joined: Sat Mar 14, 2009 3:13 pm

Re: Haiku OS?

Post by Vadi » Tue Nov 21, 2017 6:14 am

Excellent progress!

package.cpath controls where Lua searches for the modules. See how we set it for other OS's here: https://github.com/Mudlet/Mudlet/blob/d ... cpp#L12131

User avatar
SlySven
Posts: 909
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Haiku OS?

Post by SlySven » Tue Nov 21, 2017 11:48 pm

Also, luarocks (a lua package manager) is a very useful addition to the setup - it can be used to provide several of the run-time requirements for Mudlet which is the issue you are hitting there! It, like lua itself only requires an ANSI C or better compiler, and can handle the fact that Mudlet is hard coded now to use lua 5.1 whereas the creators of lua are now looking at 5.3 or 5.4 and the default on some platforms is 5.2... :o

BTW You obviously have Qt available on this OS so what Q_OS_XXX value(s) are defined for you? You will see a few places in the code where we are using the following to have chunks of code for only some platforms:
  • Q_OS_LINUX - for GNU/Linux
  • Q_OS_MACOS - for Macs (though technically I think we can only handle macOS 10.7 or better and not Darwin
  • Q_OS_WIN32 - for any 32/64 Windows but not the Phone or IOT devices.
  • Q_OS_UNIX - for multiple *nix including GNU/Linux (and FreeBSD though that is currently just a personal project for me ATM)
  • Q_OS_FREEBSD - once I get it done.
The above will help to provide OS specific code in the C++ core.

However you will also want to tweak various settings in the project files:
FOR QMAKE: in the mudlet.pro project file you will be looking to modify the built-in LIBS, INCLUDEPATH variables and some others like the project ones including LUA_DEFAULT_DIR whose value is converted into the LUA_DEFAULT_PATH preprocessor value {like a #define LUA_DEFAULT_PATH something) and to that end in that file there are various "scopes" that limit what the related parts do - you will want to identify what can be used to identify the Haiku OS - you will see amongst others:
  • unix - for all sorts of unix types INCLUDING BOTH GNU/Linux and Macs - but the latter can be determined because they also have
  • macx - just for the Apple product.
  • win32 - for any 32/64 Windows.
  • freebsd - guess what!
  • msvc - MicroSoft Visual C compiler - basically only for that compiler and not the Clang/Llvm or GCC compilers that every other system uses
These can be logically ANDed together with a : between a pair of them or a | for a logical OR and negated with a ! - so what do you have?

FOR CMAKE: in the CMakeLists.txt project files there are a few variables (that are equal to the value 1) for:
  • APPLE - for the MacOS platform.
  • WIN32 - for any 32/64 Windows.
  • UNIX - for ANY Unix platform include GNU/Linux, APPLE, Cygwin, FreeBSD
  • MSVC - for MicroSoft Visual C compiler, like the qmake case!
There is not a predefined variable for GNU/Linux however the CMAKE_SYSTEM_NAME should be the go-to answer as it will hold the "short" system name e.g. "Linux", "FreeBSD" or "Windows" - so what is it on Haiku?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests