call "D:\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
Firstly, I switch the CMD to the VS2017 runtime environment.
gn gen out/Default --args="target_cpu="x64" is_clang=true" --ide=vs2017
ninja -C out/Default
these are the commands I use to compile the WebRTC M92 version, and they work well.
However, when I open the generated all.sln using VS2017 and try to recompile the WebRTC project, there are some errors, and I don't understand how these errors occurred. I want to know the underlying principles behind this problem.
Below is the error message I encountered.
1>FAILED: obj/third_party/boringssl/boringssl/refcount_c11.obj
1>..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe /nologo /showIncludes:user "-imsvcD:\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-imsvcD:\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-imsvcC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-imsvcD:\Windows Kits\10\include\10.0.19041.0\ucrt" "-imsvcD:\Windows Kits\10\include\10.0.19041.0\shared" "-imsvcD:\Windows Kits\10\include\10.0.19041.0\um" "-imsvcD:\Windows Kits\10\include\10.0.19041.0\winrt" "-imsvcD:\Windows Kits\10\include\10.0.19041.0\cppwinrt" -DUSE_AURA=1 "-DCR_CLANG_REVISION=\"llvmorg-13-init-10392-gd3676d4b-1\"" -D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_NODISCARD -D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS -D_LIBCPP_DEBUG=0 -D_LIBCPP_NO_AUTO_LINK -D__STD_C -D_CRT_RAND_S -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL -D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=2 -DWIN32 -D_SECURE_ATL -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_UNICODE -DUNICODE -DNTDDI_VERSION=NTDDI_WIN10_VB -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DBORINGSSL_ALLOW_CXX_RUNTIME -DBORINGSSL_IMPLEMENTATION -DBORINGSSL_NO_STATIC_INITIALIZER -DOPENSSL_SMALL -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -I../.. -Igen -I../../third_party/boringssl/src/include -fno-delete-null-pointer-checks -fno-ident -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -fcomplete-member-pointers /Gy /FS /bigobj /utf-8 /Zc:twoPhase /Zc:sizedDealloc- /D__WRL_ENABLE_FUNCTION_STATICS__ -fmsc-version=1916 -m64 -msse3 /Brepro -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -Xclang -fdebug-compilation-dir -Xclang . -no-canonical-prefixes /Od /Ob0 /GF /Z7 -gcodeview-ghash -ftrivial-auto-var-init=pattern /guard:cf,nochecks /MTd -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang checked-ptr-as-trivial-member -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wno-shorten-64-to-32 /W3 /wd4800 /wd4267 /wd4996 -Wno-unused-variable -Wno-misleading-indentation /WX /wd4091 /wd4127 /wd4251 /wd4275 /wd4312 /wd4324 /wd4351 /wd4355 /wd4503 /wd4589 /wd4611 /wd4100 /wd4121 /wd4244 /wd4505 /wd4510 /wd4512 /wd4610 /wd4838 /wd4995 /wd4996 /wd4456 /wd4457 /wd4458 /wd4459 /wd4200 /wd4201 /wd4204 /wd4221 /wd4245 /wd4267 /wd4305 /wd4389 /wd4702 /wd4701 /wd4703 /wd4661 /wd4706 /wd4715 -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-psabi -Wno-ignored-pragma-optimize -Wno-implicit-int-float-conversion -Wno-final-dtor-non-final-class -Wno-builtin-assume-aligned-alignment -Wno-deprecated-copy -Wno-non-c-typedef-for-linkage -Wmax-tokens /TC -Wno-implicit-fallthrough /c ../../third_party/boringssl/src/crypto/refcount_c11.c /Foobj/third_party/boringssl/boringssl/refcount_c11.obj /Fd"obj/third_party/boringssl/boringssl_c.pdb"
1>In file included from ../../third_party/boringssl/src/crypto/refcount_c11.c:22:
1>In file included from ..\..\third_party\llvm-build\Release+Asserts\lib\clang\13.0.0\include\stdatomic.h:17:
1>D:\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\stdatomic.h(15,2): error : <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.
1>#error <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.
1> ^
1>../../third_party/boringssl/src/crypto/refcount_c11.c(39,23): error : implicit declaration of function 'atomic_load' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
1> uint32_t expected = atomic_load(count);
1> ^
1>../../third_party/boringssl/src/crypto/refcount_c11.c(43,9): error : implicit declaration of function 'atomic_compare_exchange_weak' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
1> if (atomic_compare_exchange_weak(count, &expected, new_value)) {
1> ^
1>../../third_party/boringssl/src/crypto/refcount_c11.c(51,23): error : implicit declaration of function 'atomic_load' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
1> uint32_t expected = atomic_load(count);
1> ^
1>../../third_party/boringssl/src/crypto/refcount_c11.c(60,11): error : implicit declaration of function 'atomic_compare_exchange_weak' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
1> if (atomic_compare_exchange_weak(count, &expected, new_value)) {
1> ^
1>5 errors generated.
For convenience, I will attach a picture.
I tried installing the LLVM toolset on VS2022, but I still encountered the same problem. I also have another question. When I open all.sln using VS2017, I see that the configuration name is "GN" in the project's configuration panel. Does this mean that even if I configure to use a different toolset in VS, it will not have any effect? Will it follow the configuration "gn gen out/Default --args="target_cpu="x64" is_clang=true" --ide=vs2017", where is_clang=true is specified?