google / benchmark

A microbenchmark support library
Apache License 2.0
8.89k stars 1.61k forks source link

[OS:Win10] Getting "Failed to determine the source files for the regular expression backend" on fresh copy from git when running cmake #1002

Open jz-fb opened 4 years ago

jz-fb commented 4 years ago

Following the steps in the readme file (text below), when doing cmake ../ I get: "Failed to determine the source files for the regular expression backend". I did this a month ago without issue. This was done on a Windows 10 PC with the latest versions of cmake and VS as of early June.

# Check out the library.
$ git clone https://github.com/google/benchmark.git
# Benchmark requires Google Test as a dependency. Add the source tree as a subdirectory.
$ git clone https://github.com/google/googletest.git benchmark/googletest\
# Go to the library root directory
$ cd benchmark
# Make a build directory to place the build output.
$ mkdir build && cd build
# Generate a Makefile with cmake.
# Use cmake -G <generator> to generate a different file type.
$ cmake ../
# Build the library.
# Use make -j<number_of_parallel_jobs> to speed up the build process, e.g. make -j8 .
$ make
dmah42 commented 4 years ago

error from here

this happens if the cxx feature checks for std_regex, gnu_posix_regex, and posix_regex all fail.

ie, https://github.com/google/benchmark/blob/f4f5dba46bdbde0e95d736cca124025745bcd7b6/cmake/std_regex.cpp, https://github.com/google/benchmark/blob/f4f5dba46bdbde0e95d736cca124025745bcd7b6/cmake/posix_regex.cpp, https://github.com/google/benchmark/blob/f4f5dba46bdbde0e95d736cca124025745bcd7b6/cmake/gnu_posix_regex.cpp all fail to build.

can you share the full cmake log please?

jz-fb commented 4 years ago

The system is: Windows - 10.0.18362 - AMD64 Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. Compiler:
Build flags: Id flags:

The output was: 0 Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

Build started 7/16/2020 2:53:23 PM. Project "C:\Users\acer-e15\Desktop\f1\thirdparty\benchmark\build\CMakeFiles\3.17.3\CompilerIdCXX\CompilerIdCXX.vcxproj" on node 1 (default targets). PrepareForBuild: Creating directory "Debug\". Creating directory "Debug\CompilerIdCXX.tlog\". InitializeBuildStatus: Creating "Debug\CompilerIdCXX.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified. VcpkgTripletSelection: Using triplet "x64-windows" from "C:\Users\acer-e15\Desktop\thirdparty\vcpkg\installed\x64-windows\" ClCompile: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\CL.exe /c /I"C:\Users\acer-e15\Desktop\thirdparty\vcpkg\installed\x64-windows\include" /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\" /Fd"Debug\vc142.pdb" /Gd /TP /FC /errorReport:queue CMakeCXXCompilerId.cpp CMakeCXXCompilerId.cpp Link: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdCXX.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Users\acer-e15\Desktop\thirdparty\vcpkg\installed\x64-windows\debug\lib" /LIBPATH:"C:\Users\acer-e15\Desktop\thirdparty\vcpkg\installed\x64-windows\debug\lib\manual-link" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "C:\Users\acer-e15\Desktop\thirdparty\vcpkg\installed\x64-windows\debug\lib*.lib" /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdCXX.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdCXX.lib" /MACHINE:X64 Debug\CMakeCXXCompilerId.obj CompilerIdCXX.vcxproj -> C:\Users\acer-e15\Desktop\f1\thirdparty\benchmark\build\CMakeFiles\3.17.3\CompilerIdCXX.\CompilerIdCXX.exe AppLocalFromInstalled: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File "C:\Users\acer-e15\Desktop\thirdparty\vcpkg\scripts\buildsystems\msbuild\applocal.ps1" "C:\Users\acer-e15\Desktop\f1\thirdparty\benchmark\build\CMakeFiles\3.17.3\CompilerIdCXX.\CompilerIdCXX.exe" "C:\Users\acer-e15\Desktop\thirdparty\vcpkg\installed\x64-windows\debug\bin" "Debug\CompilerIdCXX.tlog\CompilerIdCXX.write.1u.tlog" "Debug\vcpkg.applocal.log" PostBuildEvent: for %%i in (cl.exe) do @echo CMAKE_CXX_COMPILER=%%~$PATH:i :VCEnd CMAKE_CXX_COMPILER=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64\cl.exe FinalizeBuildStatus: Deleting file "Debug\CompilerIdCXX.tlog\unsuccessfulbuild". Touching "Debug\CompilerIdCXX.tlog\CompilerIdCXX.lastbuildstate". Done Building Project "C:\Users\acer-e15\Desktop\f1\thirdparty\benchmark\build\CMakeFiles\3.17.3\CompilerIdCXX\CompilerIdCXX.vcxproj" (default targets).

