Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!fernwood!lia!steve From: steve@lia (Stephen Williams) Newsgroups: comp.windows.x Subject: Re: Sun shared libs - openwin vs MIT R4 Message-ID: <1991May10.010143.7028@lia> Date: 10 May 91 01:01:43 GMT References: <1991May8.210941.4846@watdragon.waterloo.edu> Reply-To: steve@lia.com (Stephen Williams) Organization: Litton/Integrated Automation, Alameda, California Lines: 40 In article <1991May8.210941.4846@watdragon.waterloo.edu> jmsellens@watdragon.waterloo.edu (John M. Sellens) writes: >Sun, in their wisdom, forces OpenWindows users to set LD_LIBRARY_PATH >in order to find the shared libraries in /usr/openwin/lib, instead of >putting them somewhere normal, like /usr/lib for example, or using an >appropriate -L on the cc command line when they link the applications. > I too have fought this battle. >I have the MIT shared libraries somewhere else (doesn't really matter where). >I'm having trouble convincing my MIT binaries to ignore LD_LIBRARY_PATH, >and use the library paths that I gave them when I linked them. I checked >the FAQ, but it didn't seem to answer this question. Here are the rules: At link time, the compiler uses the -L switches to search directories for libraries. If this fails, then the LD_LIBRARY_PATH variable is searched. The paths passed to ld are stored in the object file. At run time, LD_LIBRARY_PATH is search FIRST for needed libraries. If this search fails then the stored directories are searched. If you ask me, this is brain-damage for sure, but I suppose someone had a good reason for this. The mess happens when two libraries from 2 different packages (MIT X11 and OpenLook, for example) exist. If the libraries are in different places, and can be found with encoded -L paths, and are NOT in any directories in the LD_LIBRARY_PATH, then all is well. However, if LD_LIBRARY_PATH contains a directory that has a copy of said shared object ... oh well. There are 2 solutions. (Actually 3, but the third is not polite.) First, you can make little shell scripts for all your OPENLOOK tools that munge the LD_LIBRARY_PATH just for them. Alternatively, you can use strings -a to find the paths that were used to find the libraries when they were linked, and you can put symbolic links there. Either way, you will no longer need LD_LIBRARY_PATH set. (By the way, I think /Proto/4.0/Xnews/sun4/usr/lib will probably work.) --Steve