Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Building static libraries with wlink or owcc?

26 views
Skip to first unread message

Johann 'Myrkraverk' Oskarsson

unread,
Apr 21, 2018, 12:57:15 AM4/21/18
to
Hi all,

I've gotten to the stage in my OpenSSL port where the the makefile is
trying to build the first library.

The typical generated make file rule is something like

$(O_CRYPTO): $(CRYPTOOBJ)
$(RM) $(O_CRYPTO)
$(MKLIB) file $(O_CRYPTO) $(CRYPTOOBJ)
$(RANLIB) $(O_CRYPTO)

where I have added the "file" directive in the make file generator.

However, if I just add the "name" directive for Wlink before the
objects, how do I make it comma separated, as I understand the Wlink
manual to require?

Note: I can easily remove the $(RM) and $(RANLIB) lines, by editing the
generator; a perl script. I am not so sure I can easily make it build
a comma separated list directly in the make file since it just generates
variable expansions, like you see above.

Is this simpler to do with owcc? Right now I'm attempting to build a
static library, and not a DLL on OS/2. Can I create .LIB files with
owcc?

Does Wmake have any magic I can use to convert the space separated
objects into a comma separated list?

Right now I'm trying to get a feel for my options, about how I can
do this with OpenWatcom, without requiring external tools. I have
not seen anything immediately obvious to use, in the Wmake, Wlink
and owcc manuals.


--
Johann | email: invalid -> com | www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | twitter: @myrkraverk

Frank Beythien

unread,
Apr 21, 2018, 3:46:23 AM4/21/18
to
Am 21.04.2018 um 06:57 schrieb Johann 'Myrkraverk' Oskarsson:
> Hi all,
>
> I've gotten to the stage in my OpenSSL port where the the makefile is
> trying to build the first library.
>
> The typical generated make file rule is something like
>
> $(O_CRYPTO): $(CRYPTOOBJ)
>         $(RM) $(O_CRYPTO)
>         $(MKLIB) file $(O_CRYPTO) $(CRYPTOOBJ)
>         $(RANLIB) $(O_CRYPTO)
>
> where I have added the "file" directive in the make file generator.
>
> However, if I just add the "name" directive for Wlink before the
> objects, how do I make it comma separated, as I understand the Wlink
> manual to require?
>
> Note: I can easily remove the $(RM) and $(RANLIB) lines, by editing the
> generator; a perl script.  I am not so sure I can easily make it build
> a comma separated list directly in the make file since it just generates
> variable expansions, like you see above.
>
> Is this simpler to do with owcc?  Right now I'm attempting to build a
> static library, and not a DLL on OS/2.  Can I create .LIB files with
> owcc?

owcc is a wrapper/driver for using without makefiles. If you sue
makefiles, why not call the wcc, ... directly.

> Does Wmake have any magic I can use to convert the space separated
> objects into a comma separated list?
>
> Right now I'm trying to get a feel for my options, about how I can
> do this with OpenWatcom, without requiring external tools.  I have
> not seen anything immediately obvious to use, in the Wmake, Wlink
> and owcc manuals.
>
>
From the lguide.pdf with cut&paste, so formatting is not good:

The Open Watcom Linker
library %libdir%\mylib
is equivalent to the following linker directive.
library \test\mylib
Note that a space must precede a reference to an environment variable.
Many directives can take a list of one or more arguments separated by
commas. Instead of a
comma-delimited list, you can specify a space-separated list provided
the list is enclosed in braces (e.g., {
space delimited list }). For example, the "FILE" directive can take a
list of object file names as an
argument.
file first,second,third,fourth
The alternate way of specifying this is as follows.
file {first second third fourth}
Where this comes in handy is in make files, where a list of dependents
is usually a space-delimited list.
OBJS = first second third fourth
.
.
.
wlink file {$(objs)}
The following notation is used to describe the syntax of linker
directives and options.
ABC All items in upper case are required.
[abc] The item abc is optional.
{abc} The item abc may be repeated zero or more times.
{abc}+ The item abc may be repeated one or more times.
a|b|c One of a, b or c may be specified.
a ::= b The item a is defined in terms of b.
Certain characters have special meaning to the linker. When a special
character must appear in a name, you
can imbed the string that makes up the name inside apostrophes (e.g.,
’name@8’). This prevents the linker
from interpreting the special character in its usual manner. This is
also true for file or path names that
contain spaces (e.g., ’\program files\software\mylib’). Normally, the
linker would interpret a space or
blank in a file name as a separator. The special characters are listed
below:
18
Linker Directives and Options

CU/2
Frank

Hans-Bernhard Bröker

