Register a domain and help support LQ
Go Back > Blogs > Musings on technology, philosophy, and life in the corporate world
User Name


Hi. I'm a Unix Administrator, mathematics enthusiast, and amateur philosopher. This is where I rant about that which upsets me, laugh about that which amuses me, and jabber about that which holds my interest most: Unix.
Rate this Entry

uMurmur on OpenBSD

Posted 12-20-2010 at 09:39 AM by rocket357
Updated 12-21-2010 at 10:00 AM by rocket357

I run a ventrilo server at home. My wife is an avid gamer (as am I, to a lesser extent), so ventrilo really helps with coordinating group gaming and in-game tactics.

There's just one problem...non-paid Ventrilo installs limit you to 8 people on the server at a time, and I'm too cheap to actually pay for a hosted unlimited vent server. On top of that, there is no native vent client for Linux or any of the BSD's, and most of the team we game with don't want to convert to TeamSpeak due to voice quality concerns (I personally can't tell much difference). Also, I'm running Ventrilo on FreeBSD, and I'm more comfortable with OpenBSD administration. I'd really, really prefer to run OpenBSD if possible. Seems like a bunch of //TODO's...

Enter Mumble. Mumble is an open source voice chat system intended for gamers. When I first caught wind of Mumble, I got excited...VERY excited. I looked at BSD repositories, and sure enough, Mumble runs on FreeBSD and NetBSD (typically the lack of a port on OpenBSD signifies that no one has bothered to "port" it over yet, not that it can't be done). I get this about *I* port Mumble over to OpenBSD? I can barely contain myself at this point.

There's just one problem. Mumble isn't written in C, or even C++. It's written in a "meta-C++" language called ICE that first "compiles" ICE to C++, THEN compiles C++ to executable format. I know deep down that the ICE compiler hasn't been ported to OpenBSD, and a quick search of the ports system confirms my fears.

Why not run ICE on FreeBSD, then, and move the code over to OpenBSD? One, I'm lazy, and two, I don't feel like digging up "meta-C++" error messages all night long. I just want to compile it and be done...or at least as close as one can get to "compile and run" when it comes to porting software.

On misc the other day a murmur (the server component of Mumble) alternative was mentioned. Called uMurmur, it's a very lightweight murmur clone designed for routers. And it's written in C. You can get it here

I downloaded/extracted murmur and ran make. Immediately make bombs with "-C: unknown option". OpenBSD's make doesn't have -C (very similar in function to tar's -C), but gmake (gnu make) does. So I pkg_add gmake and run gmake.

It compiles a few files and bombs again. I scroll up to the very first error/warning, and I see that u_int8_t isn't defined (error occurred in client.c). I copy client.c to client.c.orig and fire up vi, add "#include <sys/types.h>" and save. gmake again, and it bombs a few files later.

This time, it can't find libconfig.h. I verify I have the libconfig package installed, then copy the Makefile to Makefile.orig. I fire up vi again and edit the includes to search in /usr/local/include, and save. gmake bombs yet again, but this time it bombs during linking. Looks like compiling is good now =)

I add -L/usr/local/lib to LDFLAGS, but now it bombs with sched_get_priority_min being undefined and some openssl issues. I fix the paths for openssl libs, but now I'm a bit miffed...

sched_get_priority_min is a Linux 2.6 syscall. I'm on OpenBSD. This could be a show-stopper (or end up as an all-nighter coding session at best). I dig into main.c and start looking around.

As an aside, if you are writing code and want to use sched_get_priority_min, please at least check for to see if _POSIX_PRIORITY_SCHEDULING is defined before you use it. Portability counts.

I look into main.c and see that sched_get_priority_min is only used with the -r (realtime) flag. Looks like we just won't have realtime on OpenBSD for now...I cut out everything having to do with realtime, and viola! uMurmur compiles/links fine.

For now here are the diffs. I plan on revising them to include a check for _POSIX_PRIORITY_SCHEDULING, but that will come later once I've tested a bit. I'll post a followup to this once I get it tested on i386, amd64, and sparc64. Any testing (especially other arch's) by readers is welcome and appreciated!

(Edit: I started porting murmur (the full server from the Mumble project) today and I'm making decent progress. I'll post a followup when I know more on either of these porting efforts.)

(Edit #2: murmur now builds successfully on amd64. Not tested yet, I'll post another blog entry about murmur and link it here.)

(Edit #3: I'm submitting umurmur as a port to OpenBSD, and I've connected with the port gurus who are already working on porting Mumble/Murmur.)

--- Makefile.orig       Mon Dec 20 08:54:23 2010
+++ Makefile    Mon Dec 20 09:27:37 2010
@@ -24,10 +24,10 @@

 # OpenSSL - usually installed at a standard place
-# EXTRA_LDFLAGS:=-lcrypto -lssl
+EXTRA_LDFLAGS:=-lcrypto -lssl

+CFLAGS:=$(CFLAGS) -I. -I/usr/include/openssl -I/usr/local/include -Wall $(EXTRA_CFLAGS)
+LDFLAGS:=$(EXTRA_LDFLAGS) $(LDFLAGS) -L/usr/local/lib -lconfig

 umurmurd:google/protobuf-c/libprotobuf_c.a $(OBJS)
        $(CC) $(LDFLAGS) $(OBJS) $(SSL_LIB) google/protobuf-c/libprotobuf_c.a -o umurmurd
--- client.c.orig       Mon Dec 20 08:52:10 2010
+++ client.c    Mon Dec 20 08:52:29 2010
@@ -29,6 +29,7 @@
 #include <sys/poll.h>
+#include <sys/types.h>
 #include <sys/socket.h>
 #include <fcntl.h>
 #include <errno.h>
--- main.c.orig Mon Dec 20 09:21:01 2010
+++ main.c      Mon Dec 20 09:22:24 2010
@@ -111,18 +111,7 @@


-void setscheduler()
-       int rc;
-       struct sched_param sp;

-       sp.sched_priority = sched_get_priority_min(SCHED_RR); /* Should suffice */
-       Log_info("Setting SCHED_RR prio %d", sp.sched_priority);
-       rc = sched_setscheduler(0, SCHED_RR, &sp);
-       if (rc < 0)
-               Log_warn("Failed to set scheduler: %s", strerror(errno));
 void printhelp()
        printf("uMurmur version %s. Mumble protocol %d.%d.%d\n", UMURMUR_VERSION, PROTVER_MAJOR, PROTVER_MINOR, PROTVER_PATCH);
@@ -130,7 +119,6 @@
        printf("       -d             - Do not deamonize\n");
        printf("       -p <pidfile>   - Write PID to this file\n");
        printf("       -c <conf file> - Specify configuration file\n");
-       printf("       -r             - Run with realtime priority\n");
        printf("       -a <address>   - Bind to IP address\n");
        printf("       -b <port>      - Bind to port\n");
        printf("       -h             - Print this help\n");
@@ -140,13 +128,12 @@
 int main(int argc, char **argv)
        bool_t nodaemon = false;
-       bool_t realtime = false;
        char *conffile = NULL, *pidfile = NULL;
        int c;
        struct utsname utsbuf;

        /* Arguments */
-       while ((c = getopt(argc, argv, "drp:c:a:b:h")) != EOF) {
+       while ((c = getopt(argc, argv, "dp:c:a:b:h")) != EOF) {
                switch(c) {
                case 'c':
                        conffile = optarg;
@@ -166,9 +153,6 @@
                case 'h':
-               case 'r':
-                       realtime = true;
-                       break;
                        fprintf(stderr, "Unrecognized option\n");
@@ -213,9 +197,6 @@

-       if (realtime)
-               setscheduler();

Posted in Uncategorized
Views 1108 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 08:38 AM.

Main Menu

Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration