Skip to content

Conversation

@eeckstein
Copy link
Contributor

With some hacks and workarounds I could get SwiftCompilerSources working on my local Windows machine.
To-do: also enable it in lldb (see my comment in the top-level CMakeLists file).

@eeckstein eeckstein marked this pull request as draft April 25, 2024 09:19
@eeckstein
Copy link
Contributor Author

@swift-ci test windows

@eeckstein eeckstein requested a review from atrick April 25, 2024 09:21
CMakeLists.txt Outdated
Comment on lines 733 to 736
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lldb is not built before swift, it is built alongside as a single unified build. This implies that there is a missing dependency in the LLDB build definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. I updated the comment (We can fix the underlying problem in a follow-up PR).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Statically linking the standard library is not supported - how do we ensure that this is not applied to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I thought that -static means that the currently built module is statically linked. The option is applied to the SwiftCompilerSources modules (and not to the stdlib).
Anyway, without this option it doesn't work and with this option it works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, this flag is only applied to SwiftCompilerSources? If so, that should be fine. I just wanted to ensure that it didn't accidentally leak. You are correct that it only applies to the module that you are building.

Comment on lines 55 to 57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to implement this with the Win32 + ucrt APIs to convert the stderr handle to a FILE *.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this works on newer compilers, perhaps we should also include a version check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to check if it works with newer compilers

@eeckstein
Copy link
Contributor Author

@swift-ci test Windows

@eeckstein eeckstein force-pushed the windows-enable-swift branch from 6ae7846 to b5a6f37 Compare April 25, 2024 16:45
@eeckstein
Copy link
Contributor Author

@swift-ci test Windows

@eeckstein eeckstein force-pushed the windows-enable-swift branch from b5a6f37 to b569328 Compare April 25, 2024 18:26
@eeckstein
Copy link
Contributor Author

@swift-ci test Windows

@eeckstein eeckstein force-pushed the windows-enable-swift branch from b569328 to b5ab832 Compare April 25, 2024 20:08
@eeckstein
Copy link
Contributor Author

@swift-ci test windows

@eeckstein
Copy link
Contributor Author

The build is failing with

FAILED: tools/swift/SwiftCompilerSources/Basic.o T:/5/tools/swift/SwiftCompilerSources/Basic.o 
cmd.exe /C "cd /D C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\swift\SwiftCompilerSources && T:\toolchains\swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-18-a-windows10\LocalApp\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swiftc.exe -c -o T:/5/tools/swift/SwiftCompilerSources/Basic.o -resource-dir T:/toolchains/swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-18-a-windows10/LocalApp/Programs/Swift/Platforms/0.0.0/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift -target x86_64-unknown-windows-msvc -module-name Basic -emit-module -emit-module-path T:/5/tools/swift/SwiftCompilerSources/Basic.swiftmodule -parse-as-library C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/SwiftCompilerSources/Sources/Basic/SourceLoc.swift C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/SwiftCompilerSources/Sources/Basic/StringParser.swift C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/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 -I -Xcc C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/llvm-project/llvm/include -Xcc -I -Xcc T:/5/include -Xcc -I -Xcc C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/llvm-project/llvm/../clang/include -Xcc -I -Xcc T:/5/tools/clang/include -Xcc -I -Xcc C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/include -Xcc -I -Xcc T:/5/tools/swift/SwiftCompilerSources/../include -I T:/5/tools/swift/SwiftCompilerSources"
<unknown>:0: error: cannot load underlying module for 'CxxStdlib'

I didn't see this problem when building locally on my machine.

@eeckstein eeckstein force-pushed the windows-enable-swift branch from b5ab832 to 8f447fb Compare April 26, 2024 12:43
@eeckstein
Copy link
Contributor Author

@swift-ci test Windows

@eeckstein eeckstein force-pushed the windows-enable-swift branch from 8f447fb to b5c4457 Compare April 26, 2024 17:02
@eeckstein
Copy link
Contributor Author

@swift-ci test Windows

@compnerd
Copy link
Member

The build is failing with

FAILED: tools/swift/SwiftCompilerSources/Basic.o T:/5/tools/swift/SwiftCompilerSources/Basic.o 
cmd.exe /C "cd /D C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\swift\SwiftCompilerSources && T:\toolchains\swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-18-a-windows10\LocalApp\Programs\Swift\Toolchains\0.0.0+Asserts\usr\bin\swiftc.exe -c -o T:/5/tools/swift/SwiftCompilerSources/Basic.o -resource-dir T:/toolchains/swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-18-a-windows10/LocalApp/Programs/Swift/Platforms/0.0.0/Windows.platform/Developer/SDKs/Windows.sdk/usr/lib/swift -target x86_64-unknown-windows-msvc -module-name Basic -emit-module -emit-module-path T:/5/tools/swift/SwiftCompilerSources/Basic.swiftmodule -parse-as-library C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/SwiftCompilerSources/Sources/Basic/SourceLoc.swift C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/SwiftCompilerSources/Sources/Basic/StringParser.swift C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/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 -I -Xcc C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/llvm-project/llvm/include -Xcc -I -Xcc T:/5/include -Xcc -I -Xcc C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/llvm-project/llvm/../clang/include -Xcc -I -Xcc T:/5/tools/clang/include -Xcc -I -Xcc C:/Users/swift-ci/jenkins/workspace/swift-PR-windows/swift/include -Xcc -I -Xcc T:/5/tools/swift/SwiftCompilerSources/../include -I T:/5/tools/swift/SwiftCompilerSources"
<unknown>:0: error: cannot load underlying module for 'CxxStdlib'

I didn't see this problem when building locally on my machine.

This is likely another missing dependency in the build graph (CC: @etcwilde). The build is shuffled on differently on different hosts. The dependencies should be accurate to avoid these types of spurious failures.

@eeckstein
Copy link
Contributor Author

This is likely another missing dependency in the build graph

I already fixed it. I was using some wrong build options

@eeckstein eeckstein force-pushed the windows-enable-swift branch from b5c4457 to dcf27a1 Compare April 29, 2024 08:52
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein marked this pull request as ready for review April 29, 2024 08:54
@ahoppen ahoppen removed their request for review April 29, 2024 16:49
@eeckstein eeckstein merged commit 74ed041 into swiftlang:main Apr 30, 2024
@eeckstein eeckstein deleted the windows-enable-swift branch April 30, 2024 07:04
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

Successfully merging this pull request may close these issues.

2 participants