Building OpenSSL with OpenWatcom on ArcaOS: The Initial Hurdles

Building OpenSSL on a new system or compiler presents a lot of hurdles. The build system is a perl hack upon a perl hack; and no documentation about how it works, from what I can tell.

I am porting OpenSSL 1.0.2, which is what the software I want to work on expects. Hopefully my work can be applied to other versions as well.

Here I go through the initial steps to get a working build system on ArcaOS 5, also known as OS/2, using the OpenWatcom compiler; even though OpenSSL has already been ported to the EMX runtime, with GCC.

Because we’re using perl, the steps here are taken after installing perl with

yum install perl

and this gives us a working build system with the changes below, so the real work on porting OpenSSL can start.


The Configure script is a perl program which takes as a parameter the system to be configured. We edit that to allow OS2-OW as a system name.

We add

  ##### OS/2 OpenWatcom
  "OS2-OW", "wcc386::::::::",

to the %table; yes, the table is aptly named %table and there’s no immediately visible purpose for it.

However, with the target TABLE, Configure prints it out with somewhat helpful syntax. Here is the OpenWatcom specific part of it.

*** OS2-OW
$cc           = wcc386
$cflags       = 
$unistd       = 
$thread_cflag = 
$sys_id       = 
$lflags       = 
$bn_ops       = 
$cpuid_obj    = 
$bn_obj       = 
$ec_obj       = 
$des_obj      = 
$aes_obj      = 
$bf_obj       = 
$md5_obj      = 
$sha1_obj     = 
$cast_obj     = 
$rc4_obj      = 
$rmd160_obj   = 
$rc5_obj      = 
$wp_obj       = 
$cmll_obj     = 
$modes_obj    = 
$engines_obj  = 
$perlasm_scheme = 
$dso_scheme   = 
$shared_cflag = 
$shared_ldflag = 
$shared_extension = 
$ranlib       = 
$arflags      = 
$multilib     = 

Figuring out what each and every option is for will wait for some other day.


We add

"OS2-OW", "OpenWatcom OS/2",

to %ops and

elsif ($platform eq "OS2-OW")
        require '';

to the platform handling code. The $wc=1; is from the EMX platform; as of yet I do not know what it means.

This file unconditionally adds -c to the compiler command line, so we unconditionally remove it. That is, the line

$ret.= " ${ofile}$target $ex_flags -c $srcd$source\n\n";


$ret.= " ${ofile}$target $ex_flags $srcd$source\n\n";

and I’d like to make it configurable somehow, so this can be upstreamed later.


This file is originally copied from util/pl/ We change the title comment to read

# - for OpenWatcom on OS/2

and set the directory separator, copy and delete commands. Of course, there’s no hint that $o is a directory separator. It is used much, much later in the file to replace forward slashes, /.


We set the preamble to the empty string.

  $preamble = ""

It used to be "SHELL=sh\n" and while ArcaOS has bash, we don’t want to rely on it if we can help it.

We set the compiler to be wcc386, define little endian, and set the optimization flags, -ox -oh.

$cflags="-DL_ENDIAN -ox -oh ";

we also change the debug flag.

  if ($debug) { 
      $cflags.="-d1 "; 

The object files end in .obj, and the flag to set the name of it is -fo=object.obj so we’re careful the $ofile doesn’t end with a space.


The linker is wlink, with no special flags; the $efile is actually set to the wcl386 syntax, so these two need to be reconciled before we get to the linking stage.


We set the assembler to wasm, and the $afile again to the watcom syntax. This looks correct.



This file is also copied; from os2/OS2-EXM.cmd. The canges here are mostly repetitive; here’re the highlights.

We make it run Configure with the OS2-OW system; as well as util/, and make the latter create OS2-OW.mak instead of EMX.

Then change all of the assembly generators to use wasm instead of a.out.


We define $wasm by appending it to the line


And we also add this to the type handling code.

    elsif (($type eq "wasm"))
    {   $wasm=1;  require ""; }

Finally, we add this to the help output.

        wasm    - OpenWatcom on OS/2


This file is copied from

We change the package to x86wasm.

  package x86wasm;

and remove the conditional that warns against MASM versions lower than 8.00.

We also remove


which I don’t know what is, and it causes an error in Wasm.

We also remove the MASM >= 8.00 conditional and just use



Finally we change

     if ($global)    { $func.=" PUBLIC\n${begin}::\n"; }


     if ($global)    { $func.=" PUBLIC\n${begin}:\n"; }

so function entries only start with a single column label.

At this point, at least some of the assembly files compile.

Final Words

All of these changes give us a working build system; we are able to run it with

wmake -u -c -f OS2-OW.mak

and some files build and others don’t.

Do you need professional help with OS/2? Write to

One thought on “Building OpenSSL with OpenWatcom on ArcaOS: The Initial Hurdles

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: