[Xapian-devel] Sample quickstartindex unable to create database on Windows 2008

Charlie Hull charlie at juggler.net
Sat Jul 11 16:56:24 BST 2009


Martin Margo wrote:
> 
> Mark this thread as solved.
> 
> Thanks to people at Microsoft
> Forum, I learned std::string class is not binary compatible between my
> driver project (VC2008 IDE) and Xapian (built using nmake). I have in
> my compile option '_DEBUG'. Once I changed my configuration manager to
> 'Release/Win32' and transferred proper header and include lib dirs, my
> program runs successfully.
> 
> Hopefully this will help other people in my position. I'm curious if this change will fix Charlie's problem as well.
> 
> Here's my thread at Microsoft Forum
> http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/ca90f16f-e893-464f-971c-fed86e0726f5

That's interesting to know. I'd traced the problem as far as pack_uint 
in the Xapian core, which was causing some horrible overflow errors, 
which may have been due to mixing debug and non-debug versions of 
std::string.

Thanks for letting us know.

Cheers

Charlie

> 
> -Martin
> 
> 
> 
> ----- Original Message ----
> From: Olly Betts <olly at survex.com>
> To: Charlie Hull <charlie at juggler.net>
> Cc: Xapian Development <xapian-devel at lists.xapian.org>
> Sent: Thursday, July 2, 2009 9:18:43 PM
> Subject: Re: [Xapian-devel] Sample quickstartindex unable to create database on Windows 2008
> 
> On Thu, Jul 02, 2009 at 11:43:03AM +0100, Charlie Hull wrote:
>> Olly Betts wrote:
>>> What is argv[1] as passed to quickstartindex?
>>>
>>> And what are these 4 bytes exactly?  They're showing up as 0xcc here,
>>> but it's not clear if they've been mangled from their original values.
>>>
>>> Or are you looking at the raw data inside the string class?  That would
>>> probably have the length followed by the string data.
>> I've confirmed this problem on Visual C++ 2005 Express. Debugging inside 
>> the WritableDatabase constructor:
>>
>> WritableDatabase::WritableDatabase(const std::string &path, int action)
>>      : Database()
>> {
>> The debugger shows 'path' is a '<Bad Ptr>'. Somehow VC++ doesn't like 
>> passing const references to std::strings in this way.
> 
> It can't be that simple or else very little of Xapian would work, and
> indeed a lot of other C++ software would fail as passing std::string
> by const reference is very common.  This finds "about 281,000"
> occurrences:
> 
> http://www.google.com/codesearch?q=\(const\+(std%3A%3A)%3Fstring\+*%26
> 
> It would be good to see what adding "cout << path << endl;" to the
> WritableDatabase constructor gave, as that would help rule out this
> being bad debug info.
> 
>> BTW copying argv[1] into a temporary buffer to make sure it's definitely 
>> zero terminated etc., then making a new std::string round it, then 
>> passing a reference to that doesn't help.
> 
> OK, but what *is* argv[1] (as I asked above)?  It would be useful to
> check that the 4 garbage bytes didn't get added already somehow.
> 
> And can you reproduce this in a cut down example without Xapian
> involved?
> 
>> I'm wondering (though not with any real evidence) if 
>> http://trac.xapian.org/ticket/140
>> has any relevance.
> 
> No, that was just about which is more efficient, and it turns out that
> const reference seems to be regardless of how std::string is
> implemented.
> 
> Cheers,
>     Olly
> 
> _______________________________________________
> Xapian-devel mailing list
> Xapian-devel at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-devel
> 
> 
> _______________________________________________
> Xapian-devel mailing list
> Xapian-devel at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-devel
> 




More information about the Xapian-devel mailing list