Kent's Most Excellent Porting Adventure

Or "How not to port the M.I.T. Athena Zephyr System to OS/2"

Last updated: April 23, 1996.

Okay. the quick answer is that you can't port Zephyr to OS/2, so go away and leave me alone. I have work to do. Get out of my office! Out! Out! Out! I'm working on my thesis. Really! Leave me alone, dammit!


Alright, we are embarking on a long and perilous journey. Along the way, we will Now, follow these steps to failure:
  1. Have HPFS. Use it. Love it.
  2. Get the latest source code distribution for the M.I.T. Athena Zephyr System from the official source, Pick either zephyr-2.0.3.tar.gz or zephyr-2.1.beta.tar.gz. Your mileage may vary.
  3. Set up a development environment on your machine that looks as much like Unix at possible. Get the EMX compiler package from, including the following files:,,,,,
  4. Get lots of GNU utilities from We'll need at least,,,,,,,,, You want the GNU versions of sed and tar, because they support long filenames.
  5. In order to make the configure script and Makefiles work, we'll need a Unix shell. Get from
  6. Get source code to the syslog library. There is a file in, but it was compiled for CSet, not EMX. I need to ask the kind people of comp.os.os2.programmer.porting what they recommend. Although, faking it is tempting.
  7. You'll need unz512x2.exe to unpack all this stuff, of course, if you don't have it already. Geez! Get with the program!
Here's my directory of archives to serve as a checklist:
The volume label in drive D is GNU HPFS.
Directory of D:\zip

 4-20-96   7:38a     <DIR>           0  .
 4-20-96   7:38a     <DIR>           0  ..
 4-19-96  10:21p    191104           0
 4-19-96  10:37p   1062253           0
 4-19-96  11:17p    852511           0
 4-19-96  10:25p    359399           0
 4-19-96  10:50p    506945           0
 4-19-96  10:45p    229991           0
 4-20-96   7:33a    965234           0
 4-19-96  10:38p    591245           0
 4-19-96  10:43p    778889           0
 4-19-96  10:39p    180273           0
 4-20-96   1:31p    518407           0
 4-19-96  11:07p    168535           0
 4-19-96  10:50p    456750           0
 4-19-96  10:48p    217589           0
 4-19-96  10:59p    547866           0
 4-19-96  10:50p     76749           0
 4-19-96  10:55p    225473           0
 4-20-96   6:51p    116901           0
 4-19-96  10:48p    435844           0  zephyr-2.0.3.tar.gz
       21 file(s)    8481958 bytes used
Install everything. Type "make". Die! Die! Die!


The M.I.T. Zephyr Notification Service is a very complicated networked, distributed, client-server, wow-there-are-a-lot-of-pieces system. For in-depth (but slightly out-of-date) discussions of the whole system, see the PostScript files in

The whole package is much too complicated to attack all at once. So, we want to set our sights as low as possible. There is a running system at M.I.T. that we want to connect to, so we'll ignore all the server stuff. The Zephyr Windowgram Client, zwgc, (the program the actually pops the message windows up on your screen) is X-Windows based, so that's right out, too. That leaves two pieces [see footnote 1]:

  1. The Zephyr HostManager, zhm, the program that sits in the background on your machine and actually does all the necessary network communication between the client programs and the servers.
  2. The Zephyr Write Program, zwrite, a client program that sends a message to another user.
Both of these programs are text based, so there should be no X-Windows stuff to comment out. With these two programs, we will be able to send messages to other people at M.I.T. from an OS/2 workstation. If we get crazy, maybe we'll compile zlocate, too. Actually receiving messages on your OS/2 workstation will be left for another time (left as an exercise for the reader, you might say).


Calm down, I'm getting there.

Before we can even think about compiling the actual Zephyr programs, we need to work on some of the auxiliary stuff that comes in the Zephyr package that is supposed to help in development. So far, this consists of three things:

  1. Running the configure script to set up the necessary machine-dependent things in config.h and the Makefiles. The configure script is a Unix shell script that is generated by the GNU autoconf package. This is why we need all the Unix stuff.
  2. Compiling the error table compiler. Easier said than done. This is required to compile the file into a zephyr_err.h file and a zephyr_err.c file that are required for the source tree. This is why we need lex (flex) and yacc (bison).
  3. Compiling and installing a syslog library.
