john.alveris at Safe-mail.net
2015-Jul-04 13:12 UTC
[Xapian-discuss] Trouble installing xapian on windows
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, 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? 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? [HERE IS OUTPUT OF THE MAKE COMMAND] make[1]: Entering directory `/c/temp/xapian/xapian-core-1.2.21' Making all in . make[2]: Entering directory `/c/temp/xapian/xapian-core-1.2.21' depbase=`echo api/compactor.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. - I./common -I./include -fshow-column -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wu ndef -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -W logical-op -Wmissing-declarations -Wdouble-promotion -Winit-self -fvisibility=hi dden -mfpmath=sse -msse2 -mtune=generic -g -O2 -MT api/compactor.lo -MD -MP -MF $depbase.Tpo -c -o api/compactor.lo api/compactor.cc &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: g++ -DHAVE_CONFIG_H -I. -I./common -I./include -fshow-column -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-lo ng -Wformat-security -fno-gnu-keywords -Wundef -Woverloaded-virtual -Wstrict-nul l-sentinel -Wshadow -Wstrict-overflow=1 -Wlogical-op -Wmissing-declarations -Wdo uble-promotion -Winit-self -fvisibility=hidden -mfpmath=sse -msse2 -mtune=generi c -g -O2 -MT api/compactor.lo -MD -MP -MF api/.deps/compactor.Tpo -c api/compact or.cc -DDLL_EXPORT -DPIC -o api/.libs/compactor.o In file included from api/compactor.cc:39:0: ./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 ); } ^ make[2]: *** [api/compactor.lo] Error 1 make[2]: Leaving directory `/c/temp/xapian/xapian-core-1.2.21' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/c/temp/xapian/xapian-core-1.2.21' make: *** [all] Error 2
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 olderThere'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
On Sun, Jul 05, 2015 at 02:31:37PM +0100, Olly Betts wrote:> 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.I've pushed a fix to not use our fallback sleep() implementation if there's a version in the C library, and will backport it to 1.2 before the next release. Cheers, Olly