Dear Olly, 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? 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. 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... Cheers, Mario ac_cv_func___exp10=no ac_cv_func_exp10=no ac_cv_have_decl___builtin_exp10=yes #define HAVE_DECL___BUILTIN_EXP10 1 #define HAVE_DECL___BUILTIN_EXP10 1 On 16.03.2017 00:47, Olly Betts wrote:> On Wed, Mar 15, 2017 at 10:05:31AM +0100, Mario Emmenlauer wrote: >> I've tried to build xapian-core 1.4.3 on MSYS2. It fails with attached >> error (undefined reference to `exp10'). > > The issue is that exp10() isn't a standard function. This is fixed in > git already, so should work with the next release: > > https://trac.xapian.org/changeset/8ac975a135e2571d78eaa82e63974509877d3110/git > > There's only one use of exp10() currently, so the simplest workaround is > probably to patch api/omenquire.cc to use __builtin_exp10(x) or pow(10.0, x) > instead of exp10(x) (the former requires GCC). > > Cheers, > Olly >
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
Dear Olly, On 17.03.2017 11:31, Olly Betts wrote:> 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).Great, that works and fixes the problem. I've created a PR with the latest xapian (and your fix) for inclusion in MSYS2 here: https://github.com/Alexpux/MINGW-packages/pull/2316 Cheers, Mario Emmenlauer