A compilation error occurs when using clang in a Windows environment - c++

I compliation the code with Vscode.
The clang -v:
clang version 14.0.3
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin
You can see I get clang form msys.
The file I compliate use such header file:
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include <d2d1.h>
The task I use :
"args": [
"-fdiagnostics-color=always",
"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0\\um\\x86\\user32.lib",
"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0\\um\\x86\\ole32.lib",
"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0\\um\\x86\\d2d1.lib",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-mwindows"
],
And the complier messages :
C:\msys64\mingw64\bin\clang-cpp.exe -fdiagnostics-color=always "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\user32.lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\ole32.lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\d2d1.lib" -g C:\Users\cookie\Desktop\GameEngineFromScratch\Platform\Windows\helloengine_d2d.cpp -o C:\Users\cookie\Desktop\GameEngineFromScratch\Platform\Windows\helloengine_d2d.exe -mwindows
clang-cpp: warning: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\user32.lib: 'linker' input unused in cpp mode [-Wunused-command-line-argument]
clang-cpp: warning: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\ole32.lib: 'linker' input unused in cpp mode [-Wunused-command-line-argument]
clang-cpp: warning: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\d2d1.lib: 'linker' input unused in cpp mode [-Wunused-command-line-argument]
clang-cpp: warning: argument unused during compilation: '-mwindows' [-Wunused-command-line-argument]
I got a executable file but when I run it my terminal give me an erro message Unable to run: The specified executable is not a valid application for this operating system platform
It look like I got a executable file for linux but not windows.How to solve this question.

clang-cpp is the Clang preprocessor, not the C++ compiler. You should use clang++ for the C++ compiler front-end program.

Related

How to add specific boost library to MINGW include path

I am trying to set up the boost libraries for C++ in Visual Studio Code: I have extracted the zip file to my program files but when I go to build it all with bootstrap.bat it comes up with this error. It works fine for the first 4 then stops. I have no additional permissions set up
C:\Users\*user*>cd "C:\Program Files\boost\boost_1_78_0"
C:\Program Files\boost\boost_1_78_0>bootstrap.bat
Building Boost.Build engine
LOCALAPPDATA=C:\Users\Alex\AppData\Local
Found with vswhere C:\Program Files\Microsoft Visual Studio\2022\Community
Found with vswhere C:\Program Files\Microsoft Visual Studio\2022\Community
Call_If_Exists "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\..\..\VC\Auxiliary\Build\vcvarsall.bat" AMD64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.0.5
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
###
### Using 'vc143' toolset.
###
C:\Program Files\boost\boost_1_78_0\tools\build\src\engine>"cl" /nologo /MP /MT /TP /Feb2 /wd4996 /O2 /GL /EHsc -DNDEBUG builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filent.cpp filesys.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp jam_strings.cpp startup.cpp subst.cpp sysinfo.cpp timestamp.cpp variable.cpp w32_getreg.cpp modules/order.cpp modules/path.cpp modules/property-set.cpp modules/regex.cpp modules/sequence.cpp modules/set.cpp /link kernel32.lib advapi32.lib user32.lib
builtins.cpp
class.cpp
command.cpp
compile.cpp
C:\Program Files\boost\boost_1_78_0\tools\build\src\engine\class.cpp : fatal error C1083: Cannot open compiler generated file: 'C:\Program Files\boost\boost_1_78_0\tools\build\src\engine\class.obj': Permission denied
C:\Program Files\boost\boost_1_78_0\tools\build\src\engine\command.cpp : fatal error C1083: Cannot open compiler generated file: 'C:\Program Files\boost\boost_1_78_0\tools\build\src\engine\command.obj': Permission denied
C:\Program Files\boost\boost_1_78_0\tools\build\src\engine\compile.cpp : fatal error C1083: Cannot open compiler generated file: 'C:\Program Files\boost\boost_1_78_0\tools\build\src\engine\compile.obj': Permission denied
C:\Program Files\boost\boost_1_78_0\tools\build\src\engine\builtins.cpp : fatal error C1083: Cannot open compiler generated file: 'C:\Program Files\boost\boost_1_78_0\tools\build\src\engine\builtins.obj': Permission denied
cl : Command line error D8040 : error creating or communicating with child process
C:\Program Files\boost\boost_1_78_0\tools\build\src\engine>dir *.exe
vol drive c
vol serial number
Directory of C:\Program Files\boost\boost_1_78_0\tools\build\src\engine
File Not Found
C:\Program Files\boost\boost_1_78_0\tools\build\src\engine>copy /b .\b2.exe .\bjam.exe
The system cannot find the file specified.
Failed to build Boost.Build engine.
C:\Program Files\boost\boost_1_78_0>
All I want these for is for the Python Library, is there a way to move said library directly into the MINGW include file and ignore the rest that won't work?

