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". 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" configure: loading site script /etc/config.site checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... no checking whether make supports nested variables... no checking whether UID '1492654' is supported by ustar format... yes checking whether GID '1049089' is supported by ustar format... yes checking how to create a ustar tar archive... pax checking for style of include used by make... none checking for gcc... cl -nologo checking whether the C compiler works... yes checking for C compiler default output file name... conftest.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... obj checking whether we are using the GNU C compiler... no checking whether cl -nologo accepts -g... no checking for cl -nologo option to accept ISO C89... none needed checking whether cl -nologo understands -c and -o together... no checking dependency style of /d/xapian_proj/xapian-core-1.4.10/compile cl -nologo... none checking for ar... no checking for lib... lib checking the archiver (lib) interface... lib checking build system type... x86_64-pc-msys checking host system type... x86_64-pc-msys checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep 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 ---- Maybe some step error? ------------------ Original ------------------ From: "Olly Betts";<olly at survex.com>; Send time: Wednesday, Feb 20, 2019 10:33 AM To: "cswuyg"<496090217 at qq.com>; Cc: "xapian-discuss"<xapian-discuss at lists.xapian.org>; Subject: Re: How to build xapian 1.4.10 with MSVC2017 On Wed, Feb 20, 2019 at 09:53:56AM +0800, 烛秋 wrote:> hi, I have read the install document,https://github.com/xapian/xapian/blob/v1.4.10/xapian-core/INSTALL,but don't how to build xapian project by MSVC. > I execute command in mingw64.exe: ./configure CC="cl -nologo" CXX="$PWD/compile cl -nologo" CXXFLAGS=-EHsc AR=lib > has some errors: > # ./configure CC="cl -nologo" CXX="$PWD/compile cl -nologo" CXXFLAGS=-EHsc AR=lib > configure: loading site script /mingw64/etc/config.site > checking for a BSD-compatible install... /usr/bin/install -c > checking whether build environment is sane... yes > checking for a thread-safe mkdir -p... /usr/bin/mkdir -p > checking for gawk... gawk > checking whether make sets $(MAKE)... no > checking whether make supports nested variables... no > checking whether UID '1492654' is supported by ustar format... yes > checking whether GID '1049089' is supported by ustar format... yes > checking how to create a ustar tar archive... pax > checking for style of include used by make... none > checking for gcc... cl -nologo > checking whether the C compiler works... no > configure: error: in `/d/xapian_proj/xapian-core-1.4.10': > configure: error: C compiler cannot create executablesIs "cl" found on your PATH? To check you can try just running cl /? which should give the command line help. If it says it can't find the command, make sure you've run the "vcvars" batch file (also described in INSTALL).> See `config.log' for more detailsIf "cl /?" does work, look in config.log to see why configure decided the compiler doesn't work. Cheers, Olly
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 $PATHLooking 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
Thank you very much,It works! And some Q&A I meet,may help somebody: 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; 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, cswuyg ------------------ Original ------------------ From: "Olly Betts";<olly at survex.com>; Date: Feb 21, 2019 To: "cswuyg"<496090217 at qq.com>; Cc: "xapian-discuss"<xapian-discuss at lists.xapian.org>; Subject: Re: How to build xapian 1.4.10 with MSVC2017 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 $PATHLooking 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