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

Support for building plugin dependencies for the host #6060

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

neonichu
Copy link
Contributor

Hacky support for building plugin dependencies for the host. This is achieved by creating a second build operation with altered build parameters and individually building dependencies using that build operation, somewhat similar to how command plugins operate.

@neonichu neonichu self-assigned this Jan 19, 2023
Hacky support for building plugin dependencies for the host. This is achieved by creating a second build operation with altered build parameters and individually building dependencies using that build operation, somewhat similar to how command plugins operate.
@neonichu neonichu force-pushed the build-plugins-for-host branch from b3549b3 to e6195a3 Compare February 1, 2023 21:49
@neonichu neonichu changed the title WIP: Support for building plugin dependencies for the host Support for building plugin dependencies for the host Feb 8, 2023
@neonichu neonichu marked this pull request as ready for review February 8, 2023 01:43
@neonichu
Copy link
Contributor Author

neonichu commented Feb 8, 2023

@swift-ci please smoke test

@neonichu
Copy link
Contributor Author

neonichu commented Feb 8, 2023

seems like macOS is failing for infra reasons, cc @shahmishal -- maybe this is the error?

+ /usr/local/bin/sccache --stop-server
Stopping sccache server...
error: couldn't connect to server
caused by: Connection refused (os error 61)

@neonichu
Copy link
Contributor Author

neonichu commented Feb 8, 2023

@swift-ci please smoke test macOS

@neonichu neonichu merged commit 7f86b2c into main Feb 8, 2023
@neonichu neonichu deleted the build-plugins-for-host branch February 8, 2023 16:31
euanh added a commit to euanh/swift-package-manager that referenced this pull request Aug 9, 2023
When cross-compiling, SwiftPM plugins and their dependencies run on the
host and so must be compiled for the host OS and architecture, not the
cross-compiled target OS and architecture.   SwiftPM will correctly compile
a command plugin for the host but if the plugin depends on an executable
SwiftPM will cross-compile the executable for the target, so the plugin will
not be able to run it:

   error: Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error"

Command plugin dependencies are already handled specially in PluginCommand.run;
this commit makes that special build step use the host toolchain instead of the
target toolchain.

swiftlang#6060 handled the
equivalent problem for build tool plugins.
euanh added a commit to euanh/swift-package-manager that referenced this pull request Aug 9, 2023
When cross-compiling, SwiftPM plugins and their dependencies run
on the host and so must be compiled for the host OS and architecture,
not the cross-compiled target OS and architecture.   SwiftPM will
compile a command plugin for the host but if the plugin depends on
an executable it will cross-compile the executable for the target,
so the plugin will not be able to run it:

    error: Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error"

Command plugin dependencies are already handled specially in
PluginCommand.run; this commit makes that special build step use
the host toolchain instead of the target toolchain.

swiftlang#6060 handled the
equivalent problem for build tool plugins.
euanh added a commit to euanh/swift-package-manager that referenced this pull request Aug 10, 2023
When cross-compiling, SwiftPM plugins and their dependencies run
on the host and so must be compiled for the host OS and architecture,
not the cross-compiled target OS and architecture.   SwiftPM will
compile a command plugin for the host but if the plugin depends on
an executable it will cross-compile the executable for the target,
so the plugin will not be able to run it:

    error: Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error"

Command plugin dependencies are already handled specially in
PluginCommand.run; this commit makes that special build step use
the host toolchain instead of the target toolchain.

swiftlang#6060 handled the
equivalent problem for build tool plugins.
euanh added a commit that referenced this pull request Aug 10, 2023
…et (#6791)

When cross-compiling, SwiftPM plugins and their dependencies run
on the host and so must be compiled for the host OS and architecture,
not the cross-compiled target OS and architecture.   SwiftPM will
compile a command plugin for the host but if the plugin depends on
an executable it will cross-compile the executable for the target,
so the plugin will not be able to run it:

    error: Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error"

Command plugin dependencies are already handled specially in
PluginCommand.run; this commit makes that special build step use
the host toolchain instead of the target toolchain.

#6060 handled the
equivalent problem for build tool plugins.
MaxDesiatov pushed a commit that referenced this pull request Aug 11, 2023
When cross-compiling, SwiftPM plugins and their dependencies run on the host and so must be compiled for the host OS and architecture, not the cross-compiled target OS and architecture. SwiftPM will compile a command plugin for the host but if the plugin depends on an executable it will cross-compile the executable for the target, so the plugin will not be able to run it:

    error: Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error"

Command plugin dependencies are already handled specially in PluginCommand.run; this commit makes that special build step use the host toolchain instead of the target toolchain.

#6060 handled the equivalent problem for build tool plugins.

(cherry picked from commit 1daaa1c)

# Conflicts:
#	Sources/CoreCommands/SwiftTool.swift
MaxDesiatov added a commit that referenced this pull request Aug 14, 2023
…6799)

When cross-compiling, SwiftPM plugins and their dependencies run on the host and so must be compiled for the host OS and architecture, not the cross-compiled target OS and architecture. SwiftPM will compile a command plugin for the host but if the plugin depends on an executable it will cross-compile the executable for the target, so the plugin will not be able to run it:

    error: Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error"

Command plugin dependencies are already handled specially in PluginCommand.run; this commit makes that special build step use the host toolchain instead of the target toolchain.

#6060 handled the equivalent problem for build tool plugins.

(cherry picked from commit 1daaa1c)

```
# Conflicts:
#	Sources/CoreCommands/SwiftTool.swift
```

Co-authored-by: Euan Harris <euan_harris@apple.com>
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