How to tell Bazel which compiler to use without configuring a new toolchain

I would like to force Bazel to use a new compiler to build my project.
From what I understand I could configure a new toolchain or use some command-line options.
I tried the following options:
-CC=clang bazel build //main:hello-world
-export CC=C:\cygwin64\bin\clang++
- bazel build //main:hello-world --client_env=CC=clang
I think these are not working because if I compile the same hello-world.cc file with
clang hello-world.cc
I get the error:
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
but with
CC=clang bazel build //main:hello-world
or
bazel build //main:hello-world --client_env=CC=clang
the build is successful.
Any idea why the result is different, and how to solve this?
Where can I check which compiler is Bazel using?
EDIT:
here the output of:
CC=C:\cygwin64\bin\clang bazel build -s //main:hello-world
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Analyzing: target //main:hello-world (1 packages loaded, 0 targets configured)
Analyzing: target //main:hello-world (11 packages loaded, 18 targets configured)
INFO: Analyzed target //main:hello-world (14 packages loaded, 59 targets configured).
INFO: Found 1 target...
[0 / 6] [Prepa] BazelWorkspaceStatusAction stable-status.txt ... (4 actions, 0 running)
SUBCOMMAND: # //main:hello-world [action 'Compiling main/hello-world.cc', configuration: 1f7c3bee164375155568e7845819f422152903a0240344d14b0c6474746ef185, execution platform: #local_config_platform//:host]
cd C:/cygwin64/home/user/_bazel_user/5r4lncy4/execroot/__main__
SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;;C:\WINDOWS\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
SET PWD=/proc/self/cwd
SET RUNFILES_MANIFEST_ONLY=1
SET TEMP=C:\cygwin64\tmp
SET TMP=C:\cygwin64\tmp
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/cl.exe /nologo /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 /EHsc /wd4351 /wd4291 /wd4250 /wd4996 /I. /Ibazel-out/x64_windows-fastbuild/bin /Iexternal/bazel_tools /Ibazel-out/x64_windows-fastbuild/bin/external/bazel_tools /showIncludes /MD /Od /Z7 /wd4117 -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted" /Fobazel-out/x64_windows-fastbuild/bin/main/_objs/hello-world/hello-world.obj /c main/hello-world.cc
SUBCOMMAND: # //main:hello-world [action 'Linking main/hello-world.exe', configuration: 1f7c3bee164375155568e7845819f422152903a0240344d14b0c6474746ef185, execution platform: #local_config_platform//:host]
cd C:/cygwin64/home/user/_bazel_user/5r4lncy4/execroot/__main__
SET LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64;
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;;C:\WINDOWS\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
SET PWD=/proc/self/cwd
SET RUNFILES_MANIFEST_ONLY=1
SET TEMP=C:\cygwin64\tmp
SET TMP=C:\cygwin64\tmp
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/link.exe #bazel-out/x64_windows-fastbuild/bin/main/hello-world.exe-2.params
Target //main:hello-world up-to-date:
bazel-bin/main/hello-world.exe
INFO: Elapsed time: 4.561s, Critical Path: 0.67s
INFO: 2 processes: 2 local.
INFO: Build completed successfully, 6 total actions
INFO: Build completed successfully, 6 total actions
Any idea why this happens? i am using windows 10. Thank you in advance
When not defining your own toolchain, bazel attempts to perform automatic configuration for you which indeed takes into account value of CC variable when defined. Why your bare compilation attempt has failed is not entirely clear from the part of error message posted, but when in doubt, you can add -s to your bazel command line to see commands called and with that see which compiler has been called:
$ CC=/usr/bin/clang bazel build -s //:hello
INFO: Analyzed target //:hello (1 packages loaded, 15 targets configured).
INFO: Found 1 target...
SUBCOMMAND: # //:greet [action 'Compiling greet.cpp', configuration: dd44f3279b21e91676f65783c46b7b7816026ef7e696e80c251418ec64ffdf5e]
(cd /tmp/_bzl/execroot/__main__ && \
exec env - \
PATH=/bin:/usr/bin:/usr/local/bin \
PWD=/proc/self/cwd \
/usr/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++0x' -I/usr/lib64/qt/include -MD -MF bazel-out/k8-fastbuild/bin/_objs/greet/greet.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/_objs/greet/greet.pic.o' -fPIC -iquote . -iquote bazel-out/k8-fastbuild/bin -Ibazel-out/k8-fastbuild/bin/_virtual_includes/greet -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c greet.cpp -o bazel-out/k8-fastbuild/bin/_objs/greet/greet.pic.o)
SUBCOMMAND: # //:hello [action 'Compiling hello.cpp', configuration: dd44f3279b21e91676f65783c46b7b7816026ef7e696e80c251418ec64ffdf5e]
(cd /tmp/_bzl/execroot/__main__ && \
exec env - \
PATH=/bin:/usr/bin:/usr/local/bin \
PWD=/proc/self/cwd \
/usr/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++0x' -I/usr/lib64/qt/include -MD -MF bazel-out/k8-fastbuild/bin/_objs/hello/hello.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/_objs/hello/hello.pic.o' -fPIC -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/k8-fastbuild/bin/external/bazel_tools -Ibazel-out/k8-fastbuild/bin/_virtual_includes/greet -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c hello.cpp -o bazel-out/k8-fastbuild/bin/_objs/hello/hello.pic.o)
SUBCOMMAND: # //:hello [action 'Linking hello', configuration: dd44f3279b21e91676f65783c46b7b7816026ef7e696e80c251418ec64ffdf5e]
(cd /tmp/_bzl/execroot/__main__ && \
exec env - \
PATH=/bin:/usr/bin:/usr/local/bin \
PWD=/proc/self/cwd \
/usr/bin/clang #bazel-out/k8-fastbuild/bin/hello-2.params)
Target //:hello up-to-date:
bazel-bin/hello
INFO: Elapsed time: 1.606s, Critical Path: 0.44s
INFO: 3 processes: 3 linux-sandbox.
INFO: Build completed successfully, 5 total actions
Windows is a bit special / different case: I've started looking at the the corresponding rules_cc, but from there actually followed back to the docs, currently recommended method would be to add a platform definition (e.g. in your workspace root BUILD):
platform(
name = "x64_windows-clang-cl",
constraint_values = [
"#platforms//cpu:x86_64",
"#platforms//os:windows",
"#bazel_tools//tools/cpp:clang-cl",
],
)
And registering the additional toolchain in your WORKSPACE file:
register_execution_platforms(
":x64_windows-clang-cl"
)
register_toolchains(
"#local_config_cc//:cc-toolchain-x64_windows-clang-cl",
)
Then (for now) use --incompatible_enable_cc_toolchain_resolution flag with bazel.
At least at the moment, alternatively you should be able to tell bazel to use LLVM on Windows by running bazel with: --compiler=clang-cl.
You may need to set BAZEL_LLVM (this time) to a directory where LLVM is installed (or try relying on automatic resolution).
That said, it does not look like you could use cygwin LLVM compiler on Windows while still relying on automatic toolchain configuration. I suspect you would really need to define your own toolchain for that (not sure how substantial problems would you encounter crossing the boundary between bazel for Windows and cygwin based compiler each having different idea about what path names to use).

clang fails to build libc++ (redefine nothrow_t, new, delete, new[], delete[] ) against new MSVC 2019 and Windows SDK 10.0.17763.0

It seems there are 5 symbols conflicted: nothrow_t, new, delete, new[], delete[]
[2/37] Building CXX object lib\CMakeFiles\cxx_shared.dir\__\src\algorithm.cpp.obj
FAILED: lib/CMakeFiles/cxx_shared.dir/__/src/algorithm.cpp.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe /nologo -TP -DNDEBUG -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -D_ALLOW_MSC_VER_MISMATCH -D_CRTBLD -D_CRT_SECURE_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -IC:\Users\User\AppData\Roaming\libcxx-master\include -fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME -D_LIBCPP_NO_VCRUNTIME /MD /O2 /Ob2 /DNDEBUG /std:c++14 -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wno-user-defined-literals -Wno-covered-switch-default -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++11-compat -Wno-undef -Wno-reserved-id-macro -Wno-gnu-include-next -Wno-gcc-compat -Wno-zero-as-null-pointer-constant -Wno-deprecated-dynamic-exception-spec -Wno-sign-conversion -Wno-old-style-cast -Wno-deprecated -Wno-shift-sign-overflow -Wno-double-promotion -Wno-error -EHsc /Zl /showIncludes /Folib\CMakeFiles\cxx_shared.dir\__\src\algorithm.cpp.obj /Fdlib\CMakeFiles\cxx_shared.dir\ -c C:\Users\User\AppData\Roaming\libcxx-master\src\algorithm.cpp
In file included from C:\Users\User\AppData\Roaming\libcxx-master\src\algorithm.cpp:10:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\random:1645:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\istream:163:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\ostream:137:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\ios:215:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\__locale:23:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\support/win32/locale_win32.h:15:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xlocinfo.h:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\yvals.h:9:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\crtdbg.h:13:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\vcruntime_new_debug.h:10:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\vcruntime_new.h(34,16): error: redefinition of 'nothrow_t'
struct nothrow_t {
^
C:\Users\User\AppData\Roaming\libcxx-master\include\new(123,25): note: previous definition is here
struct _LIBCPP_TYPE_VIS nothrow_t {};
^
This is my CMAKE. (also tried 19.20)
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM="C:/Program Files (x86)/Ninja/ninja.exe"
-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe"
-DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME"
-DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe"
-DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME -D_LIBCPP_NO_VCRUNTIME"
-DCMAKE_C_LINK_EXECUTABLE="C:/Program Files/LLVM/bin/lld-link.exe"
-DCMAKE_CXX_LINK_EXECUTABLE="C:/Program Files/LLVM/bin/lld-link.exe"
-DLLVM_USE_LINKER="C:/Program Files/LLVM/bin/lld-link.exe"
-DLLVM_PATH="C:/Program Files/LLVM" -DLIBCXX_ENABLE_SHARED=YES
-DLIBCXX_ENABLE_STATIC=NO -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES
"C:/Users/User/AppData/Roaming/libcxx-master"
This is my SDK
set LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\lib\x64;
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64
Can I make it work? Where to send issue to whom?
I face the same issue with VS2019.
I removed no_runtime flags but set
-DCMAKE_C_LINK_EXECUTABLE="lld-link.exe -flavor link" ^
-DCMAKE_CXX_LINK_EXECUTABLE="lld-link.exe -flavor link" ^
Added -flavor link and it linked successfully. I did not test exceptions but test program with std::thread compiles and runs same as with cl compiler.
UPD: basic try-catch with std::exception thrown works
UPD: full cmake batch (your paths may vary!)
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM="D:/Programming/ninja-build/ninja.exe" ^
-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="clang-cl.exe" ^
-DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows" ^
-DCMAKE_CXX_COMPILER="clang-cl.exe" ^
-DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows " ^
-DCMAKE_C_LINK_EXECUTABLE="lld-link.exe -flavor link" ^
-DCMAKE_CXX_LINK_EXECUTABLE="lld-link.exe -flavor link" ^
-DLLVM_USE_LINKER="lld-link.exe" ^
-DLLVM_PATH="C:/Program Files/LLVM" -DLIBCXX_ENABLE_SHARED=YES ^
-DLIBCXX_ENABLE_STATIC=NO -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES ^
"D:\Programming\cpp_sandbox\libcxx-9.0.0.src"

getting No such file or directory when I try to build chromium

I am getting following when I try to build chromium
c:\src\chromium\src>ninja -C out\Default2 chrome
ninja: Entering directory `out\Default2'
[6/28555] CXX obj/base/base_static/pe_image.obj
FAILED: obj/base/base_static/pe_image.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\BIN\amd64/cl.exe" /nologo /showIncludes /FC #obj/base/base_static/pe
_image.obj.rsp /c ../../base/win/pe_image.cc /Foobj/base/base_static/pe_image.ob
j /Fd"obj/base/base_static_cc.pdb"
c:\src\chromium\src\base\win\pe_image.cc(8): fatal error C1083: Cannot open incl
ude file: 'stddef.h': No such file or directory
[7/28555] CXX obj/base/base_paths/base_paths.obj
FAILED: obj/base/base_paths/base_paths.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\BIN\amd64/cl.exe" /nologo /showIncludes /FC #obj/base/base_paths/bas
e_paths.obj.rsp /c ../../base/base_paths.cc /Foobj/base/base_paths/base_paths.ob
j /Fd"obj/base/base_paths_cc.pdb"
c:\src\chromium\src\base\files\file_path.h(105): fatal error C1083: Cannot open
include file: 'stddef.h': No such file or directory
[8/28555] CXX obj/base/base_paths/base_paths_win.obj
FAILED: obj/base/base_paths/base_paths_win.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Stu
dio 14.0\VC\BIN\amd64/cl.exe" /nologo /showIncludes /FC #obj/base/base_paths/bas
e_paths_win.obj.rsp /c ../../base/base_paths_win.cc /Foobj/base/base_paths/base_
paths_win.obj /Fd"obj/base/base_paths_cc.pdb"
c:\program files (x86)\windows kits\10\include\10.0.10586.0\um\winnt.h(34): fata
l error C1083: Cannot open include file: 'ctype.h': No such file or directory
[11/28555] ACTION //base:build_date(//build/toolchain/win:x64)
ninja: build stopped: subcommand failed.
This is my first time building chroium,
I have visual studio 2015 community edition installed with Windows SDK , and also installed WDK seperately without which "gn gen out/Default2" was not working
Any idea what this issue could be
1.Your build errors:
c:\src\chromium\src\base\win\pe_image.cc(8): fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
c:\src\chromium\src\base\files\file_path.h(105): fatal error C1083: Cannot openinclude file: 'stddef.h': No such file or directory
c:\program files (x86)\windows kits\10\include\10.0.10586.0\um\winnt.h(34): fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory
2.You may need to check the header files which caused the build errors:
The headers, sources, and libraries are now distributed as part of a separate Universal CRT SDK.
Excerpt from the above:
Visual C++ SDK. The headers, sources, and libraries are now distributed as part of a separate Universal CRT SDK. This SDK is included with Visual Studio; it is installed by default to C:\Program Files (x86)\Windows Kits\10. The debug ucrtbased.dll is also included as part of this SDK and is installed to the system directory.
3.You can also try to reference the following links, it's the same issue with yours:

Boost library files not recognized although included in PATH

Boost library header files were included in PATH AND SYMBOLS but building the program generates an error message:
10:27:13 **** Incremental Build of configuration gcc-debug for project DB8 ****
make MODE=debug CONFIGNAME=gcc-debug all
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `mkdir -p "out/gcc-debug/" && echo "-g -Wall - I/usr/include -fno-stack-protector -DXMLPARSER=libxml -DWITH_PARSIM - DWITH_NETBUILDER -I"C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include" -I"C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn" -IC:/local/boost_1_59_0/boost -I. - IC:/Users/LuisH.Forchesatto/Downloads/omnetpp-4.6/include" >out/gcc-debug//.last- copts'
defaultSensor.cc
In file included from C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn/connection.h:33:0,
from C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/mysql_connection.h:30,
from dbWriteWin.h:6,
from defaultSensor.cc:6:
C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn/warning.h:40:0: warning: ignoring #pragma warning [- Wunknown-pragmas]
#pragma warning (disable : 4290)
^
In file included from C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn/variant.h:38:0,
from C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn/connection.h:35,
from C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/mysql_connection.h:30,
from dbWriteWin.h:6,
from defaultSensor.cc:6:
C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn/exception.h:48:0: warning: ignoring #pragma warning [- Wunknown-pragmas]
#pragma warning (disable : 4290)
^
C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn/exception.h:52:0: warning: ignoring #pragma warning [- Wunknown-pragmas]
#pragma warning(push)
^
C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn/exception.h:53:0: warning: ignoring #pragma warning [- Wunknown-pragmas]
#pragma warning(disable: 4275)
^
C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/cppconn/exception.h:58:0: warning: ignoring #pragma warning [- Wunknown-pragmas]
#pragma warning(pop)
^
In file included from dbWriteWin.h:6:0,
from defaultSensor.cc:6:
C:/Program Files (x86)/MySQL/MySQL Connector C++ 1.1.6/include/mysql_connection.h:31:32: fatal error: boost/shared_ptr.hpp: No such file or directory
#include <boost/shared_ptr.hpp>
^
compilation terminated.
make: *** [out/gcc-debug//defaultSensor.o] Error 1
Makefile:94: recipe for target 'out/gcc-debug//defaultSensor.o' failed
10:27:14 Build Finished (took 1s.183ms)
The library is installed in the system, the folder/file exists in the computer and it's path is correct. What can be causing this error?
Contents of path and symbols:
https://dl.dropboxusercontent.com/u/85576999/paths%20and%20symbols.png
Contents of the boost library folder:
https://dl.dropboxusercontent.com/u/85576999/boost%20folder.png
Do not use spaces in paths. I suggest moving (or reinstalling) MySQL Connector libraries to the folder with simple name without spaces, for example: c:\mysqlconnector.
Check whether the path to boost is set for C++ language too - on the Path and Symbols screen there is Assembly language focused.
Take into account these cluses provided by Rudi.