Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems building for Windows x64 using Visual Studio 17.11.0 #808

Open
glenrgordon opened this issue Aug 18, 2024 · 10 comments
Open

Problems building for Windows x64 using Visual Studio 17.11.0 #808

glenrgordon opened this issue Aug 18, 2024 · 10 comments

Comments

@glenrgordon
Copy link

glenrgordon commented Aug 18, 2024

Trying to build Swift for windows for the first time. 30+ years as Windows developer, brand new to Swift.
I'm using the commands:
repo sync
S:\SourceCache\swift\utils\build.cmd -WindowsSDKs x64 -DebugInfo -SkipPackaging -EnableCaching
No problems till I get to building the basic module. Looks to me that Clang can't parse something from the complex header file but I can't figure out what or why.
Output follows. Any help in at least understanding what might be going wrong would be great. Am wanting to contribute to Swift on Windows, but obviously need to be able to build first.
Let me know if there's other info that I can provide to help diagnose what I must be doing wrong.

Thanks

[3932/6491] Building swift module Basic

FAILED: tools/swift/SwiftCompilerSources/Basic.o S:/b/5/tools/swift/SwiftCompilerSources/Basic.o 

C:\Windows\system32\cmd.exe /C "cd /D S:\SourceCache\swift\SwiftCompilerSources && S:\b\toolchains\swift-5.10.1-RELEASE-windows10\LocalApp\Programs\Swift\Toolchains\5.10.1+Asserts\usr\bin\swiftc.exe -c -o S:/b/5/tools/swift/SwiftCompilerSources/Basic.o -sdk S:/b/toolchains/swift-5.10.1-RELEASE-windows10/LocalApp/Programs/Swift/Platforms/5.10.1/Windows.platform/Developer/SDKs/Windows.sdk -target x86_64-unknown-windows-msvc -module-name Basic -emit-module -emit-module-path S:/b/5/tools/swift/SwiftCompilerSources/Basic.swiftmodule -parse-as-library S:/SourceCache/swift/SwiftCompilerSources/Sources/Basic/SourceLoc.swift S:/SourceCache/swift/SwiftCompilerSources/Sources/Basic/StringParser.swift S:/SourceCache/swift/SwiftCompilerSources/Sources/Basic/Utils.swift -wmo -color-diagnostics -Xfrontend -validate-tbd-against-ir=none -Xfrontend -disable-target-os-checking -Xcc -std=c++17 -Xcc -DCOMPILED_WITH_SWIFT -Xcc -DSWIFT_TARGET -Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable -cxx-interoperability-mode=default -O -cross-module-optimization -Xcc -UNDEBUG -Xcc -DPURE_BRIDGING_MODE -Xfrontend -disable-legacy-type-info -static -Xllvm -sil-disable-pass=loadable-address -Xcc -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH -Xcc -I -Xcc S:/SourceCache/llvm-project/llvm/include -Xcc -I -Xcc S:/b/5/include -Xcc -I -Xcc S:/SourceCache/llvm-project/llvm/../clang/include -Xcc -I -Xcc S:/b/5/tools/clang/include -Xcc -I -Xcc S:/SourceCache/swift/include -Xcc -I -Xcc S:/b/5/tools/swift/SwiftCompilerSources/../include -I S:/b/5/tools/swift/SwiftCompilerSources"
<module-includes>:1:10: note: in file included from <module-includes>:1:

#include "ccomplex"

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include/ccomplex:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include/ccomplex:11:

#include <complex>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\complex:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\complex:13:

#include <sstream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\sstream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\sstream:10:

#include <istream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\istream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\istream:10:

#include <ostream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ostream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ostream:10:

#include <ios>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ios:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ios:10:

#include <xlocnum>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xlocnum:15:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xlocnum:15:

#include <iterator>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\iterator:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\iterator:11:

#include <xutility>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xutility:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xutility:11:

#include <__msvc_iter_core.hpp>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\__msvc_iter_core.hpp:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\__msvc_iter_core.hpp:10:

#include <utility>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\utility:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\utility:11:

#include <type_traits>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\type_traits:131:5: error: static assertion failed: Calling declval is ill-formed, see N4950 [declval]/2.

    static_assert(false, "Calling declval is ill-formed, see N4950 [declval]/2.");

    ^

<module-includes>:1:10: note: in file included from <module-includes>:1:

#include "ccomplex"

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include/ccomplex:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include/ccomplex:11:

#include <complex>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\complex:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\complex:13:

#include <sstream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\sstream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\sstream:10:

#include <istream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\istream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\istream:10:

#include <ostream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ostream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ostream:10:

#include <ios>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ios:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ios:10:

#include <xlocnum>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xlocnum:16:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xlocnum:16:

#include <streambuf>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\streambuf:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\streambuf:10:

#include <xiosbase>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xiosbase:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xiosbase:11:

#include <system_error>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\system_error:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\system_error:13:

#include <stdexcept>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\stdexcept:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\stdexcept:11:

#include <xstring>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xstring:16:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xstring:16:

#include <xpolymorphic_allocator.h>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xpolymorphic_allocator.h:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xpolymorphic_allocator.h:10:

#include <tuple>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\tuple:957:9: error: static assertion failed: get<T>(tuple<Types...>&) requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)

        static_assert(false, "get<T>(tuple<Types...>&) "

        ^

<module-includes>:1:10: note: in file included from <module-includes>:1:

#include "ccomplex"

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include/ccomplex:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include/ccomplex:11:

#include <complex>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\complex:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\complex:13:

#include <sstream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\sstream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\sstream:10:

#include <istream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\istream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\istream:10:

#include <ostream>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ostream:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ostream:10:

#include <ios>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ios:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\ios:10:

#include <xlocnum>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xlocnum:16:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xlocnum:16:

#include <streambuf>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\streambuf:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\streambuf:10:

#include <xiosbase>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xiosbase:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xiosbase:11:

#include <system_error>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\system_error:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\system_error:13:

#include <stdexcept>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\stdexcept:11:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\stdexcept:11:

#include <xstring>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xstring:16:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xstring:16:

#include <xpolymorphic_allocator.h>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xpolymorphic_allocator.h:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\xpolymorphic_allocator.h:10:

#include <tuple>

         ^

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\tuple:969:9: error: static assertion failed: get<T>(const tuple<Types...>&) requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)

        static_assert(false, "get<T>(const tuple<Types...>&) "
@compnerd
Copy link
Owner

compnerd commented Aug 19, 2024

It seems that the error message that you are trying to search for might be one of:

C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\type_traits:131:5: error: static assertion failed: Calling declval is ill-formed, see N4950 [declval]/2.
    static_assert(false, "Calling declval is ill-formed, see N4950 [declval]/2.");
    ^
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\tuple:957:9: error: static assertion failed: get<T>(tuple<Types...>&) requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)
        static_assert(false, "get<T>(tuple<Types...>&) "
        ^
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\tuple:969:9: error: static assertion failed: get<T>(const tuple<Types...>&) requires T to occur exactly once in Types. (N4971 [tuple.elem]/5)
        static_assert(false, "get<T>(const tuple<Types...>&) "

All of these cases seem to indicate an issue where the C++ standard library is unhappy about some path through the standard library.

@compnerd
Copy link
Owner

I think that was recently introduced in 17.11.0. A temporary workaround might be to use 17.10.0 (though we will need to figure out what is going on here).

@compnerd
Copy link
Owner

I think that this might be a bug in the older clang that we use for bootstrapping. It seems to work with the newer compiler. However, that uncovers another bug in build.ps1 :(

@glenrgordon
Copy link
Author

glenrgordon commented Aug 19, 2024 via email

@compnerd
Copy link
Owner

No, not currently; we build the compiler against the windows system libraries and compilers. The problem is that the SwiftCompilerSources is Swift code which falls back to the integrated clang.

@hjyamauchi
Copy link
Collaborator

Could it help if a 6.0 toolchain like this is used as the pinned (bootstrap) toolchain?

@compnerd
Copy link
Owner

@hjyamauchi we cannot pin the toolchain to 6.0 as the 5.10 toolchain is the agreed upon bootstrap toolchain for the project.

@hjyamauchi
Copy link
Collaborator

@compnerd Would it make sense to need to pin the VS version like the Swiftlang CIs then?

@compnerd
Copy link
Owner

Well, I'd rather not pin the VS version for main - that needs to be fixed.

@hyp
Copy link
Collaborator

hyp commented Aug 22, 2024

fix (pending deployment): swiftlang/llvm-project#9153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants