Discussion:
Building static libraries with wlink or owcc?
(too old to reply)
Johann 'Myrkraverk' Oskarsson
2018-04-21 04:57:11 UTC
Permalink
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
2018-04-21 07:46:20 UTC
Permalink
Post by 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.
Post by Johann 'Myrkraverk' Oskarsson
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.,
’***@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
Johann 'Myrkraverk' Oskarsson
2018-04-21 12:46:05 UTC
Permalink
Post by Frank Beythien
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.
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 | email: invalid -> com | www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | twitter: @myrkraverk
Frank Beythien
2018-04-21 13:33:00 UTC
Permalink
Post by Frank Beythien
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
Mat Nieuwenhoven
2018-04-24 17:33:47 UTC
Permalink
Post by Johann 'Myrkraverk' Oskarsson
Post by Frank Beythien
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.
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

Hans-Bernhard Bröker
2018-04-21 12:16:26 UTC
Permalink
Post by 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.
Post by Johann 'Myrkraverk' Oskarsson
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
2018-04-21 12:50:18 UTC
Permalink
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.
--
Johann | email: invalid -> com | www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | twitter: @myrkraverk
Dave Yeo
2018-04-21 17:43:56 UTC
Permalink
Post by 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?
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.
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
2018-04-22 10:41:03 UTC
Permalink
Post by Dave Yeo
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.
--
Johann | email: invalid -> com | www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | twitter: @myrkraverk
Loading...