[Xapian-devel] A beginner in "Posting list encoding improvements"

Olly Betts olly at survex.com
Thu Feb 13 02:09:52 GMT 2014


On Thu, Feb 13, 2014 at 09:48:27AM +0800, Hurricane Tong wrote:
> I uninstall xapian1.3 and install xapian-1.2.17
> but i still failed
> 
> hurricanetong at hurricanetong-VirtualBox:~/workspace$ g++ `xapian-config --cxxflags --libs` demo2.cc
> /tmp/cc2wsfDJ.o: In function `main':
> demo2.cc:(.text+0x4a): undefined reference to `Xapian::WritableDatabase::WritableDatabase(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
> demo2.cc:(.text+0x73): undefined reference to `Xapian::WritableDatabase::~WritableDatabase()'
> demo2.cc:(.text+0x98): undefined reference to `Xapian::WritableDatabase::~WritableDatabase()'
> collect2: ld 返回 1
> 
> and
> 
> hurricanetong at hurricanetong-VirtualBox:~/workspace$ xapian-config --cxxflags --libs
> -I/usr/local/include
> -L/usr/local/lib -lxapian

This works for me on Debian unstable with a locally installed xapian-core
1.2.17, which I built using:

$ tar xf xapian-core-1.2.17.tar.xz
$ cd xapian-core-1.2.17
$ ./configure
[...]
$ make -sj8 # quieter build, 8-way parallel
[...]
$ sudo make install
[...]

And then:

$ g++ `xapian-config --cxxflags --libs` BuildIndexDemo.cpp 
$ ./a.out
$ ls -l database
total 16
-rw-r--r-- 1 olly olly  0 Feb 13 15:05 flintlock
-rw-r--r-- 1 olly olly 28 Feb 13 15:05 iamchert
-rw-r--r-- 1 olly olly 13 Feb 13 15:05 postlist.baseA
-rw-r--r-- 1 olly olly  0 Feb 13 15:05 postlist.DB
-rw-r--r-- 1 olly olly 13 Feb 13 15:05 record.baseA
-rw-r--r-- 1 olly olly  0 Feb 13 15:05 record.DB
-rw-r--r-- 1 olly olly 13 Feb 13 15:05 termlist.baseA
-rw-r--r-- 1 olly olly  0 Feb 13 15:05 termlist.DB

I'd check you're running the xapian-config you think you are:

$ which xapian-config
/usr/local/bin/xapian-config
$ xapian-config --version
xapian-config - xapian-core 1.2.17

If you're getting a different xapian-config, you can give an explicit path
to it:

$ g++ `/usr/local/bin/xapian-config --cxxflags --libs` BuildIndexDemo.cpp 

And that the xapian library is really installed in /usr/local/lib:

$ ls -l /usr/local/lib/libxapian*
-rw-r--r-- 1 root staff 78693312 Feb 13 15:02 /usr/local/lib/libxapian.a
-rwxr-xr-x 1 root staff      944 Feb 13 15:02 /usr/local/lib/libxapian.la
lrwxrwxrwx 1 root staff       19 Feb 13 15:02 /usr/local/lib/libxapian.so -> libxapian.so.22.6.4
lrwxrwxrwx 1 root staff       19 Feb 13 15:02 /usr/local/lib/libxapian.so.22 -> libxapian.so.22.6.4
-rwxr-xr-x 1 root staff 28428107 Feb 13 15:02 /usr/local/lib/libxapian.so.22.6.4

Cheers,
    Olly



More information about the Xapian-devel mailing list