[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

449.0. "Problem with multiply defined _calloc on Ultrix" by LDP::WEAVER (Laboratory Data Products/Science) Tue Mar 21 1989 20:25

    Has anyone seen the following error on Ultrix?
    
    "_calloc: ld:/lib/libc.a(calloc.o): multiply defined"
    
    I get this whether using "vcc" or "cc" (pcc) and I can't seem to
    get rid of it, I also think it is preventing my .out file from
    getting execute access.  Can anyone help?
    
    						Thanks,
    						-Dave

T.RTitleUserPersonal
Name
DateLines
449.1MIPSBX::thomasThe Code WarriorWed Mar 22 1989 11:372
What does your link line look like?

449.2vcc -o prg mod1.o mod2.o mod3.o mod4.o mod5.o -ldwt -lX11 -lmLDP::WEAVERLaboratory Data Products/ScienceWed Mar 22 1989 14:5418
    vcc -o prg mod1.o mod2.o mod3.o mod4.o mod5.o -ldwt -lX11 -lm
    
    I have also replaced the ".o"'s with ".c"'s to force recompilation.
    The same behaviour occurs with either "vcc" or "cc" (pcc).  I haven't
    tried it on a PMAX yet.
    
    I posted a slightly later note in the "X" conference and someone
    said it is a known problem (I also received mail from someone saying
    it is a known problem).  Both people said there was a note discussing
    the problem, but I have been unable to find it either here or in
    the X conference.
    
    If I remove the "-lX11" I then get all the X routines undefined
    but I don't get the multiply defined _calloc, so I believe the problem
    lies in Ultrix' libX11.a.
    
    							-Dave

449.3MIPSBX::thomasThe Code WarriorWed Mar 22 1989 18:083
Where are your references to calloc and cfree?  You might want to change
them to XtCalloc and XtFree.

449.4That may be just the ticket (the Ultrix bug should still be fixed)LDP::WEAVERLaboratory Data Products/ScienceWed Mar 22 1989 18:3110
    That sounds like a good possibility; in an ideal world one would
    only use XtCalloc for X related allocations, and calloc for normal
    C allocations (stuff not bound to DECwindows).
    
    Looking at the docs I see there are equivalents for all the C *alloc
    functions.
    
    						Thanks for the suggestion,
    						-Dave

449.5Ultrix QAR system anywhere?LDP::WEAVERLaboratory Data Products/ScienceWed Mar 22 1989 18:332
    Is there an Ultrix QAR system somewhere for internal use?

449.6node gorgeFUEL::grahamif ya want home cookin, stay homeWed Mar 22 1989 19:517
username::qar_internal
password:qar

Please check though...

Kris..

449.7bug in -lX11, possible workaroundHIT::GLASERSteve Glaser DTN 237-2586 SHR1-3/E29Wed Mar 22 1989 20:2335
    There was a note concerning this in the GNU conference.
    
    GNU Emacs uses its own malloc and free but did not provide a calloc.
    
    The standard c library calloc is perfectly happy to work on top
    of any malloc.  It doesn't require the one from libc.
    
    The Ultrix X library provides a replacement malloc (in module
    XvmsAlloc.o of /usr/lib/libX11.a).  There are supposed to be some
    performance imporvements in this malloc.
    
    Problem is that the version in the X library has one object module
    (XvmsAlloc.o) that contains four subroutines malloc, calloc, free and
    realloc. This prevents you supplying your own malloc and using calloc
    from the library.  You will get multiply defined symbols like you
    were seeing.
    
    You might try
    
    vcc ...mumble... -lc -ldwt -lX11 -lm
    
    (e.g. include -lc twice, once early on and once at the end).
    
    P.S. The calloc in libX11.a is also buggy, it doesn't check to see if
    the call on malloc succeeded and blindly goes out attempting to zero a
    buffer starting at location zero. 
    
    P.P.S.  I have not submitted this as a QAR because (1) I have not
    gotten any response on the QAR's I've submitted so far -- for all I
    know they are disappearing into a black hole and (2) the qar databases
    listed on node gorge are limited to field test software and I'm running
    SDC Ultrix Workstation Software.  [If you notice minor frustration,
    you're right...] 
    

449.8PSW::WINALSKIPaul S. WinalskiWed Mar 22 1989 21:487
.7 has it right.  Try specifying -lc earlier on in the command line:

    vcc -o prg mod1.o mod2.o mod3.o mod4.o mod5.o -lc -ldwt -lX11 -lm
						  ^^^^
 
--PSW

449.9Xt*alloc seems to be workingLDP::WEAVERLaboratory Data Products/ScienceThu Mar 23 1989 13:098
    I am now using XtMalloc, XtCalloc and XtFree rather than malloc,
    calloc, free, cfree and it seems to be working OK and I no longer
    get the the multiply defined _calloc.  The problem still should
    be fixed, if anyone can provide a definitive QAR file for Ultrix
    I will QAR the problem.
    
    						-Dave