unread,
Apr 21, 2018, 8:16:37 AM4/21/18
to Johann 'Myrkraverk' Oskarsson
Am 21.04.2018 um 06:57 schrieb Johann 'Myrkraverk' Oskarsson:
> I've gotten to the stage in my OpenSSL port where the the makefile is
> trying to build the first library.

> However, if I just add the "name" directive for Wlink [...]

You're looking in entirely the wrong direction. wlink will _not_ build
a static library for you. Neither will owcc or, for that matter, gcc.

You need a librarian tool here. In original Unix world, this would have
been "ar", OW uses "wlib" instead.

> Note: I can easily remove the $(RM) and $(RANLIB) lines, by editing the
> generator; a perl script.  I am not so sure I can easily make it build
> a comma separated list directly in the make file since it just generates
> variable expansions, like you see above.

You won't need commas. You're supposed to need '+' signs prepended to
every object file name instead --- but it appears wlib will allow
leaving them out, too.

I.e. just call

wlib $(libname) $(LIS_OF_OBJECT)

and you should be in the clear.

Johann 'Myrkraverk' Oskarsson

unread,
Apr 21, 2018, 8:46:08 AM4/21/18
to
Frank Beythien wrote:

> owcc is a wrapper/driver for using without makefiles. If you sue
> makefiles, why not call the wcc, ... directly.

I am. It's only when I cannot figure out how to use the other tools
that I consider owcc.

> From the lguide.pdf with cut&paste, so formatting is not good:

Thank you. I've been reading the manual in the OS/2 online help
format, and hadn't seen these parts.

My problem now is that I don't know how to use wlink (or any other
tool) to make OS/2 .LIB files correctly.

Apparently

wlink file library.lib name { obj1 obj2 } option undefsok

is not how it's done.

Is there some other tool I should be using instead?

Johann 'Myrkraverk' Oskarsson

unread,
Apr 21, 2018, 8:50:19 AM4/21/18
to
Hans-Bernhard Bröker wrote:

> You're looking in entirely the wrong direction.  wlink will _not_ build
> a static library for you.  Neither will owcc or, for that matter, gcc.
>
> You need a librarian tool here.  In original Unix world, this would have
> been "ar", OW uses "wlib" instead.

Thank you. I had not seen your message when I wrote my earlier one.

Frank Beythien

unread,
Apr 21, 2018, 9:33:02 AM4/21/18
to
Am 21.04.2018 um 14:46 schrieb Johann 'Myrkraverk' Oskarsson:
> Frank Beythien wrote:
>
>> owcc is a wrapper/driver for using without makefiles. If you sue
>> makefiles, why not call the wcc, ... directly.
>
> I am.  It's only when I cannot figure out how to use the other tools
> that I consider owcc.

There are tools.{pdf,inf}.

CU/2
Frank



Dave Yeo

unread,
Apr 21, 2018, 1:43:46 PM4/21/18
to
I've always cheated by using emxomfar.exe which acts much like ar. Note
that ranlib isn't needed and should be set to something like echo.
Dave

Johann 'Myrkraverk' Oskarsson

unread,
Apr 22, 2018, 6:41:06 AM4/22/18
to
Dave Yeo wrote:

> I've always cheated by using emxomfar.exe which acts much like ar. Note
> that ranlib isn't needed and should be set to something like echo.
> Dave

I actually commented out the ranlib line from the make file generator,
as covered here:


http://www.myrkraverk.com/blog/2018/04/building-openssl-with-openwatcom-on-arcaos-first-porting-effort/

It seems using wlib without the + signs did the trick; from what I can
tell so far, the libraries are generated correctly and some executables
are building. And some aren't; that'll wait until next time to figure
out.

Mat Nieuwenhoven

unread,
Apr 24, 2018, 1:33:50 PM4/24/18
to
On Sat, 21 Apr 2018 20:46:05 +0800, Johann 'Myrkraverk' Oskarsson wrote:

>Frank Beythien wrote:
>
>> owcc is a wrapper/driver for using without makefiles. If you sue
>> makefiles, why not call the wcc, ... directly.
>
>I am. It's only when I cannot figure out how to use the other tools
>that I consider owcc.
>
>> From the lguide.pdf with cut&paste, so formatting is not good:
>
>Thank you. I've been reading the manual in the OS/2 online help
>format, and hadn't seen these parts.
>
>My problem now is that I don't know how to use wlink (or any other
>tool) to make OS/2 .LIB files correctly.
>
>Apparently
>
> wlink file library.lib name { obj1 obj2 } option undefsok
>
>is not how it's done.
>
>Is there some other tool I should be using instead?
>

wlib handles libraries.

Mat Nieuwenhoven


0 new messages