bo@hubcap.clemson.edu (Bo Slaughter) (10/15/90)
After compiling a program, and then trying to run it I get this message: ld.so: Undefined symbol: __XtInherit I have both the X11R4 and OpenWindows II libraries. I have the "-lXt" on my compile statement, I have all the files included that I believe should be included. I have ran ranlib and ldconfig on my libraries to make sure there up to date. My question is where is XtInherit defined? Can anyone tell me how to fix this? Thanks, -Bo -- +--------------------------------------------------------------+ | Bo Slaughter bo@gumby.eng.clemson.edu | | (803)656-2721 "I'm gumby.eng.clemson.edu dammit." | +--------------------------------------------------------------+
gram@uctcs.uucp (Graham Wheeler) (10/18/90)
I too have had this exact same error. I did a fgrep on the output of nm applied to the Xt library and found that the symbol *did* exist in the library and was defined. Running ranlib didn't help. Eventually I gave up (I posted the problem but never received any responses). Graham Wheeler | "Don't bother me, Data Network Architectures Lab| I'm reading a `Crisis'!" Dept. of Computer Science | Internet: <gram.uctcs@f4.n494.z5.fidonet.org> University of Cape Town | BANG: <...uunet!ddsw1!olsa99!uctcs!gram>
milton@ecn.purdue.edu (Milton D Miller) (10/21/90)
In article <850@ucthpx.UUCP> gram@staff.UUCP (Graham Wheeler) writes: >I too have had this exact same error. I did a fgrep on the output of nm applied >to the Xt library and found that the symbol *did* exist in the library and was >defined. Running ranlib didn't help. Eventually I gave up (I posted the problem >but never received any responses). Somebody posted this a while back, and I have verified it worked for me the time I needed it. The short answer is if you don't use Xt in your program, then don't link with it if you are using shared libraries. My understanding of what is happening (someone feel free to correct me): [Note: I will refer to the C function names here, add another _ to get the symbol names reported by ld -- milton] _XtInherit is a stub c function in the unshared library that calls __XtInherit in the shared library. This stub function is there to avoid some problem with data initialization (the function pointer is used to initialize fields in several data structures), at least if I am reading the comments in the code correctly (the stub function is in shared.c, I forget which file has the real function). When you link your application (which doesn't use Xt) no reference is made to _XtInherit, so the unshared library segment is not included by the linker. However, the shared object name is still placed in the list of libraries to be accessed at runtime by ld.so. It is in the shared object that the references to _XtInherit are being generated, hence the error. I suppose another solution would be to explicitly tell the loader to add _XtInherit to the list of undefined symbols, but this would just create an unnecessarly large executable. milton Milton D. Miller II, ECN Student consultant, Purdue University milton@ecn.purdue.edu pur-ee!milton
eager@ringworld.Eng.Sun.COM (Michael J. Eager) (10/24/90)
In article <10955@hubcap.clemson.edu> bo@hubcap.clemson.edu (Bo Slaughter) writes: >After compiling a program, and then trying to run it I get this message: > >ld.so: Undefined symbol: __XtInherit > >I have both the X11R4 and OpenWindows II libraries. I have the "-lXt" on >my compile statement, I have all the files included that I believe should >be included. I have ran ranlib and ldconfig on my libraries to make sure >there up to date. > >My question is where is XtInherit defined? Can anyone tell me how to >fix this? Check your LD_LIBRARY_PATH setting to make sure that it includes the path to the library containing Xt. -- Mike Eager