Skip to content

warning: Could not read SDKSettings.json for SDK #110

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

Closed
toffaletti opened this issue Jun 16, 2024 · 4 comments
Closed

warning: Could not read SDKSettings.json for SDK #110

toffaletti opened this issue Jun 16, 2024 · 4 comments

Comments

@toffaletti
Copy link

custom SDKs generated with swift-sdk-generator cause swift build to repeatedly output this warning:

warning: Could not read SDKSettings.json for SDK

This can be seen in logs from other issues:
#12
#27

@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Jun 16, 2024

Please let me know if these warnings cause any issues for you, otherwise they're harmless and can be ignored.

@toffaletti
Copy link
Author

No issue other than making it harder to read the useful content in the build log output without filtering all these lines. Is there a simple work around like dropping an empty SDKSettings.json file somewhere?

@xtremekforever
Copy link
Contributor

@MaxDesiatov @toffaletti I did a little research today about this issue and found that this SDKSettings.json file is used by the SwiftCrossCompilers project. Check out the reference file here: https://github.com/CSCIX65G/SwiftCrossCompilers/blob/master/SDKSettings.json

I tried a very minimal file to see what would work to just silence the warning. Including the following content in SDKSettings.json in the SDK directory (the ubuntu-jammy.sdk directory, for example) works:

{
  "SupportedTargets": {},
  "Version": "0.0.1",
  "CanonicalName": "linux"
}

Is it worth including this file by default in the generated SDKs to silence this warning and make the output cleaner? It seems like this is a feature of swiftpm now and unless it's removed, it's going to search for the file whenever cross-compiling is happening.

In my SDK I'm adding this empty file to make the compilation output cleaner. It doesn't hurt anything although it's annoying that it has to be there just to make the warning go away.

@kateinoigakukun
Copy link
Member

The warning is now suppressed in the main branch toolchain swiftlang/swift-driver#1619

MaxDesiatov pushed a commit that referenced this issue Feb 26, 2025
I know that the warnings about the `SDKSettings.json` file were fixed in Swift 6.1 and later and that issue #110 was closed. However, we are still generating Swift SDKs for 5.9, 5.10, and 6.0 which all give the warnings. 

So, my suggestion is to generate this `SDKSettings.json` file for versions older than 6.1, similar to how the the Linux Static Swift SDKs do it. Here is the file that comes in the `swift-6.0.3-RELEASE_static-linux-0.0.1` Swift SDK for example:

```json
{
  "DisplayName": "Swift SDK for Statically Linked Linux (x86_64)",
  "Version": "0.0.1",
  "VersionMap": {},
  "CanonicalName": "x86_64-swift-linux-musl"
}
```

Taking inspiration from this, I am generating a similar file for Swift SDKs created by the generator:

```json
{
  "CanonicalName" : "x86_64-swift-linux-gnu",
  "DisplayName" : "Swift SDK for Ubuntu Jammy (x86_64)",
  "Version" : "0.0.1",
  "VersionMap" : {

  }
}
```

The ordering is not the same due to how `JSONEncoder()` sorts things, and the formatting is a little different too due to `.prettyPrinted`, but it works just the same. And, the "warning: Could not read SDKSettings.json for SDK at: <path>" warning is successfully suppressed.

This really is a minor change that is more "quality-of-life" then adding any functionality. But, not having those warnings printed when using the generated Swift SDKs are used is a nice to have.
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