Opened 15 years ago

Closed 15 years ago

#404 closed defect (fixed)

Error compiling Perl binding from xapian-bindings

Reported by: Dagobert Michelsen Owned by: Olly Betts
Priority: normal Milestone: 1.0.17
Component: Search::Xapian Version: 1.0.11
Severity: major Keywords:
Cc: dam@… Blocked By:
Blocking: Operating System: Solaris

Description

I get an error compiling the Perl binding from xapian-bindings:

/opt/studio/SOS11/SUNWspro/bin/CC -c  -library=stlport4 -features=tmplife -I/opt/csw/include -D_REENTRANT -xO3 -xarch=v8 -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xO3 -xarch=v8   -DVERSION=\"1.0.11.0\" -DXS_VERSION=\"1.0.11.0\" -KPIC "-I/opt/csw/lib/perl/5.8.8/CORE"   Xapian.c
"Xapian.xs", line 29: Error: Virtual function PerlStopper::operator()(const std::string &) const returns char, while Xapian::Stopper::operator()(const std::string &) const returns bool.
"Xapian.xs", line 74: Error: Virtual function perlMatchDecider::operator()(const Xapian::Document&) const returns char, while Xapian::MatchDecider::operator()(const Xapian::Document&) const returns bool.

Attachments (1)

search-xapian-bool.patch (223 bytes ) - added by Olly Betts 15 years ago.
Patch to Xapian.c which should fix this

Download all attachments as: .zip

Change History (6)

comment:1 by Dagobert Michelsen, 15 years ago

Component: Xapian-bindingsSearch::Xapian

comment:2 by Olly Betts, 15 years ago

Milestone: 1.1.3
Status: newassigned

The problem is really in the Perl headers - essentially they do this (or with int instead of char) unless GNUG is defined:

#define bool char

Really that would be better done for any modern C++ compiler, but that's not a totally safe change for them if they want to support older pre-standard compilers which didn't have bool.

Anyway, we can define HAS_BOOL to stop this being done in the Perl headers. Can you try the attached patch?

by Olly Betts, 15 years ago

Attachment: search-xapian-bool.patch added

Patch to Xapian.c which should fix this

comment:3 by Olly Betts, 15 years ago

Ping - does the patch help?

comment:4 by Dagobert Michelsen, 15 years ago

Sorry, I missed your update. Yes, the patch fixes the error. I do get a few hundred warning of the type

"Xapian.c", line 9160: Warning (Anachronism): Formal argument f of type extern "C" void(*)(interpreter*,cv*) in call to Perl_newXS(interpreter*, char*, extern "C" void(*)(interpreter*,cv*), char*) is being passed void(*)(interpreter*,cv*).
"Xapian.c", line 9161: Warning: String literal converted to char* in formal argument name in call to Perl_newXS(interpreter*, char*, extern "C" void(*)(interpreter*,cv*), char*).

but it does seem to work.

comment:5 by Olly Betts, 15 years ago

Milestone: 1.1.31.0.17
Resolution: fixed
Status: assignedclosed

Thanks for testing.

Fix committed to trunk r13542 and backported for 1.0 as r13543.

The second warning is just due to the code generated by the Perl XS tools - you see similar warnings with modern GCC. They're harmless.

The first warning is a little more worrisome, but I think it should be OK (assuming that the calling conventions for passing POD types are compatible between C and C++, which is a sane ABI design). Again, it's due to the code the Perl XS tools generate - I don't see how we can force extern "C" here ourselves.

Does make check in a built source tree work? If so, that's a strong indication.

Note: See TracTickets for help on using tickets.