How to build xapian 1.4.10 with MSVC2017

cswuyg 496090217 at qq.com
Fri Feb 22 03:43:57 GMT 2019


> Great, but which "it" worked? 
I had install mingw earlier, but not set it to $PATH, so must be 'LD=link' and your previous advices on  "CXXFLAGS" . 
I execute configure like this:
./configure LD=link CC="cl -nologo" CXX="$PWD/compile cl -nologo" CXXFLAGS="-EHsc -Z7" AR=lib CPPFLAGS=-IC:/zlib-1.2.3-lib/include LDFLAGS="-LC:/zlib-1.2.3-lib/lib" --prefix="C:/xapian-install"


>> 3.1 change libxapian.a's name to libxapian.lib;
And sorry,I check again, '3.1 change libxapian.a's name to libxapian.lib;' is not necessary, can use libxapian.a directly.


>>  3.2 make sure the Runtime Library is /MT, can change it at project property page,  C/C++-->Code Generation-->Runtime Library; 
> Is this one only needed if you want to write a multi-threaded program?
Maybe, but The project was create from Visual Stdio 2017's wizard, I didn't change project property to multi-thread manually.


Cheers,
    cswuyg
   


------------------ Original ------------------
From:  "olly";<olly at survex.com>;
Date:  Feb 22, 2019
To:  "cswuyg"<496090217 at qq.com>; 
Cc:  "Xapian Discussion"<xapian-discuss at lists.xapian.org>; 
Subject:  Re: How to build xapian 1.4.10 with MSVC2017



On Fri, Feb 22, 2019 at 12:37:37AM +0800, cswuyg wrote:
> Thank you very much,It works!

Great, but which "it" worked?  I suggested two options:

> > So probably installing GNU ld from mingw would work around this, but
> > really you shouldn't need to have it installed as MSVC is used for
> > linking.
> > 
> > You could try adding LD=link to the configure command line (to tell it
> > to use the Microsoft linker).

> And some Q&A I meet,may help somebody:

Thanks for these - I'll update INSTALL.

> 1. If zlib build with 32bit,should use MSVC's 'vcvars32.bat';
> 2. Add '-Z7' to CXXFLAGS can release *.pdb file for VS2017 'Step Into' debug, such as: CXXFLAGS="-EHsc -Z7";
> 3. If Somebody write a demo in VS2017
>  3.1 change libxapian.a's name to libxapian.lib;
>  3.2 make sure the Runtime Library is /MT, can change it at project property page,  C/C++-->Code Generation-->Runtime Library; 

Is this one only needed if you want to write a multi-threaded program?

>  3.3 add Rpcrt4.lib and Ws2_32.lib to linker input;
>  3.4 copy zlib1.dll to the demo.exe's directory, or may get some error like '0xc000007b' at process start.

Cheers,
    Olly


More information about the Xapian-discuss mailing list