Build succeeded. 0 Warning(s) 0 Error(s)

Time Elapsed 00:00:05.88

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CompilerIdCXX.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CompilerIdCXX.vcxproj"

The CXX compiler identification is MSVC, found in "C:/Users/acer-e15/Desktop/f1/thirdparty/benchmark/build/CMakeFiles/3.17.3/CompilerIdCXX/CompilerIdCXX.exe"

Determining if the CXX compiler works passed with the following output: Change Dir: C:/Users/acer-e15/Desktop/f1/thirdparty/benchmark/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_0c06e.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) C/C++ Optimizing Compiler Version 19.26.28806 for x64

Copyright (C) Microsoft Corporation. All rights reserved.

testCXXCompiler.cxx

cl /c /I"C:\Users\acer-e15\Desktop\thirdparty\vcpkg\installed\x64-windows\include" /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_0c06e.dir\Debug\" /Fd"cmTC_0c06e.dir\Debug\vc142.pdb" /Gd /TP /errorReport:queue "C:\Users\acer-e15\Desktop\f1\thirdparty\benchmark\build\CMakeFiles\CMakeTmp\testCXXCompiler.cxx"

cmTC_0c06e.vcxproj -> C:\Users\acer-e15\Desktop\f1\thirdparty\benchmark\build\CMakeFiles\CMakeTmp\Debug\cmTC_0c06e.exe

Detecting CXX compiler ABI info compiled with the following output: Change Dir: C:/Users/acer-e15/Desktop/f1/thirdparty/benchmark/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_07c9c.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) C/C++ Optimizing Compiler Version 19.26.28806 for x64

Copyright (C) Microsoft Corporation. All rights reserved.

CMakeCXXCompilerABI.cpp

cl /c /I"C:\Users\acer-e15\Desktop\thirdparty\vcpkg\installed\x64-windows\include" /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_07c9c.dir\Debug\" /Fd"cmTC_07c9c.dir\Debug\vc142.pdb" /Gd /TP /errorReport:queue "C:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompilerABI.cpp"

cmTC_07c9c.vcxproj -> C:\Users\acer-e15\Desktop\f1\thirdparty\benchmark\build\CMakeFiles\CMakeTmp\Debug\cmTC_07c9c.exe

jz-fb commented 4 years ago

any updates?

jz-fb commented 4 years ago

It's been more than a month, any updates on this issue?

dmah42 commented 4 years ago

Does #1021 help? it seems related but it's unclear if you're using clang's c++11 stdlib.

jeremyong commented 4 years ago

Based on the compiler log above, it looks like he's using MSVC so I don't think #1021 is related (in either causing or resolving) the issue. That said, the log looks like it's missing information so it's hard to say what's happening.

guoqiangqi commented 3 years ago

@jz-fb have you solved this? I got the same error message with you when i build with cmake.

dmah42 commented 2 years ago

if someone could attach the cmake log that might help narrow it down.

pr0g commented 2 years ago

I wound up hitting this too trying to build this project on Windows which uses Benchmark - cpp-handle-container.

This is the output log: CMakeOutput.log

I see this in the console/terminal.

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
-- The CXX compiler identification is MSVC 19.31.31104.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.35.1.windows.2")
-- git version: v1.5.5 normalized to 1.5.5
-- Version: 1.5.5
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- compiled but failed to run
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
CMake Error at build/_deps/benchmark-src/CMakeLists.txt:283 (message):
  Failed to determine the source files for the regular expression backend

I'm running Windows 11 using Parallels on a MacBook M1 which might be contributing to the problem (maybe the CMakeLists.txt file is not coping well with it thinking some sort of cross-compiling is happening?). I'm not really sure but I'll try and repo on a native Windows box (regular x86_64 CPU) to see if it makes any difference.

imrichardcole commented 1 week ago

Taking a look

imrichardcole commented 1 week ago

Unable to reproduce. Have tried v140, v141, v142 and v143 toolsets:

****** CMake commands ******
*
*      cmake -S . -B build -DBENCHMARK_ENABLE_GTEST_TESTS=TRUE -T (see above) -DBENCHMARK_ENABLE_TESTING=TRUE -DBENCHMARK_DOWNLOAD_DEPENDENCIES=TRUE
*
******  Host details  ******
*
*       Windows version:      Microsoft Windows NT 10.0.19045.0
*       Windows:              Windows 10 Pro
*       CPU:                  Intel(R) Core(TM) i7-8700T CPU @ 2.40GHz
*
***************************
LebedevRI commented 1 week ago

FWIW, i personally usually hit this kind of thing when accidentally passing c instead of c++ into CXX/CMAKE_CXX_COMPILER.