CMake error: Evaluation file to be written multiple times with different content. Failed to build from source on win11 msvc2022
- Dominant language
- C++
- Stars
- 30.5k
- Forks
- 5.9k
- PR merge metrics
- No merged PRs in 30d
Description
### A brief overview of the build process.
- Step 1: clone repo
`git clone git@github.com:facebook/folly.git`
- Step 2: install some libs
Downloading some libs(boost, double-conversion, glog, gflags, libevent, openssl, fmt, fast_float, zstd) from the information of files in folly\build\fbcode_builder\manifests folder, using cmake and vs2022 to install libs.
- Step 3: write a .bat file
Writing msvc_build.bat to generate a folly-vs2022 solution.
Here is the content of that .bat file.
```
@echo off
setlocal EnableExtensions EnableDelayedExpansion
if defined ProgramFiles set PF=%ProgramFiles%
if not defined ProgramFiles set PF=C:\Program Files
if not defined PF (echo ProgramFiles not set & goto error)
for %%t in (Community Professional Enterprise) do (
if exist "%PF%\Microsoft Visual Studio\2022\%%t" (
set vcdir=%PF%\Microsoft Visual Studio\2022\%%t
)
)
if not defined vcdir (echo Visual C++ not found & goto error)
set VCARCH=amd64
set VCSDK=10.0.22621.0
call "%vcdir%\VC\Auxiliary\Build\vcvarsall.bat" %VCARCH% %VCSDK%
set BOOST_ROOT=C:\boost_1_83_0\installed
set DOUBLE_CONVERSION_ROOT=C:\Program Files (x86)\double-conversion
set GLOG_ROOT=C:\Program Files (x86)\glog
set LIBEVENT_ROOT=C:\Program Files (x86)\libevent
set OPENSSL_ROOT=C:\Program Files\OpenSSL
set FMT_ROOT=C:\Program Files (x86)\FMT
set FAST_FLOAT_ROOT=C:\Program Files (x86)\fast_float
set ZSTD_ROOT=C:\Program Files (x86)\zstd
set ROOTS=BOOST_ROOT;DOUBLE_CONVERSION_ROOT;GLOG_ROOT;LIBEVENT_ROOT;OPENSSL_ROOT;FMT_ROOT;FAST_FLOAT_ROOT;ZSTD_ROOT
set LIB=%LIB%
set INCLUDE=%INCLUDE%
for %%r in (%ROOTS%) do (
set NEW_LIB=!%%r!\lib
if exist "!NEW_LIB!" set LIB=!LIB!!NEW_LIB!;
set NEW_INCLUDE=!%%r!\include
if exist "!NEW_INCLUDE!" set INCLUDE=!INCLUDE!!NEW_INCLUDE!;
)
if not defined CC set CC=cl.exe
if not defined CXX set CXX=cl.exe
goto cmake
:error
echo ENV ERROR %ERRORLEVEL%: %DATE% %TIME%
exit /b 1
:cmake
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=.\install -S . -B .\msvc_build
```
- Step 4: Run the .bat file
The output of running .bat file.
```
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.10.5
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The CXX compiler identification is MSVC 19.40.33813.0
-- The C compiler identification is MSVC 19.40.33813.0
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe
-- 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.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- setting C++ standard to C++17
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Boost toolset is unknown (compiler MSVC 19.40.33813.0)
-- Boost toolset is unknown (compiler MSVC 19.40.33813.0)
-- Boost toolset is unknown (compiler MSVC 19.40.33813.0)
-- Boost toolset is unknown (compiler MSVC 19.40.33813.0)
-- Boost toolset is unknown (compiler MSVC 19.40.33813.0)
-- Boost toolset is unknown (compiler MSVC 19.40.33813.0)
-- Boost toolset is unknown (compiler MSVC 19.40.33813.0)
-- Boost toolset is unknown (compiler MSVC 19.40.33813.0)
-- Found Boost: C:/boost_1_83_0/installed/lib/cmake/Boost-1.83.0/BoostConfig.cmake (found suitable version "1.83.0", minimum required is "1.51.0") found components: context filesystem program_options regex system thread
-- Found DoubleConversion: C:/Program Files (x86)/double-conversion/lib/double-conversion.lib
-- Found FastFloat: C:/Program Files (x86)/fast_float/include
-- Found gflags from package config C:/Program Files (x86)/gflags/lib/cmake/gflags/gflags-config.cmake
-- Found Glog: C:/Program Files (x86)/glog/lib/glogd.lib
-- Found gflags as a dependency of glog::glog, include=C:/Program Files (x86)/gflags/include, libs=gflags_nothreads_static
-- Could NOT find LIBUNWIND (missing: LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
-- Found libevent: C:/Program Files (x86)/libevent/lib/event.lib
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Found OpenSSL: C:/Program Files/OpenSSL/lib/libcrypto.lib (found suitable version "1.1.1l", minimum required is "1.1.1")
-- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
-- Could NOT find LibLZMA (missing: LIBLZMA_LIBRARY LIBLZMA_INCLUDE_DIR LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET)
-- Could NOT find LZ4 (missing: LZ4_LIBRARY LZ4_INCLUDE_DIR)
-- Found ZSTD: C:/Program Files (x86)/zstd/lib/zstd.lib
-- Found Zstd: C:/Program Files (x86)/zstd/lib/zstd.lib
-- Could NOT find SNAPPY (missing: SNAPPY_LIBRARY SNAPPY_INCLUDE_DIR)
-- Could NOT find LIBDWARF (missing: LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR)
-- Could NOT find LIBIBERTY (missing: LIBIBERTY_LIBRARY LIBIBERTY_INCLUDE_DIR)
-- Could NOT find LIBAIO (missing: LIBAIO_LIBRARY LIBAIO_INCLUDE_DIR)
-- Could NOT find LIBURING (missing: LIBURING_LIBRARY LIBURING_INCLUDE_DIR)
-- Could NOT find LIBSODIUM (missing: LIBSODIUM_LIBRARY LIBSODIUM_INCLUDE_DIR)
-- Could NOT find LIBUNWIND (missing: LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
-- Looking for swapcontext
-- Looking for swapcontext - not found
-- Looking for C++ include elf.h
-- Looking for C++ include elf.h - not found
-- Looking for backtrace
-- Looking for backtrace - not found
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR)
-- Setting FOLLY_USE_SYMBOLIZER: OFF
-- Setting FOLLY_HAVE_ELF:
-- Setting FOLLY_HAVE_DWARF: FALSE
-- Performing Test FOLLY_CPP_ATOMIC_BUILTIN
-- Performing Test FOLLY_CPP_ATOMIC_BUILTIN - Success
-- Performing Test FOLLY_STDLIB_LIBSTDCXX
-- Performing Test FOLLY_STDLIB_LIBSTDCXX - Failed
-- Performing Test FOLLY_STDLIB_LIBSTDCXX_GE_9
-- Performing Test FOLLY_STDLIB_LIBSTDCXX_GE_9 - Failed
-- Performing Test FOLLY_STDLIB_LIBCXX
-- Performing Test FOLLY_STDLIB_LIBCXX - Failed
-- Performing Test FOLLY_STDLIB_LIBCXX_GE_9
-- Performing Test FOLLY_STDLIB_LIBCXX_GE_9 - Failed
-- Performing Test FOLLY_STDLIB_LIBCPP
-- Performing Test FOLLY_STDLIB_LIBCPP - Success
-- Looking for C++ include jemalloc/jemalloc.h
-- Looking for C++ include jemalloc/jemalloc.h - not found
-- Looking for pthread_atfork
-- Looking for pthread_atfork - not found
-- Looking for accept4
-- Looking for accept4 - not found
-- Looking for getrandom
-- Looking for getrandom - not found
-- Looking for preadv
-- Looking for preadv - not found
-- Looking for pwritev
-- Looking for pwritev - not found
-- Looking for clock_gettime
-- Looking for clock_gettime - not found
-- Looking for pipe2
-- Looking for pipe2 - not found
-- Looking for malloc_usable_size
-- Looking for malloc_usable_size - not found
-- Performing Test FOLLY_HAVE_IFUNC
-- Performing Test FOLLY_HAVE_IFUNC - Failed
-- Performing Test FOLLY_HAVE_UNALIGNED_ACCESS
-- Performing Test FOLLY_HAVE_UNALIGNED_ACCESS - Success
-- Performing Test FOLLY_HAVE_VLA
-- Performing Test FOLLY_HAVE_VLA - Failed
-- Performing Test FOLLY_HAVE_WEAK_SYMBOLS
-- Performing Test FOLLY_HAVE_WEAK_SYMBOLS - Failed
-- Performing Test FOLLY_HAVE_LINUX_VDSO
-- Performing Test FOLLY_HAVE_LINUX_VDSO - Failed
-- Performing Test FOLLY_HAVE_WCHAR_SUPPORT
-- Performing Test FOLLY_HAVE_WCHAR_SUPPORT - Success
-- Performing Test FOLLY_HAVE_EXTRANDOM_SFMT19937
-- Performing Test FOLLY_HAVE_EXTRANDOM_SFMT19937 - Failed
-- Performing Test HAVE_VSNPRINTF_ERRORS
-- Performing Test HAVE_VSNPRINTF_ERRORS - Failed
-- Performing Test GFLAGS_NAMESPACE_IS_GFLAGS
-- Performing Test GFLAGS_NAMESPACE_IS_GFLAGS - Success
-- arch matches x86_64, building SSE4.2 version of base64
-- Performing Test COMPILER_HAS_M_PCLMUL
-- Performing Test COMPILER_HAS_M_PCLMUL - Failed
-- compiler does not have flag pclmul, skipping setting compile flags for D:/gitclone/folly/folly/external/fast-crc32/avx512_crc32c_v8s3x4.cpp;D:/gitclone/folly/folly/external/fast-crc32/sse_crc32c_v8s3x3.cpp;D:/gitclone/folly/folly/hash/detail/ChecksumDetail.cpp;D:/gitclone/folly/folly/hash/detail/Crc32CombineDetail.cpp;D:/gitclone/folly/folly/hash/detail/Crc32cDetail.cpp
-- arch does not match x86_64, skipping setting AVX512 compile flags for crc32c SIMD code
-- Configuring done (41.3s)
-- Generating done (0.3s)
CMake Error in CMakeLists.txt:
Evaluation file to be written multiple times with different content. This
is generally caused by the content evaluating the configuration type,
language, or location of object files:
D:/gitclone/folly/msvc_build/libfolly.pc
CMake Error in CMakeLists.txt:
Evaluation file to be written multiple times with different content. This
is generally caused by the content evaluating the configuration type,
language, or location of object files:
D:/gitclone/folly/msvc_build/libfolly.pc
CMake Error in CMakeLists.txt:
Evaluation file to be written multiple times with different content. This
is generally caused by the content evaluating the configuration type,
language, or location of object files:
D:/gitclone/folly/msvc_build/libfolly.pc
CMake Error in CMakeLists.txt:
Evaluation file to be written multiple times with different content. This
is generally caused by the content evaluating the configuration type,
language, or location of object files:
D:/gitclone/folly/msvc_build/libfolly.pc
CMake Generate step failed. Build files cannot be regenerated correctly.
```
So, how to fix the error?
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.