Skip to content

Cross-compilation: fix bundles not unpacked on installation #6361

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

Merged
merged 6 commits into from
Apr 3, 2023

Conversation

MaxDesiatov
Copy link
Contributor

Motivation:

swift experimental-destination install subcommand works with bundle directories, but fails to unpack bundle archives.

rdar://107367895

Modifications:

We should pass an instance of an archiver to the installation function to unpack destination bundle archives if needed. Since withTemporaryDirectory is async, SwiftDestinationTool had to be converted to AsyncParsableCommand and also gain @main attribute for that to work. Additionally, @main attribute requires -parse-as-library passed in CMake.

`swift experimental-destination install` subcommand works with bundle directories, but fails to unpack bundle archives.

We should pass an instance of an archiver to the installation function to unpack destination bundle archives if needed. Since `withTemporaryDirectory` is `async`, `SwiftDestinationTool` had to be converted to `AsyncParsableCommand` and also gain `@main` attribute for that to work. Additionally, `@main` attribute requires `-parse-as-library` passed in CMake.
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov MaxDesiatov self-assigned this Mar 31, 2023
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test linux

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov

This comment was marked as duplicate.

1 similar comment
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@@ -12,8 +12,8 @@

import ArgumentParser

struct ConfigureDestination: ParsableCommand {
static let configuration = CommandConfiguration(
public struct ConfigureDestination: ParsableCommand {
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why these became public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is that SwiftDestinationTool referencing this type had to be moved to a different target so that it could gain the @main attribute.

@MaxDesiatov MaxDesiatov merged commit 150ec01 into main Apr 3, 2023
@MaxDesiatov MaxDesiatov deleted the maxd/fix-destination-archives branch April 3, 2023 20:23
@compnerd
Copy link
Member

compnerd commented Apr 4, 2023

Interesting - I suspect it might be this PR, but I'm not sure. I'm seeing a new failure around this time:

cmd.exe /C "cd . && D:\a\swift-build\swift-build\BuildRoot\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -target x86_64-unknown-windows-msvc -j 2 -num-threads 2 -emit-library -o bin\CrossCompilationDestinationsTool.dll -module-name CrossCompilationDestinationsTool -module-link-name CrossCompilationDestinationsTool -emit-module -emit-module-path swift\CrossCompilationDestinationsTool.swiftmodule -emit-dependencies -DCrossCompilationDestinationsTool_EXPORTS -sdk D:\a\swift-build\swift-build/BuildRoot/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk -O -swift-version 5 -libc MD -Xcc -D_CRT_SECURE_NO_WARNINGS -output-file-map Sources\CrossCompilationDestinationsTool\CMakeFiles\CrossCompilationDestinationsTool.dir\Release\output-file-map.json -I D:\a\swift-build\swift-build\BinaryCache\swift-package-manager\swift -I D:\a\swift-build\swift-build\BinaryCache\swift-argument-parser\swift -I D:\a\swift-build\swift-build\BinaryCache\swift-collections\swift -I D:\a\swift-build\swift-build\BinaryCache\swift-system\swift -I D:\a\swift-build\swift-build\SourceCache\swift-system\Sources\CSystem\include -I D:\a\swift-build\swift-build\BinaryCache\swift-tools-support-core\swift -I D:\a\swift-build\swift-build\BinaryCache\swift-llbuild\products\llbuildSwift -I D:\a\swift-build\swift-build\SourceCache\swift-llbuild\products\libllbuild\include -I D:\a\swift-build\swift-build\BinaryCache\swift-crypto\swift -I D:\a\swift-build\swift-build\SourceCache\swift-crypto\Sources\CCryptoBoringSSL\include -I D:\a\swift-build\swift-build\BinaryCache\swift-certificates\swift -I D:\a\swift-build\swift-build\BinaryCache\swift-asn1\swift @CMakeFiles\CrossCompilationDestinationsTool.rsp    -Xlinker -implib:lib\CrossCompilationDestinationsTool.lib  && cd ."
<unknown>:0: error: symbol '$s32CrossCompilationDestinationsTool18InstallDestinationV14ArgumentParser20AsyncParsableCommandAadEP3runyyYaKFTWTu' (async function pointer to protocol witness for ArgumentParser.AsyncParsableCommand.run() async throws -> () in conformance CrossCompilationDestinationsTool.InstallDestination : ArgumentParser.AsyncParsableCommand in CrossCompilationDestinationsTool) is in generated IR file, but not in TBD file

<unknown>:0: error: please submit a bug report (https://swift.org/contributing/#reporting-bugs), and add '-Xfrontend -validate-tbd-against-ir=none' to squash the errors

<unknown>:0: error: symbol '$s32CrossCompilationDestinationsTool04ListC0V14ArgumentParser20AsyncParsableCommandAadEP3runyyYaKFTWTu' (async function pointer to protocol witness for ArgumentParser.AsyncParsableCommand.run() async throws -> () in conformance CrossCompilationDestinationsTool.ListDestinations : ArgumentParser.AsyncParsableCommand in CrossCompilationDestinationsTool) is in generated IR file, but not in TBD file

<unknown>:0: error: please submit a bug report (https://swift.org/contributing/#reporting-bugs), and add '-Xfrontend -validate-tbd-against-ir=none' to squash the errors

MaxDesiatov added a commit that referenced this pull request Apr 4, 2023
This fixes an issue with the Windows build highlighted in #6361 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants