[comp.sys.att] 3b1 shared library problems

dave@dms3b1.UUCP (Dave Hanna) (04/14/88)

I have a problem that turned up when I tried to remake the news 
software for my 3b1.  The problem is that, when linking the shared libraries,
the symbol "daylight", which, according to the manual  CTIME(3C) is
an external int defined in  ctime, is not defined in the shared 
library ifile. The following simple file demonstrates the problem:


File chktime.c:

#include <stdio.h>
#include <time.h>

main(argc,argv)
    char **argv;
    int argc;
{
    long now = time ( (long *) 0 );

    printf ("%s", ctime(&now));
    if ( daylight ) printf("Daylight time is %d\n", daylight);
    else printf ("Daylight time is 0\n");
}

The command line
	cc chktime.c

produces an a.out that runs as expected.

The command sequence:
	cc -c chktime.c ; ld /lib/crt0s.o /lib/shlib.ifile chktime.o

produces a complaint of an undefined symbol "daylight".

I encountered the problem because the module ftime.c in the news software
contains a reference to "daylight", and the makefile I was trying to 
use tried to link with shared libraries.

Questions:  1) I suspect "daylight" is not the only symbol that has
this difficulty.  Does anyone know of others?
	2) Does anyone know a way around this other than not using
shared libraries?

dhesi@bsu-cs.UUCP (Rahul Dhesi) (04/14/88)

In article <103@dms3b1.UUCP> dave@dms3b1.UUCP (Dave Hanna) writes:
>The problem is that, when linking the shared libraries,
>the symbol "daylight", which, according to the manual  CTIME(3C) is
>an external int defined in  ctime, is not defined in the shared 
>library ifile. 

I've seen patches to shlib.i (or a similarly-named file), but my fix
was to use code that doesn't use "daylight" at all but can still find
out timezone.  The following is from the zoo source code.  The
tm->tm_isdst field tells you if daylight savings time is in effect.

extern long timezone;   /* defined by library routine */
long time ();
struct tm *localtime ();

/* Function gettz(), returns the offset from GMT in seconds of the
local time, taking into account daylight savings time */
long gettz()
{
   struct tm *tm;
   long clock;
   clock = time ((long *) 0);
   tm = localtime (&clock);
   return (timezone - tm->tm_isdst*3600);
}
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi

lenny@icus.UUCP (Lenny Tropiano) (04/17/88)

In article <103@dms3b1.UUCP> dave@dms3b1.UUCP (Dave Hanna) writes:
|>
|>I have a problem that turned up when I tried to remake the news 
|>software for my 3b1.  The problem is that, when linking the shared libraries,
|>the symbol "daylight", which, according to the manual  CTIME(3C) is
|>an external int defined in  ctime, is not defined in the shared 
|>library ifile. The following simple file demonstrates the problem:
|>
|>
...
|>
|>Questions:  1) I suspect "daylight" is not the only symbol that has
|>this difficulty.  Does anyone know of others?
|>	2) Does anyone know a way around this other than not using
|>shared libraries?

Well here's an old article that I saved that referred to the missing
"daylight" variable from ctime(3C) in /lib/shlib.ifile.

|Article 1722 of comp.sys.att:
|Path: icus!mtune!rutgers!uwvax!oddjob!hao!ames!ptsfa!maxepr!ken
|>From: ken@maxepr.UUCP (Ken Brassler)
|Newsgroups: comp.sys.att,comp.unix.questions,news.software.b
|Subject: Re: news on a 3B1
|Message-ID: <493@maxepr.UUCP>
|Date: 18 Feb 88 23:55:50 GMT
|References: <576@eplrx7.UUCP>
|Reply-To: ken@maxepr.UUCP (Ken Brassler)
|Organization: Brassler Engineering Co., Mill Valley, CA
|Lines: 29
|Xref: icus comp.sys.att:1722 comp.unix.questions:2436 news.software.b:51
|
|In article <576@eplrx7.UUCP> lad@eplrx7.UUCP (Lawrence A. Dziegielewski) 
|writes:
|>I am trying to install Bnews 2.11 on my ATT 3B1.
|>....  However,  when the makefile tried to link
|>up readnews,  the file ftime.o was flagged as having and unreferenced
|>variable,  namely 'daylight'.   
|>
|>Has anyone ever run up against this before?  
|
|Yes.
|
|This is the fix that I used, but I can't find the original article
|that suggested it. It seems to work.
|
|Put a copy of the shlib.ifile in the ...news/src directory. Edit
|this local copy and add the line:
|
|daylight = 0x303658
|
|Change the Makefile to reference this local copy of shlib.ifile, and
|re-make.
|
|Obviously, 0x303658 is supposed to be the address where the
|"daylight" variable is stored. I have no first hand knowledge that
|this is true - I just took the first person's word for it. I'm
|running version 3.50 O/S, and my news has been operating with
|this fix for over 2 years.
|-- 
|
|Ken Brassler {ihnp4|qantel|pyramid|lll-crg}!pacbell!maxepr!ken
|
|


-- 
US MAIL  : Lenny Tropiano, ICUS Computer Group        IIIII  CCC U   U  SSS
           PO Box 1                                     I   C    U   U S
	   Islip Terrace, New York  11752               I   C    U   U  SS 
PHONE    : (516) 968-8576 [H] (516) 582-5525 [W]        I   C    U   U    S
TELEX    : 154232428 [ICUS]                           IIIII  CCC  UUU  SSS 
AT&T MAIL: ...attmail!icus!lenny  
UUCP     : ...{mtune, ihnp4, boulder, talcott, sbcs, bc-cis}!icus!lenny