🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53451

Re-entrant and the usual libc library relation (on OSF/1)

#53451
From: Gyota Yasoda
Date: Fri, 31 Jan 1992 21:48
84 lines
3797 bytes
    I have an application that has to use some of the functions of
re-entrant library (libc_r.a). But when I try to link this application
it would complain in the following way.

-------------------------------------------------------------------------------
cc -o timop_client timop_client.o timop_cstub.o timop_caux.o -L/opt/dcelocal/lib
 -ldce -lc_r -lc -lbsd 
-------------------------------------------------------------------------------
ld: multiple definitions of symbol `setpwfile'.  Files:
 /lib/libc.a(getpwent.o)
ld: multiple definitions of symbol `setpwent'.  Files:
 /lib/libc.a(getpwent.o)
ld: multiple definitions of symbol `endpwent'.  Files:
 /lib/libc.a(getpwent.o)
ld: multiple definitions of symbol `mktime'.  Files:
 /lib/libc.a(ctime.o)
ld: multiple definitions of symbol `tzset'.  Files:
 /lib/libc.a(ctime.o)
ld: multiple definitions of symbol `timezone'.  Files:
 /lib/libc.a(ctime.o)
ld: multiple definitions of symbol `daylight'.  Files:
 /lib/libc.a(ctime.o)
ld: multiple definitions of symbol `longjmp'.  Files:
 /lib/libc.a(setjmp.o)
ld: multiple definitions of symbol `ds_in_effect'.  Files:
 /lib/libc.a(ctime.o)
ld: multiple definitions of symbol `tzname'.  Files:
 /lib/libc.a(ctime.o)
ld: multiple definitions of symbol `_pw_file'.  Files:
 /lib/libc.a(getpwent.o)
*** Exit 1


    When I switch the order of -lc_r and -lc, it would complain like
this.

-------------------------------------------------------------------------------
cc -o timop_client timop_client.o timop_cstub.o timop_caux.o -L/opt/dcelocal/lib
 -ldce -lc -lc_r -lbsd 
-------------------------------------------------------------------------------
ld: multiple definitions of symbol `mktime'.  Files:
 /lib/libc_r.a(ctime.o)
ld: multiple definitions of symbol `tzset'.  Files:
 /lib/libc_r.a(ctime.o)
ld: multiple definitions of symbol `timezone'.  Files:
 /lib/libc_r.a(ctime.o)
ld: multiple definitions of symbol `daylight'.  Files:
 /lib/libc_r.a(ctime.o)
ld: multiple definitions of symbol `ds_in_effect'.  Files:
 /lib/libc_r.a(ctime.o)
ld: multiple definitions of symbol `tzname'.  Files:
 /lib/libc_r.a(ctime.o)
*** Exit 1
Stop.


    Not specifying -lc at all would produce the same result as the first
case.

    Is this caused because,

1. I am trying to link in a wrong way, or
2. My libc.a or libc_r.a was built the wrong way, or
3. It's something to do with the gcc(and/or ld) itself, or
4. Something else.

    I quite don't understand why it says, "multiple definitions of ...",
because, I would assume that the linker fetches the first symbol it
finds in the command line and just ignores the ones with the same name
that come up later in its search.

    Any information will be greatly appreciated.

    I am using "gcc version 1.37.1 OSF 1.8.1.12 OSF/1 Dec Mips Oct 31
1990" on OSF/1 1.0

===============================================================================

          Gyota Yasoda [yasoda@hri.com]

     Horizon Research Institute, Massachusetts

===============================================================================
Technical Details
Message-ID: <YASODA.92Jan31164850@sparc40.hri.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!spool.mu.edu!hri.com!bigbird!yasoda

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,58a7593ba2345c51,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-01-31 14:01:16 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!spool.mu.edu!hri.com!bigbird!yasoda
From: yasoda@hri.com (Gyota Yasoda)
Newsgroups: gnu.gcc.help
Subject: Re-entrant and the usual libc library relation (on OSF/1)
Message-ID: <YASODA.92Jan31164850@sparc40.hri.com>
Date: 31 Jan 92 21:48:50 GMT
Article-I.D.: sparc40.YASODA.92Jan31164850
Sender: news@hri.com.hri.com
Distribution: gnu
Organization: Horizon Research Inc.,Waltham MA
Lines: 84
Nntp-Posting-Host: sparc40.hri.com