-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Update SE-0387: Cross-Compilation Destination Bundles #1942
Changes from 1 commit
28ecd8f
e96b917
9b56079
1f25bc0
0b52595
3d2a1c2
a9a77c1
f1851cf
be0b74b
cf2deb6
5f39655
e8cd545
5d8bec2
d1f98e7
c7f5c7c
58b2c5a
515aac3
6ce9bc1
139e51f
775b427
db299df
2d34fda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
swiftStaticResourcesPath field to destination.json
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,18 +294,22 @@ informally defined schema for these files: | |
| "runTimeTriples": [ | ||
| "<triple1>": { | ||
| "sdkRootPath": "<a required path relative to `destination.json` containing SDK root>", | ||
| "swiftResourcesPath": "<an optional path relative to `destination.json` containing Swift resources>", | ||
| "includeSearchPaths": ["<optional array of paths relative to `destination.json` containing headers>"], | ||
| "librarySearchPaths": ["<optional array of paths relative to `destination.json` containing libraries>"], | ||
| "toolsetPaths": ["<optional array of paths relative to `destination.json` containing toolset files>"] | ||
| // all of the properties listed below are optional: | ||
| "swiftResourcesPath": "<a path relative to `destination.json` containing Swift resources for dynamic linking>", | ||
| "swiftStaticResourcesPath": "<a path relative to `destination.json` containing Swift resources for static linking>", | ||
| "includeSearchPaths": ["<array of paths relative to `destination.json` containing headers>"], | ||
| "librarySearchPaths": ["<array of paths relative to `destination.json` containing libraries>"], | ||
| "toolsetPaths": ["<array of paths relative to `destination.json` containing toolset files>"] | ||
| }, | ||
| // a destination can support more than one run-time triple: | ||
| "<triple2>": { | ||
| "sdkRootPath": "<a required path relative to `destination.json` containing SDK root>", | ||
| "swiftResourcesPath": "<an optional path relative to `destination.json` containing Swift resources>", | ||
| "includeSearchPaths": ["<optional array with relative paths containing headers in the destination tree>"], | ||
| "librarySearchPaths": ["<optional array with relative paths containing libraries in the destination tree>"], | ||
| "toolsetPaths": ["<optional array of paths relative to `destination.json` containing toolset files>"] | ||
| // all of the properties listed below are optional: | ||
| "swiftResourcesPath": "<a path relative to `destination.json` containing Swift resources for dynamic linking>", | ||
| "swiftStaticResourcesPath": "<a path relative to `destination.json` containing Swift resources for static linking>", | ||
| "includeSearchPaths": ["<array of paths relative to `destination.json` containing headers>"], | ||
| "librarySearchPaths": ["<array of paths relative to `destination.json` containing libraries>"], | ||
| "toolsetPaths": ["<array of paths relative to `destination.json` containing toolset files>"] | ||
| } | ||
| // more triples can be supported by a single destination if needed, primarily for sharing files between them. | ||
| ] | ||
|
|
@@ -318,9 +322,10 @@ bundles. That is, `../` components, if present in paths, will not be allowed to | |
| directories outside of a corresponding destination bundle. Symlinks will also be validated to prevent them from escaping | ||
| out of the bundle. | ||
|
|
||
| If `sdkRootPath` is specified and `swiftResourcesPath` is not, the latter is inferred to be | ||
| `"\(sdkRootPath)/usr/lib/swift"`. Similarly `includeSearchPaths` is inferred as `["\(sdkRootPath)/usr/include"]`, | ||
| `librarySearchPaths` as `["\(sdkRootPath)/usr/lib"]`. | ||
| If `sdkRootPath` is specified and `swiftResourcesPath` is not, the latter is inferred to be | ||
| `"\(sdkRootPath)/usr/lib/swift"` when linking the Swift standard library dynamically, `"swiftStaticResourcesPath"` is | ||
| inferred to be `"\(sdkRootPath)/usr/lib/swift_static"` when linking it dynamically. Similarly, `includeSearchPaths` is | ||
| inferred as `["\(sdkRootPath)/usr/include"]`, `librarySearchPaths` as `["\(sdkRootPath)/usr/lib"]`. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this changing the current behavior, ie these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We won't populate them in SwiftPM explicitly with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, it doesn't on linux, see the output from swiftlang/swift#63416. The reason is that the SDK is the C sysroot and these are Swift include/lib flags, so the compiler only looks in the Swift resource directory, not the normal non-Swift SDK locations you list here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think if you update this doc to mention that nothing is done by default, should be okay. |
||
|
|
||
| Here's `destination.json` file for the `ubuntu_jammy` artifact previously introduced as an example: | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second time: dynamically -> statically. Also, won't these be used just to build static libraries too, so maybe it should be made more general to
when linking libraries dynamicallyin the first instance?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's addressed now.
I'm not aware of that. Can you point to specific place in the source code or documentation that supports this statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just built SwiftSyntax, which has several static libraries, on linux to check, and it appears to build the object files in a SPM target by looking in the dynamic resource directory for the stdlib interface files, then simply use
arto package them together. I don't know if that's a mistake, as the static resource directory has its own interface files, but what you wrote about the static stdlib initially is correct.