semantic-machines / xapian-rusty

xapian bind for rust
7 stars 4 forks source link

How to call get_document_data() #2

Closed ssosik closed 3 years ago

ssosik commented 3 years ago

First, thanks for creating this! Xapian bindings in rust would be pretty awesome, I'd love to see this work.

I've cobbled together something close to working (mirroring some working python code), but when I call get_document_data() on an MSetIterator I get the following cc link failure:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "-L" "/usr/local/Cellar/rust/1.53.0/lib/rustlib/x86_64-apple-darwin/lib" ......

  = note: Undefined symbols for architecture x86_64:
            "Xapian::MSet::get_doc_by_index(unsigned int)", referenced from:
                get_doc_by_index(Xapian::MSet&, int, signed char&) in libxapian_rusty-9793f2e86b213404.rlib(xapian-bind.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

Above is built on a Mac.

On Ubuntu (x86_64-unknown-linux-gnu) I see a slightly different cc error:

  = note: /nix/store/p792j5f44l3f0xi7ai5jllwnxqwnka88-binutils-2.31.1/bin/ld: /home/ssosik/workspace/tika-xapian/target/debug/deps/libxapian_rusty-c60fd91acc712413.rlib(xapian-bind.o): in function `get_doc_by_index(Xapian::MSet&, int, signed char&)':
          /home/ssosik/workspace/tika-xapian/xapian-rusty/xapian-bind.cc:741: undefined reference to `Xapian::MSet::get_doc_by_index(unsigned int)'
          collect2: error: ld returned 1 exit status

See https://github.com/ssosik/tika-xapian as an example

What am I doing wrong? What to do to get Xapian::MSet::get_doc_by_index(unsigned int) defined?

Thank you for taking a look!

ssosik commented 3 years ago

I figured this out. It wasn't obvious to me that I needed to apply some patches to the xapian-core-1.4.17 source before building it.