[Xapian-discuss] "Undefined Reference to" errors

Olly Betts olly at survex.com
Sun Sep 2 13:38:48 BST 2007


On Sun, Sep 02, 2007 at 12:44:31PM +0100, Kwok-yau Kwong wrote:
> kwok at kwok-desktop:~/Desktop/Xapian-Index$ ./trec_index
> ./trec_index: error while loading shared libraries: libxapian.so.15: cannot
> open shared object file: No such file or directory

This isn't really Xapian-specific.  You've installed libraries in
/usr/local/lib but the dynamic loader doesn't usually look there by
default.

Some options:

* configure xapian-core with --prefix=/usr so the libraries install in
  /usr/lib where the dynamic loader looks by default.
  
* Add /usr/local/lib to /etc/ld.so.conf and run /sbin/ldconfig (as
  root).

* Set environment variable LD_LIBRARY_PATH=/usr/local/lib (and export it).

* Set an rpath on trec_index - if you're using GCC, pass
  -Wl,-R/usr/local/lib when linking trec_index, or use libtool to
  do the linking (this is how the binaries shipped with Xapian know
  where to find libxapian even if it's installed outside the dynamic
  loader's search path).

Which approach is best is mostly down to local policy and personal
preference.  If you want a recommendation, setting rpath seems
neatest to me.

It would be useful to others to have a TREC indexer included in the
standard distribution - if you're willing to share it, let me know
(are you working with Andy MacFarlane?)

Cheers,
    Olly



More information about the Xapian-discuss mailing list