Swift Build-Script Failed: clang: error: no such file or directory: '/we4062'

I am trying to build the Swift source for development, following the instructions in the README for macOS.

I am running the build script with the --debug-swift, --xcode, and --clean options:

utils/build-script --release-debuginfo --debug-swift --xcode -clean

The build ends up failing, and I get a message saying to check the build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeError.log file. These are the contents of the file:

Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
Apple LLVM version 10.0.1 (clang-1001.0.43.3)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Checking whether the ASM compiler is Clang using "--version" did not match "(clang version)":
Apple LLVM version 10.0.1 (clang-1001.0.43.3)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Performing C++ SOURCE FILE Test CXX_SUPPORTS_WE4062 failed with the following output:
Change Dir: /Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/xcodebuild" "-project" "CMAKE_TRY_COMPILE.xcodeproj" "build" "-target" "cmTC_7703d" "-configuration" "Debug"
Build settings from command line:
    TOOLCHAINS = default

Prepare build
note: Using legacy build system

=== BUILD TARGET cmTC_7703d OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

Check dependencies

Write auxiliary files
/bin/mkdir -p /Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/Objects-normal/x86_64
write-file /Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/Objects-normal/x86_64/cmTC_7703d.LinkFileList

CompileC CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/Objects-normal/x86_64/src.o src.cxx normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp
    export LANG=en_US.US-ASCII
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug\" -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.14 -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/Debug/include -I/Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/DerivedSources-normal/x86_64 -I/Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/DerivedSources/x86_64 -I/Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/Debug -Wno-unknown-warning-option -Werror=unguarded-availability-new -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-class-memaccess -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=switch -DCXX_SUPPORTS_WE4062 /we4062 -MMD -MT dependencies -MF /Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/Objects-normal/x86_64/src.d --serialize-diagnostics /Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/Objects-normal/x86_64/src.dia -c /Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/src.cxx -o /Users/calebkleveter/Development/apple/build/Xcode-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-x86_64/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/Objects-normal/x86_64/src.o
clang: error: no such file or directory: '/we4062'

** BUILD FAILED **


The following build commands failed:
	CompileC CMAKE_TRY_COMPILE.build/Debug/cmTC_7703d.build/Objects-normal/x86_64/src.o src.cxx normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Source file was:
int main() { return 0; }

The README says that when you get a build failure, you should make sure your Xcode version and all the support repos are up to date. This is a fresh clone of the repos, so they are all up to date. From what I was able to find, the expected Xcode build is currently 10P82s, however I cannot find that build anywhere to install. I have tried both Xcode 10.2 beta 2 and beta 3 (10P99q).

I have cmake version 3.13.4 and ninja version 1.9.0.

At this point I'm not really sure what I am supposed to do. I don't know what my exact problem is or how I would fix it, but maybe there is someone that can enlighten me?

exact same issue :(

I'm Having the exact same issue, did you resolve it? if so, how?

My suggestion is I would use ninja instead of Xcode just to unblock yourself. Just don't pass in --Xcode.

I'm using ninja.

But i just read the docs in swift repo and it seems that it supports xcode 11.4. And i have installed 11.5.

Could you create a new thread with the exact build steps you followed, your configuration (e.g. what commit you are on, what CMake version is being used) and the error message? (Also if it's a clean build or not?) There might be some differences, as the failure in this thread is related to Xcode, and usually the two build systems end up having different failure modes.