[comp.os.minix] Compiling zterm problems, won't link

bill@polygen.uucp (Bill Poitras) (09/22/89)

When I was compiling zterm under Minix 1.4a, I got the message
ctype.s, 94: _tolower mulitiple declared
This happens when compiling the 'rz' program in zterm.  Why
does this happen? Is it my library?  Any help would greatly be 
appreciated.


+-----------------+---------------------------+-----------------------------+
| Bill Poitras    | Polygen Corporation       | {princeton mit-eddie        |
|     (bill)      | Waltham, MA USA           |  buita sunne}!polygen!bill  |
+-----------------+---------------------------+-----------------------------+

mbeck@ai.mit.edu (Mark Becker) (09/23/89)

In article <551@fred.UUCP> bill@fred.UUCP (Bill Poitras) writes:
>When I was compiling zterm under Minix 1.4a, I got the message
>ctype.s, 94: _tolower mulitiple declared
>This happens when compiling the 'rz' program in zterm.  Why
>does this happen? Is it my library?  Any help would greatly be 
>appreciated.
>

I spent some time awhile ago tracking this down.  lib/scanf.c has a
supposedly static tolower() function buried in it and asld is getting
confused.  This little confusion doesn't arise with small programs;
just ones over some unknown limit.  Note that rz.s is around 46K.

Found it by libupacking libc.a and grepping for "tolower:".  Yup, two
occurances.

My being a complete neophyte at this level of software, I found two
different ways of fixing things so they would work.  I have no idea
which one is "right."

a) Since we now have tolower() in libc/ctype.s, comment the static
   function out of lib/scanf.c, re-compile lib/scanf.c, and use AR to
   replace it in /usr/lib/libc.a .

   This might require you to reorder your library to make sure that
   the functional tolower() occurs later in the library than scanf().

b) In zterm/rz.c, replace the reference to tolower() with _tolower() .
   include/ctype.h has a macro definition for _tolower() so this works
   as well.

I just thought of another possibility (this is untried) -

c) Comment out the tolower() in lib/scanf.c, replace references to it
   with the macro _tolower(), recompile and replace in libc.a .

I did (a).  Things still seem to work.  scanf.s is a little smaller.

I just wish I knew why we have both tolower() as a function _and_
_tolower() as a macro.

Regards,
Mark Becker
mbeck@ai.mit.edu

dcd@tc.fluke.COM (David Dyck) (09/26/89)

In article <551@fred.UUCP> bill@fred.UUCP (Bill Poitras) writes:
>When I was compiling zterm under Minix 1.4a, I got the message
>ctype.s, 94: _tolower mulitiple declared

I am running 1.3d using Bruce Evans protected mode kernel.
I had this problem also after installing 
	EFTH MINIX report #50  - October 1988 -  ctype(3) changes
	Subject: ctype(3) changes
	Message-ID: <524@uvicctr.UUCP>
	Date: 18 Oct 88 02:53:03 GMT
and found the not so static declaration of tolower in scanf.c
The changes to ctype.c included changing toupper and tolower
into subroutines from the macros that were in <ctype.h>

I see that EFTH #50 is part of 1.4a.

It seems that even though the tolower function in scanf is supposed to
be static, it is NOT.

At first I just #ifdef'ed out the tolower function in scanf, and
rebuilt the library.  This solution works.

Then I just added one line to the original scanf
	#define tolower scnftolr
I thought this a better temporary solution, since we no longer
get the name conflict and the original code is preserved.  An
added benefit, is that functions that call scanf are not forced to
include ctype.c and its _ctype table.

            David Dyck
    Domain: dcd@tc.fluke.COM
     Voice: +1 206 356 5807
      UUCP: {uw-beaver,decwrl,microsof,sun}!fluke!dcd
     Snail: John Fluke Mfg. Co. / P.O. Box C9090 / Everett WA  98206

paula@bcsaic.UUCP (Paul Allen) (09/26/89)

In article <551@fred.UUCP> bill@fred.UUCP (Bill Poitras) writes:
>When I was compiling zterm under Minix 1.4a, I got the message
>ctype.s, 94: _tolower mulitiple declared
>This happens when compiling the 'rz' program in zterm.  Why
>does this happen? Is it my library?  Any help would greatly be 
>appreciated.

I saw this after I applied Marty Leisner's controller_busy() patch
to my 1.3 at_wini.c.  While linking the kernel, asld complained
about "_control multiple declared" in table.c.  Running all of
kernel/*.s through libupack and grepping for 'control' turned
up *one* place where that symbol is declared: in table.s! 
Replacing the patched wini.c with the 1.3 at_wini.c cleared up
the problem, but leaves me with a driver that may have caused
the corruption that lost me a day's work not long ago.  :-(

Someone (can't find the reference just now) recently posted
that the "xxx multiple declared" asld bug was related to
code like:

	syma = symb
	.
	.
	.
	symb:
	.
	.

I don't see anything like this in table.s

Since my 1.3 kernel is suspect, the above compiling/linking was
done under 1.1 on a PC using the 1.2 compiler and the split I/D
asld that was posted a long time ago.

Any helpful hints will be greeted with wild enthusiasm!

Paul Allen


-- 
------------------------------------------------------------------------
Paul L. Allen                       | pallen@atc.boeing.com
Boeing Advanced Technology Center   | ...!uw-beaver!bcsaic!pallen