my experience with emx
I'm a programmer; I develop software tools to implement and measure
licensing. We support dozens of platforms, which is a euphemism for
I've done ports to many versions of UNIX, VMS, NetWare, Windows and NT.
A couple of weeks ago, we made our biggest sale ever,
the sale was contingent on delivery of an OS/2 port.
Our software is written for maximum portability accross
Porting to Windows, NetWare, VMS and NT wasn't easy. A typical UNIX
system takes from a day to a week to complete the port of perhaps
lines of C code. Windows, NT, NetWare and VMS each took several months,
we expected OS/2 to take several months.
I had read on the Web about a version of the gnu C
compiler called emx, an
environment built to make it easier to move a
UNIX program to OS/2.
I tried to assemble emacs and the basic emx development
tools from the Hobbes
CD-Rom of June 1996. It didn't work. The version of emxrt.dll and the
emacs wouldn't cooperate. The documentation refered to patches I would
Next, I went directly to ftp://ftp.cdrom.com/pub/os2.
was much better. All of the programs were compatible with each other.
installed emx runtime. This consisted of unzipping it, and adding the
appropriate directories to the path, libpath and bookshelf in
After rebooting, I seemed to have emx runtime support.
[update: 2004 -- Unfortunately, this resource is no
longer available. But an even better online source for emx files has
been established at Hobbes.]
I followed this success with the install of emacs and
the emx development
system. Each of these went in just as emx had gone in. Emacs also
some environment variables, and I threw in the optional emx environment
variables as well. After another reboot, I ran a command file in the
...\bin directory which added emacs icons to the desktop. I compiled a
program successfully. Emacs appears to work.
The product had a single make file. I tried to execute
this make file
the product using gnu make version 3.74. I ran into trouble right away.
make couldn't parse the rules that had "%:RCS/%,v" in them. I didn't
think these rules
applied to OS/2, so I commented them out of my make file. Things now
quite well until I came to socket code. I
needed bsddev.zip added to my emx tools. Once I did this, socket code
The EMX gnu is pickier about the file sys/types.h before
sys/stat.h. It is
also pickier about the declaration of sys_errlist in stdlib.h. I
code to comply. The whole UNIX project now compiled. I went on to
did not provide the ranlib command, so I commented it out in the
needed to add socket.a to my list of libraries. Some UNIX platforms
libraries with an unstated prefix "lib". EMX does not, so I changed the
OS/2 does not support file system links, so I changed
the "ln -s" command in the make file
to "cp -p". I had to go into the C code and equate lstat to stat. I
the directory separator from front slash to back slash, and the path
from colon to semicolon. A mkdir command in the make file also had to
changed to back slash from front slash.
Back in the make file, some variables have been refered
to as $$ID, and this
did not work. I change all references to $(ID).
I now had to change a "cat" command in the make file to "type". I then
all of my targets from just the name to the name followed by ".exe". I
making successful executables, but the strip command didn't work. I
changed strip to "emxbind -s", and that seems to work.
Finally, the setpgrp function was missing. I realized that I didn't
it on OS/2, and commented it out. I had created the final executable. I
started the server program, and it seems to be running normally. Then I
started a client
program which displayed the server status, and everything looked
on a UNIX system, it usually doesn't work on the first execution. I ran
same client on a Solaris system, and it also reported that the OS/2
normal. In fact, every test I could run showed that this first build
I step back, and take a deep breath. I've been working
for 24 hours, and the
port is done. Do I tell my boss? He's budgeted two months. I run the
again. It really works.
last updated: 15 Dec 1997