Discussion:
OWCC POSIX driver bug for 16-bit applications
(too old to reply)
William D. Jones
2013-03-01 05:07:03 UTC
Permalink
Hello all,

Does anyone know whether the Open Watcom POSIX compiler driver functions
correctly for 16-bit targets

For any 16-bit target (dos, qnx), or ANY target that does not use
"wcc386", the owcc program chooses to use "wcc386" instead of the required
compiler (while otherwise setting other options). This leads to a number
of linker errors including missing symbols and attempting to combine
32-bit code with 16-bit libraries. Is this a known bug, incorrect version
or is it possible that I'm not passing in the correct settings?

I can duplicate this error on a simple hello world program with the
following settings. Notice that "wcc386" instead of "wcc" is used:

F:\Projects\sanity>owcc -v -bdos hello.c
Open Watcom C/C++ Compiler Driver Program Version 1.9
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
wcc386 hello.c -bt=dos -fo=.o -fr
Open Watcom C32 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
hello.c: 7 lines, included 771, 0 warnings, 0 errors
Code size: 26
wlink @__owcc__.lnk
Open Watcom Linker Version 1.9
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
Warning! W1080: file hello.o is a 32-bit object file
searching libraries
Warning! W1008: cannot open clib3r.lib : No such file or directory
Warning! W1008: cannot open math387r.lib : No such file or directory
Warning! W1008: cannot open emu387.lib : No such file or directory
Error! E2028: __CHK is an undefined reference
Error! E2028: printf_ is an undefined reference
Error! E2028: _cstart_ is an undefined reference
Warning! W1014: stack segment not found
Warning! W1023: no starting address found, using 0000:0000
creating a DOS executable
file hello.o(F:\Projects\sanity\hello.c): undefined symbol __CHK
file hello.o(F:\Projects\sanity\hello.c): undefined symbol printf_
Error: Linker returned a bad status

Based on browsing the source code for "owcc.c", I know owcc is reading the
"specs.owc" file because removing it yields a "file not found".

Thanks for your help in advance.
--
Using Opera's mail client: http://www.opera.com/mail/
Binarus
2013-03-01 11:18:25 UTC
Permalink
Post by William D. Jones
Hello all,
Does anyone know whether the Open Watcom POSIX compiler driver functions correctly for 16-bit targets
For any 16-bit target (dos, qnx), or ANY target that does not use "wcc386", the owcc program chooses to use "wcc386" instead of the required compiler (while otherwise setting other options). This leads to a number of linker errors including missing symbols and attempting to combine 32-bit code with 16-bit libraries. Is this a known bug, incorrect version or is it possible that I'm not passing in the correct settings?
F:\Projects\sanity>owcc -v -bdos hello.c
Open Watcom C/C++ Compiler Driver Program Version 1.9
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
wcc386 hello.c -bt=dos -fo=.o -fr
Open Watcom C32 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
hello.c: 7 lines, included 771, 0 warnings, 0 errors
Code size: 26
Open Watcom Linker Version 1.9
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
Warning! W1080: file hello.o is a 32-bit object file
searching libraries
Warning! W1008: cannot open clib3r.lib : No such file or directory
Warning! W1008: cannot open math387r.lib : No such file or directory
Warning! W1008: cannot open emu387.lib : No such file or directory
Error! E2028: __CHK is an undefined reference
Error! E2028: printf_ is an undefined reference
Error! E2028: _cstart_ is an undefined reference
Warning! W1014: stack segment not found
Warning! W1023: no starting address found, using 0000:0000
creating a DOS executable
file hello.o(F:\Projects\sanity\hello.c): undefined symbol __CHK
file hello.o(F:\Projects\sanity\hello.c): undefined symbol printf_
Error: Linker returned a bad status
Based on browsing the source code for "owcc.c", I know owcc is reading the "specs.owc" file because removing it yields a "file not found".
Thanks for your help in advance.
Hi,

I admit that I never tried to understand what a compiler driver is all about.

