rtdickerson@lescsse.jsc.nasa.gov (russel dickerson) (06/13/91)
We are trying to build the MIT source for X11R4. Everything seems to build fine but when we try to build some X applications using the libraries, we get: ld warning: Symbol _qfree will link to shared library ld warning: Symbol _XHeadOfDisplay will link to shared library ld warning: Symbol _Xdebug will link to shared library ld warning: Symbol _XIOErrorFunction will link to shared library ld warning: Symbol _XErrorFunction will link to shared library ld warning: Symbol XrmQString will link to shared library We don't have any shared libraries!! I looked into the source in lib/X and found all references to _qfree et al to be externs. I cannot find where the variables are actually declared. I just ftp'ed the source from MIT thinking that my source was corrupt but I still don't see the actual declaration of these variables, just the externs. I compared X11R3 and found them declared there. We've got our backs against the wall due to schedule constraints and we need to solve this ASAP. System : HP/Apollo DN4500 running 10.3 We have the MIT source and patches 1-18. -- Russell Dickerson : Internet: dickerson@vf.jsc.nasa.gov +1 713 283 5193 Lockheed (LESC) % Space Station Freedom Software Support Environment (SSE) [ The prior material was generated by the standard issue opinion generator and in no way represents my employeer/NASA/ or maybe even myself ]
nazgul@alphalpha.com (Kee Hinckley) (06/18/91)
In article <rtdickerson.676829796@node_25d97> dickerson@vf.jsc.nasa.gov writes: >We are trying to build the MIT source for X11R4. Everything seems >to build fine but when we try to build some X applications using >the libraries, we get: > >ld warning: Symbol _qfree will link to shared library >ld warning: Symbol _XHeadOfDisplay will link to shared library >ld warning: Symbol _Xdebug will link to shared library >ld warning: Symbol _XIOErrorFunction will link to shared library >ld warning: Symbol _XErrorFunction will link to shared library >ld warning: Symbol XrmQString will link to shared library > >We don't have any shared libraries!! I looked into the source in Yes you do. Look in /lib. You've got two choices here. If you dig up the declarations of the _ variables you will discovered that they are all declared in macros that can go one of two ways. The default is just to define the variable. E.g. "int foo;". The problem is a cute little C quirk. If you, in a normal C program, said "int errno;" the linker would be smart when it linked with the c libraries and would realize this was the same as the global variable of the same name. You currently have a situation where you have two variables of the same name, one in a global library which you don't want to reference, and one in the static library which you do. The linker is being too smart and assuming you want the global one (it has no way of knowing you want to override the global library). You have two choices. Change the variable names, or (I haven't tried this, but it should work) change the definitions to say int foo = NULL; The explicit assignment should tell the compiler that this is a definition, not a reference. As I noted earlier, there are macros to do this for the _ variables, but someone forgot to do it for XrmQString. Someone should probably submit a formal bug report on this. -- Alfalfa Software, Inc. | Poste: The EMail for Unix nazgul@alfalfa.com | Send Anything... Anywhere 617/646-7703 (voice/fax) | info@alfalfa.com I'm not sure which upsets me more: that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.
tomg@hpcvlx.cv.hp.com. (Thomas J. Gilg) (06/22/91)
> We are trying to build the MIT source for X11R4. Everything seems > to build fine but when we try to build some X applications using > the libraries, we get: > > ld warning: Symbol _qfree will link to shared library > ld warning: Symbol _XHeadOfDisplay will link to shared library > ld warning: Symbol _Xdebug will link to shared library > ld warning: Symbol _XIOErrorFunction will link to shared library > ld warning: Symbol _XErrorFunction will link to shared library > ld warning: Symbol XrmQString will link to shared library You've run into a Domain/OS shared library quirk. If you look at globals.c, you'll see _qfree, _XHeadOfDisplay, _Xdebug, _XIOErrorFunction, and _XErrorFunction declared _but not initialized_. Variables declared but not initialized get put into the BSS segment rather than the DATA segment and are implicitly initialized to zero. Ditto this for XrmQString in Xrm.c The quirk; for Domain/OS shared libraries, uninitialized variables act like initialized variables in that they are explicitly set to zero. When linking an application against libX11.a, the linker first finds the implicitly initialized variables in libX11.a, _but then it continues_ to search for someone who might have explicitly initialized these same variables. After passing through the link line, it scans the globally known libraries (see /etc/sys.conf), finds the 6 symbols in /lib/x11lib, and takes those over the previous versions it found. Here's the fix: For globals.c, set/abuse the define flag NULL_NOT_ZERO. When the first five symbols are declared, they will be initialized to 0/NULL. For Xrm.c, take advantage of the predefined "NULLQUARK" and change the declaration of XrmQString to "XrmQuark XrmQString = NULLQUARK;" ----------------------------------------------------------------------- Thomas Gilg | tomg@cv.hp.com | INTERNET Hewlett-Packard Company | {backbone}!hplabs!hpcvlx!tomg | UUCP 1000 N.E. Circle Blvd. | (USA) (503) 750-2756 | VOICE Corvallis, OR 97330 | (USA) (503) 750-3788 | FAX -----------------------------------------------------------------------