[Vortex] Patches for building on Mac OS X
Jens Alfke
jens at mooseyard.com
Mon Jun 25 21:06:49 CEST 2007
Hello,
I downloaded Vortex last night and have gotten it to work on Mac OS X.
It does _not_ build or run out of the box, although the home page says
OS X is supported. (Perhaps that claim is out of date?)
These are the issues I ran into:
* The 'configure' script aborts because pkg-config doesn't think AXL
is installed, even after I built it and installed it in /usr/local. I
don't know anything about pkg-config so I don't know what the cause of
this is. I was able to work around it by manually setting AXL_CFLAGS
and AXL_LIBS environment variables.
* 'configure' sets the variable PTHREAD_CFLAGS to "none" in the
generated Makefile. That's right, the string "none". This causes gcc
to barf when that string is used as a parameter.
* GCC complains about your prototype for unsetenv. The problem you
describe that your prototype is a workaround for may be Linux-specific.
In file included from vortex.c:38:
./vortex.h:369: error: conflicting types for 'unsetenv'
/usr/include/stdlib.h:245: error: previous declaration of 'unsetenv'
was here
At that point I gave up building with 'make' and switched to Apple's
Xcode IDE. I set up a project file with the right sources and build
settings. I was able to get it to build a dylib after making a few
modifications to Vortex files. (Strangely, the unsetenv error above
didn't occur when building in Xcode.) I defined a new preprocessor
symbol AXL_OS_DARWIN to #ifdef my changes with.
* In vortex_thread.c (around line 573) your workaround of redeclaring
'struct timespec' doesn't work because "__time_t" is not defined. On
OS X/Darwin, the typedef is "time_t". In fact, the workaround isn't
necessary at all, as timespec is available. The problem you ran into
is probably Linux-specific. So I #ifdef'd out your struct declaration.
* vortex_regression_client's test_04 function opens 1000 simultaneous
sockets. Unfortunately, on OS X the default rlimit is 255 file
descriptors, so the test fails to open another socket when
iterator=253. I added an #ifdef to lower MAX_NUM_CON to 200 when
building on OS X.
* I've disabled SASL support. Mac OS X does have a SASL library, but
it doesn't seem to be the same as the one Vortex uses. (According to
its headers, the Mac one originates from CMU and innosoft.com.) The
APIs are different so it looks like someone who knows about SASL (i.e.
not me) would need to heavily modify the code in Vortex to make it
support both libraries.
After all that, I was able to run the regression test client and
listener, and all the tests (except SASL) passed!
Here are patches for the two issues in the C code. As I said, I
haven't attempted to fix the command-line build scripts, but I much
prefer using Xcode anyway and I'll gladly contribute the project file
if you want to include that in the distribution.
--Jens Alfke
jens at mooseyard.com
--- /Users/snej/Desktop/vortex-1.0.3.b2748.g2749/src/vortex_thread.c
2007-05-18 13:03:57.000000000 -0700
+++ /Hack/Others/Vortex BEEP Library/vortex/src/vortex_thread.c
2007-06-25 11:09:58.000000000 -0700
@@ -570,7 +570,9 @@
return true;
}
-#if defined(AXL_OS_UNIX)
+#if defined(AXL_OS_DARWIN)
+#define _v_timespec timespec /* struct timespec _is_ available in
Darwin / Mac OS X */
+#elif defined(AXL_OS_UNIX)
/**
* @internal Hack to avoid a really surprising issue. struct timespec
* is not available while compiling with -ansi but functions using it,
--- /Users/snej/Desktop/vortex-1.0.3.b2748.g2749/test/vortex-
regression-client.c 2007-05-18 13:03:54.000000000 -0700
+++ /Hack/Others/Vortex BEEP Library/vortex/test/vortex-regression-
client.c 2007-06-25 11:58:27.000000000 -0700
@@ -729,7 +729,11 @@
}
/* constant for test_04 */
+#if defined(AXL_OS_DARWIN)
+int MAX_NUM_CON = 200; /* Mac OS X rlimit is 255 file descriptors*/
+#else
int MAX_NUM_CON = 1000;
+#endif
bool test_04 ()
{
More information about the Vortex
mailing list