But I am currently porting a big DOS 16-bit project from another toolchain to OpenWatcom, and have had some problems, but not with the C compiler. I use wcc instead of owcc (actually, I didn't even notice that there is an owcc), and this does produce correct 16-bit code.

For development, I am using a virtual machine which is running Windows XP Pro. Therefore, I am using the OpenWatcom binaries from the \binnt subdirectory of the distribution.

I'm not sure, but it seems you have to use the binaries from \binl if your development box runs linux, \binp if it runs MAC/OS (?) and binw if it runs DOS or Windows 16-bit. But be careful: I did not thoroughly research that since in my case the binaries from \binnt are the right ones.

To summarize, the salient point in your case is using wcc instead of owcc. wcc might have different command line options than owcc, though.

Regards,

Binarus
Paul S. Person
2013-03-01 18:12:20 UTC
Permalink
Post by Binarus
I'm not sure, but it seems you have to use the binaries from \binl if your development box runs linux, \binp if it runs MAC/OS (?) and binw if it runs DOS or Windows 16-bit. But be careful: I did not thoroughly research that since in my case the binaries from \binnt are the right ones.
binl is indeed for Linux, but it is (AFAICT) still "experimental"

binnt is for Win32

binp is for OS/2

binw is indeed for DOS/Win16 and also has some common items (default
configuration files, mostly).
--
"Nature must be explained in
her own terms through
the experience of our senses."
Paul S. Person
2013-03-01 18:04:47 UTC
Permalink
On Fri, 01 Mar 2013 00:07:03 -0500, "William D. Jones"
Post by William D. Jones
Hello all,
Does anyone know whether the Open Watcom POSIX compiler driver functions
correctly for 16-bit targets
I would not have thought so, since standards like POSIX tend to be
written for 32-bit only environments.

But apparently I am wrong.

The documentation in the Tools User's Guide Help file (which, despite
its name, gives help or guidance on using various tools, not help on
the Tool User's Guide) is, after a bit of close examination,
reasonably clear.

The "model" option includes both "flat" and "tiny", and "tiny" is
specifically stated to produce COM files, which would seem to require
the use of a 16-bit compiler.

And the "linker directive" "b" (which you are using) is clearly stated
to both compile and link for 16-bit when used with "dos" (as you are
doing) and "com".

The examples do not show the use of "b", but they do show "o", and
they show a space between the "o" and the file name. This is a matter
of sheer luck: the most frequently-used example option, "g", is used
without a parameter. This suggests that your command line.

F:\Projects\sanity>owcc -v -bdos hello.c

might work better as

F:\Projects\sanity>owcc -v -b dos hello.c

although I don't make any guarantees.
--
"Nature must be explained in
her own terms through
the experience of our senses."
Hans-Bernhard Bröker
2013-03-01 22:30:36 UTC
Permalink
Post by William D. Jones
Hello all,
Does anyone know whether the Open Watcom POSIX compiler driver functions
correctly for 16-bit targets
It does --- but only if you use the owcc.exe found in the binw
directory. Yes, that's wacky. And it's not really meant to behave that
way, either.

This was broken by Jiri Malak in Perforce change 34878, which killed the
mechanism that uses the specs.owc file to select a compiler and its -bt
option, based on owcc's -b option
William D. Jones
2013-03-02 00:23:34 UTC
Permalink
On Fri, 01 Mar 2013 17:30:36 -0500, Hans-Bernhard Br=F6ker =
Post by William D. Jones
Hello all,
Does anyone know whether the Open Watcom POSIX compiler driver functi=
ons
Post by William D. Jones
correctly for 16-bit targets
It does --- but only if you use the owcc.exe found in the binw =
directory. Yes, that's wacky. And it's not really meant to behave th=
at =
way, either.
This was broken by Jiri Malak in Perforce change 34878, which killed t=
he =
mechanism that uses the specs.owc file to select a compiler and its -b=
t =
option, based on owcc's -b option
Okay, I'm glad I'm not going too insane then :)!

I'm not sure if it's possible to build a single executable without runni=
ng =

the entire build script, looking at yesterday's source tree, but is it =

possible if I fix it that someone who has write access could commit my =

changes if I file a bug report?

For my application, using the binw directory executables (which requires=
a =

DOS platform) defeats the purpose of using the compiler driver. I'm tryi=
ng =

to port a 'cross-platform' library which uses a dreaded configure script=
=

to real mode DOS (through bash for Windows), which djgpp doesn't support=
. =

Since configure expects a POSIX compiler, I cannot use the standard =

binaries.

-- =

Using Opera's mail client: http://www.opera.com/mail/

Loading...