Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!magic706.chron.COM!sysnmc From: sysnmc@magic706.chron.COM (Matt Cohen) Newsgroups: comp.windows.x Subject: Re: LD_LIBRARY_PATH woes Message-ID: <9005251807.AA00379@magic706.chron.com> Date: 25 May 90 18:07:47 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 47 uunet!ssi!ssiwest!quenelle (Chris Quenelle) says: > > Execute "ldd xdvi" to see what libraries the dynamic linker expects to find. > > I suspect during the ld step, an R3 version of libX11 is getting used > > instead of the R4 version. We've had this problem when we set > > LD_LIBRARY_PATH and it includes the OpenWindows directories. > > I thought I'd post my solution to this. > Whenever I compile an X program, I'm always sure to unset LD_LIBRARY_PATH. > (This means you have to get the -L option right) > This has the disadvantage of making the binary less portable, > (the libraries have to be in the same place), but it has the advantage > of making that binary immune to the LD_LIBRARY_PATH variable at run-time. In general, you shouldn't need LD_LIBRARY_PATH at all. It looks like your setup is similar to mine, and many other people's: you run X11R4 most of the time, and OpenWindows sometimes. Just copy the OpenWindows dynamic libraries into /usr/lib and the dynamic loader takes care of everything. The secret is the loader's use of major and minor version numbers. The major version of the library that gets loaded must match the major version the program was compiled with. The loader uses the highest minor version available. The MIT libraries are major version 4, and the OpenWindows libraries are major version 0. So when you run a program, everything works fine since the OpenWindows program were compiled with version 0 libraries and the MIT programs with version 4. The only possible gotcha is when you want to compile a program to use the OpenWindows libraries, you have to use (for example) -lX11.0 instead of -lX11. In fact, I often use the OpenWindows mailtool while running MIT X11R4. Much thanks to Heather Rose who pointed out much of this in a posting a while back. Take a look at the manual pages ld(1) and ldd(1). Good luck! -- Matt Matt Cohen INET: sysnmc@chron.com Department of Technology Resources UUCP: ...!uunet!chron!sysnmc The Houston Chronicle AT&T: +1 713 220 7023 801 Texas Avenue, Houston, TX 77002 "The opinions above are most likely "Houston's Leading Information Source" those of my employer."