So here goes...

  1. Running the configure script
    This isn't as painful as is could have been, thanks to the author of ksh for OS/2 who supports configure on ksh, and who wrote an article for EDM on the subject. Here are the necessary changes.

    Set the following environment variables to get the EMX stuff set up right and to help configure make the right decisions about some things.

    set C_INCLUDE_PATH=d:/emx/include;d:/zephyr/h
    set LIBRARY_PATH=d:/emx/lib;d:/zephyr/lib
    set GCCLOAD=5
    set GCCOPT=-pipe
    set HOME=d:/home
    set CC=gcc
    set YACC=bison -y
    set LEX=flex
    There are two small changes that you need to make to the configure script in order to get it to run properly. FIrst of all, ksh cannot run shell scripts that have a dot embedded in their name, so rename config.guess and config.sub to config_guess and config_sub and change the references to them in configure:
    ren config.guess config_guess
    ren config.sub config_sub
    ren configure configure.original
    sed -f fix_configure.sed configure.original > configure
    Where fix_configure.sed is
    (I started using sed because I thought there would be a lot more changes to make...)

    Replace the current ac_link lines (around line 510) in the configure script with (big thanks to Dale DePriest, the author of ksh for OS/2, for this):

    ac_link='${CC-cc} -o conftest.exe $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS && mv conftest.exe conftest'
    Now, fire up ksh and run the configure script:
    ksh configure --host=i486-ibm-os2 --prefix=/emx
    Watch this as it procedes and make sure it's doing the right thing. The big one for me was
    checking whether cross-compiling...
    If it answers "yes", everything goes to hell fast. Whenever it answered "no", that meant that I had everything set up right.

    Of course, it still barfs on the "os2" part, but this works. Go! Go! Go! (It would be nice if the GNU people would add support for OS/2 to their autoconf package.) This will manufacture lots of neat stuff for you, including all the Makefiles and config.h.

    Anyway, this takes a while. Take a coffee break. Like, to Bolivia [see footnote 2].

  2. Fixing the Makefiles
    There is one still-outstanding problem with the Makefiles that needs to be fixed by hand. In the final link step, EMX needs to be told to build an OS/2 executable. So in each of the Makefiles, before you "make", change the linker line by adding an ".exe" to the "$@", like so:
    compile_et: compile_et.o error_table.o
            $(CC) $(LDFLAGS) -o $@.exe compile_et.o error_table.o $(LIBS)
    This is called "the Makefile-EXE fix".

  3. Compiling the error table compilier
    This works, but requires a little coaxing.

    After applying the Makefile-EXE fix and typing "make", the compile fails because pieces of the error table compiler require a syslog.h file. I faked it by copying the syslog.h file from the syslogd directory into the include directory.

    copy \zephyr\clients\syslogd\syslog.h \zephyr\h
    Eventually, this needs to be replaced by a real syslog.h file from a real Syslog Library for OS/2.

    The error table compiler calls some (outdated?) string functions in the BSD library that don't exist in the EMX package, but that have equivalents. Hand edit the config.h file to include the following lines:

    /* Stuff added to config.h by hand */
    #define strcasecmp stricmp
    #define strncasecmp strnicmp
    Suddenly, a conversation breaks out between us:
    Wait! If you don't have the error table compiler compiled, where did you get the zephyr_err.c and zephyr_err.h files above?
    I used compile_et on Athena. SIPB has it installed in their locker.
    Hey, Jerky, why don't you just use that and get on with the port?
    Well, I kind of see compile_et as a canary in the coal mine. I mean, if I can't manage to get compile_et to work, how the hell am I ever going to get something as complicated as the Zephyr system to work?
    With the above changes, this compiles without a hitch. So, I got it to work, and now I'm feeling pretty frisky.

  4. Installing Syslog
    This is a no go. I need to ask the kind people of comp.os.os2.programmer.porting what they recommend. I did find a fake syslog in a comp.sources.unix archive that just prints the errors to STDERR. I may end up using this.


There are a few libraries that need to be compiled and installed. One of them is taken care of when you make the error table compiler. Another one (the important one) is the Zephyr library.


Here we go. Finally, we get to the meat of the project. Compiling the actual Zephyr client programs. I'm so excited!
  1. zwrite
    After applying the Makefile-EXE fix, type "make" in /zephyr/clients/zwrite.
    Compiles and runs, but needs zhm to do anything.

  2. zlocate
    After applying the Makefile-EXE fix, type "make" in /zephyr/clients/zlocate.
    Compiles and runs, but needs zhm to do anything.

  3. zhm
    After applying the Makefile-EXE fix, type "make" in /zephyr/zhm.
    Kaboom! Needs a real syslog library, I'm afraid.

    Commenting out all the parts that need the syslog library produces an executable that behaves until you try to connect to one of the M.I.T. Zephyr Servers (which you can find by typing hesinfo zephyr sloc). Then it just complains that the servers keep going down, because it gets an "Error=9" when waiting for a packet. This is not a syslog problem.

    Someone who knows a lot more about TCP/IP, UDP, packets, sockets, and general network stuff probably needs to take a look at this for me. I'm in over my head.

  4. zwgc
    Yeah, right. You're pretty funny, for a dead man.

    Actually, since X_DISPLAY_MISSING is defined in config.h, it should compile right up into a ttymode client. And it does. Almost.

    Edit the instantiate shell script to take the - out of the first line so that it just says

    Then, after applying the Makefile-EXE fix, type "make" in /zephyr/clients/zwgc.

    The executable won't link because the signals SIGTSTP and SIGTTOU are not defined. Are they even supported by EMX? Again, I'm lost here.



Copies of my executables are available. They all require the from emx09b. Note that
  1. compile_et.exe and mk_cmds.exe work.
  2. z*.exe do not work.


  1. M.I.T.'s SIPB has webified zlocate and zwrite.
  2. This development was done on a Thinkpad 350 (25MHz 486SLC, 12M RAM) to dispel the notion that only high powered hardware can handle development work (and because that's all I have). Your mileage may vary. If you have a more powerful computer, you may just want to visit your local JavaHut.
  3. The error table compiler (and its library com_err.a) and the command subsystem compiler (and its library ss.a) were originally written for the Athena Discuss system. Since we've got them compiled for OS/2 now, someone should work on porting Discuss.

Kent H Lundberg (klund(at)