How to build xapian 1.4.10 with MSVC2017

Olly Betts olly at survex.com
Thu Feb 21 02:57:40 GMT 2019


On Wed, Feb 20, 2019 at 12:41:07PM +0800, cswuyg wrote:
> Thanks for your reply.
> I had run vcvars64.bat,but still cann't find 'cl'.
> Finally I fix it, change msys2_shell.cmd: "if it is present: replace rem set MSYS2_PATH_TYPE=inherit with set MSYS2_PATH_TYPE=inherit".

OK, I'll note that in the instructions.

It looks like you can also enable this option as a one-off by passing
-use-full-path:

msys2_shell.cmd -use-full-path

> And other errors :
> #   ./configure CC="cl -nologo" CXX="$PWD/compile cl -nologo" CXXFLAGS="-EHsc AR=lib -IC:\zlib-1.2.3-lib\include LDFLAGS=-LC:\zlib-1.2.3-lib\lib" --prefix="C:\xapian-install"

Your quoting is wrong here - there's no closing quote on CXXFLAGS, so this
sets CXXFLAGS to the value:

    -EHsc AR=lib -IC:\zlib-1.2.3-lib\include LDFLAGS=-LC:\zlib-1.2.3-lib\lib

And then doesn't set AR, CPPFLAGS or LDFLAGS at all.

You're also missing CPPFLAGS= before -IC:\zlib-1.2.3-lib\include so
fixing both of those I guess you want:

./configure CC="cl -nologo" CXX="$PWD/compile cl -nologo" CXXFLAGS="-EHsc" AR=lib CPPFLAGS=-IC:\zlib-1.2.3-lib\include LDFLAGS="-LC:\zlib-1.2.3-lib\lib" --prefix="C:\xapian-install"

I don't think that's the cause of your immediate problem, but this will
cause you problems sooner or later.

> checking for egrep... /usr/bin/grep -E
> checking for fgrep... /usr/bin/grep -F
> checking for non-GNU ld... no
> configure: error: no acceptable ld found in $PATH

Looking at the CI logs, it seems that xapian-core's configure there
finds GNU ld, but doesn't actually use it for the build:

https://ci.appveyor.com/project/ojwb/xapian/builds/22443660/job/muwq9r3jmcde4h92?fullLog=true#L844

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).

Sorry for the bumpy ride here - it's definitely possible (as the CI
build shows) but this is fairly new and I don't think many people have
tried to replicate that using the instructions in INSTALL yet.

Cheers,
    Olly



More information about the Xapian-discuss mailing list