Re: Link static xapian to a share library
Yuan Fu <[email protected]> Fri, 25 Mar 2022 15:37:26 -0700
| Newsgroups | gmane.comp.search.xapian.general |
|---|---|
| Message-ID | <[email protected]> |
> On Mar 25, 2022, at 1:27 PM, Olly Betts <[email protected]> wrote: > > On Thu, Mar 24, 2022 at 02:39:50PM -0700, Yuan Fu wrote: >> I’m trying to link a static libxapian.a into my shared library, so >> that I can ship my library standalone. > > Be aware that will likely cause problems if a program linking to your > library also links to libxapian directly or to another library which > uses libxapian internally - the issue is there will be two different > versions of libxapian loaded. If libxapian is dynamically linked > then this problem is avoided. Thanks for the heads up! > >> Undefined symbols for architecture x86_64: >> "_deflate", referenced from: > [...] >> It seems that libxapian.a is missing some symbols? Did I compile it wrong? > > Sounds like you haven't linked to zlib. Dynamic libraries on modern > systems know which other libraries they depend on, but static libraries > are an ancient technology and don't - you need to specify the > dependencies by hand (or use xapian-config or pkg-config which paper > over this omission). I see. Adding -lz solves it, thanks! Yuan