I’m new to Haiku so I thought I would learn a bit by testing haikuporter on an existing port, widelands-1.1. However, I first had to add gettext to the build depends before I ran into the real issue that has me stumped. Widelands makes use of asio and asio needs some definitions from netdb.h which it is not seeing:
/boot/system/develop/headers/asio/error.hpp:186:20: error: ‘HOST_NOT_FOUND’ was not declared in this scope; did you mean ‘B_STREAM_NOT_FOUND’?
186 | host_not_found = ASIO_NETDB_ERROR(HOST_NOT_FOUND),
These missing definitions are within a #if defined(_DEFAULT_SOURCE) #endif block in netdb.h and _DEFAULT_SOURCE gets defined in headers/bsd/features.h when _BSD_SOURCE is defined and the widelands recipe passes -D_BSD_SOURCE to the compiler. My assumption is that _DEFAULT_SOURCE is not getting defined properly, but even when I add it to the C and CXX flags the error still persists. Any help would be appreciated.
This worked, but then there is another error still around, maybe asio is too new for this?
diff --git a/src/network/network.h b/src/network/network.h
index 3d540d6..fc01b90 100644
--- a/src/network/network.h
+++ b/src/network/network.h
@@ -16,22 +16,18 @@
*
*/
+#ifdef __HAIKU__
+#define _DEFAULT_SOURCE
+#define _BSD_SOURCE
+#endif
+
#ifndef WL_NETWORK_NETWORK_H
#define WL_NETWORK_NETWORK_H
#include <functional>
-
-#ifdef __HAIKU__
-#undef _BSD_SOURCE
-#undef _DEFAULT_SOURCE
-#endif
#include <asio.hpp>
-#ifdef __HAIKU__
-#define _DEFAULT_SOURCE
-#define _BSD_SOURCE
-#endif
#include "base/string.h"
#include "base/wexception.h"
...
Error now:
/sources/widelands-1.1/src/network/bufferedconnection.h:316:15: error: 'io_service' in namespace 'asio' does not name a type; did you mean 'use_service'?
316 | asio::io_service io_service_;
| ^~~~~~~~~~
| use_service
/sources/widelands-1.1/src/network/bufferedconnection.h:316:15: error: 'io_service' in namespace 'asio' does not name a type; did you mean 'use_service'?
316 | asio::io_service io_service_;
| ^~~~~~~~~~
| use_service
make[2]: *** [src/ui_fsmenu/CMakeFiles/ui_fsmenu.dir/build.make:359: src/ui_fsmenu/CMakeFiles/ui_fsmenu.dir/login_box.cc.o] Error 1
make[2]: *** [src/ui_fsmenu/CMakeFiles/ui_fsmenu.dir/build.make:317: src/ui_fsmenu/CMakeFiles/ui_fsmenu.dir/launch_mpg.cc.o] Error 1
/sources/widelands-1.1/src/network/bufferedconnection.h:316:15: error: 'io_service' in namespace 'asio' does not name a type; did you mean 'use_service'?
316 | asio::io_service io_service_;
| ^~~~~~~~~~
| use_service
In file included from /sources/widelands-1.1/src/ui_fsmenu/netsetup_lan.h:25,
from /sources/widelands-1.1/src/ui_fsmenu/main.cc:49:
/sources/widelands-1.1/src/network/network_lan_promotion.h:136:15: error: 'io_service' in namespace 'asio' does not name a type; did you mean 'use_service'?
136 | asio::io_service io_service;
| ^~~~~~~~~~
| use_service
```
Stupid markdown
EDIT2: replacing use_service with io_context works (this has been replaced in asio for quite some time, however there are again new errors popping up …. not sure how uptoday the version of widelands is, maybe a newer version has less issues?
As far as I can look it up boost::asio isn’t the same as our asio package in the depot?
EDIT: maybe switch to latest 1.3.1 release, asio issue resolved there, and with the above patch for “_GNU_SOURCE” it builds OK (should be fine with boost190 also, didn’t check there yet. Looking forward on a PR to update this. (maybe asio could be bumped here too).
I’m pleased that you like my choice of package to start on.
When I had trouble building I did switch to version 1.3.1 which did not resolve that issue, but it is good to know that it is needed for compatibility with asio. It turns out that the problematic code that your patch addresses was added by the port’s patch so the fix is as simple as just not messing with network.h.
Thanks for the PR! As mentioned there I “think” you are running Haiku nightly, and it’s possible (didn’t check there yet), it builds without pathcing network.h, but I still needed it for R1B5.
So counting that the buildmasters still run on that it should be checked for that before merging.
I also did a PR for latest glew, maybe you could try to build that to be used for Widelands, it worked here.
One anoying thing is the cursor rendering, but don’t know how to solve that, been out of the loop for SDL for quite some time.
I installed from the ISO of r1beta5 and don’t recall doing anything that would have switched me to nightly. I’ll have to dig in and verify that just to be sure.
To be fair, I haven’t tried building it without the mentioned patch, if that works your PR is good to go.
PS glew’s PR got merged (you probably read that in the PR), so you could use: devel:libGLEW$secondaryArchSuffix >= 2.3 in the recipe also.
EDIT: resolved, looks like it’s not required at all, PR is merged, crossing fingers on the builds on buildmasters. Thanks for the contribution @SteveM !
To be sure the builds will pass on buildmasters yes, but as @BiPolar mentioned above, you can do a nightly build and pass the version requirement to make sure they build on beta5 and nightly (should only be used in rare conditions though, not always needed).
To switch from beta5 to nightly and back I’m using Repositories to switch the url’s for this, some information/tips at: