[Xapian-discuss] Trouble installing xapian on windows

Olly Betts olly at survex.com
Sun Jul 5 14:31:37 BST 2015


On Sat, Jul 04, 2015 at 09:12:30AM -0400, john.alveris at Safe-mail.net wrote:
> Hello, i am trying to install xapian on windows. As the xapian
> download page says, there are two options here:
> 1) mingw 
> 2) a separate set of makefiles for MSVC.
> 
> If i understand correctly, MSVC is supported only by xapian 1.2.8 and older

There's certainly nobody actively maintaining the MSVC makefiles
currently.  I did hear a success story not so long ago with using them
to build 1.2.x.  Not sure what version that was with, but looking at
http://trac.xapian.org/ticket/530 suggests it was 1.2.18.

If someone wants to start maintaining them, that would probably be
useful, though I feel that maintaining a whole parallel build system
for one compiler is not a great approach, and that it would be better
to get MSVC working with the standard build system - a quick search
for 'autoconf msvc' leads me to this thread which suggests it is
mostly a matter of installing MSYS and passing suitable options to
configure:

https://lists.gnu.org/archive/html/automake/2011-09/msg00003.html

> so i decided to try mingw. The configure script worked perfectly, but
> "make" finished with a error (see the output below). So far i have two
> questions:
> 
> 1) Why mingw is not working for me? Is it bug or i am doing something wrong?

Our buildbot has a mingw-w64 cross-compiled build which seems to be
working currently:

http://buildbot.xapian.org/builders/stable%20tar%20mingw-cross

> ./common/safeunistd.h: In function 'unsigned int sleep(unsigned int)':
> ./common/safeunistd.h:56:1: error: redefinition of 'unsigned int sleep(unsigned
> int)'
>  sleep(unsigned int seconds)
>  ^
> In file included from ./common/safeunistd.h:25:0,
>                  from api/compactor.cc:39:
> c:\mingw\include\unistd.h:142:10: error: 'unsigned int sleep(unsigned int)' prev
> iously defined here
>  unsigned sleep( unsigned period ){ return __mingw_sleep( period, 0 ); }
>           ^

I guess this is either mingw vs mingw-w64 difference, or a version
difference, as the headers of the version that the buildbot has define
sleep() rather differently.

A quick local fix which should make it work is to modify
common/safeunistd.h and change:

#ifdef __WIN32__

into:

#if 0

> 2)Even if i would be able to compile xapian with mingw, could i use it
> in my project (c++) that is supposed to be compiled by MSVC?

You can mix C code compiled with mingw and MSVC, but you can't mix C++
code:

http://www.mingw.org/wiki/Interoperability_of_Libraries_Created_by_Different_Compiler_Brands

So only if you compile your project with mingw too.

Cheers,
    Olly



More information about the Xapian-discuss mailing list