xapian core missing link to math on MSYS2
Olly Betts
olly at survex.com
Fri Mar 17 10:31:24 GMT 2017
On Fri, Mar 17, 2017 at 11:04:43AM +0100, Mario Emmenlauer wrote:
> thanks a lot for the pointer! I've fetched the patch you mention but
> actually it seems this is already included in the 1.4.3 release, is
> that possible?
Oh yes it is. Sorry, it seems this got missed from the NEWS file, and
so I assumed it wasn't in a release yet.
> Also it did not solve the problem, I still get references
> to exp10. I've checked with nm and omenquire.o has undefined references
> to log10 and exp10.
log10() is C99 and POSIX, so that should be OK.
> I went further and replaced exp10 in omenquire.cc
> with __builtin_exp10, but still the same undefined references. I do not
> know what kind of black magic this is...
I can confirm this with a simple test program and a cross-compiler:
$ cat exp10.cc
int main(int argc, char **) { return (int)__builtin_exp10((double)argc); }
$ i686-w64-mingw32-g++ -O2 -Wall -W exp10.cc
/tmp/cc3O99Ry.o:exp10.cc:(.text.startup+0x15): undefined reference to `exp10'
collect2: error: ld returned 1 exit status
So GCC thinks it can call exp10() to implement __builtin_exp10()! Not
really sure how to sanely handle that.
At least for a workaround, I'd suggest pow(10.0, x) (unless GCC tries to
convert that to exp10(x) too).
Cheers,
Olly
More information about the Xapian-devel
mailing list