Skip to content

sdk!: Remove program feature#249

Merged
joncinque merged 2 commits intoanza-xyz:masterfrom
joncinque:rm-program-feature
Jul 28, 2025
Merged

sdk!: Remove program feature#249
joncinque merged 2 commits intoanza-xyz:masterfrom
joncinque:rm-program-feature

Conversation

@joncinque
Copy link
Copy Markdown
Collaborator

Problem

The program feature has existed since v1.3 so that people can use solana-sdk in on-chain programs.

cargo-build-sbf even had a special case where it would enable the program feature when building solana-sdk, but it was removed in anza-xyz/agave#5870.

This means that our current build-sbf script fails when using v2.3 of the tools.

Summary of changes

Remove the program feature from the sdk, and fix the build-sbf script to exclude the sdk, and then try to build without default features.

Rather than adding more excludes, I also changes the build-sbf script to use cargo hack, which is a bit cleaner.

#### Problem

The `program` feature has existed since v1.3 so that people can use
solana-sdk in on-chain programs.

`cargo-build-sbf` even had a special case where it would enable the
`program` feature when building solana-sdk, but it was removed in
anza-xyz/agave#5870.

This means that our current build-sbf script fails when using v2.3 of
the tools.

#### Summary of changes

Remove the `program` feature from the sdk, and fix the build-sbf script
to exclude the sdk, and then try to build without default features.

Rather than adding more excludes, I also changes the build-sbf script to
use `cargo hack`, which is a bit cleaner.
@joncinque joncinque requested a review from LucasSte July 25, 2025 10:08
@joncinque joncinque added the breaking PR contains breaking changes label Jul 25, 2025
@joncinque
Copy link
Copy Markdown
Collaborator Author

Well, this actually shows that it's dangerous to remove the program feature, since older versions of cargo build-sbf will expect to enable it, and fail. This means we'll either need to update the solana-cli version to v2.3 with this PR, or keep the program feature.

What do you think is a better approach?

@LucasSte
Copy link
Copy Markdown
Contributor

Well, this actually shows that it's dangerous to remove the program feature, since older versions of cargo build-sbf will expect to enable it, and fail. This means we'll either need to update the solana-cli version to v2.3 with this PR, or keep the program feature.

What do you think is a better approach?

Newer versions of cargo-build-sbf will ignore the flag. What about removing solana-sdk from the tests by now (i.e insert it in the exclude list) and keeping the feature flag until we update the CLI version?

Perhaps, it would be worth it to add a comment explaining that the flag is deprecated.

@joncinque
Copy link
Copy Markdown
Collaborator Author

What about removing solana-sdk from the tests by now (i.e insert it in the exclude list) and keeping the feature flag until we update the CLI version?

That probably makes more sense, since we're essentially saying "don't use solana-sdk on-chain" by removing the "program" feature. Done!

@joncinque joncinque merged commit 68eea41 into anza-xyz:master Jul 28, 2025
25 checks passed
@joncinque joncinque deleted the rm-program-feature branch July 28, 2025 15:56
febo pushed a commit to febo/solana-sdk that referenced this pull request Sep 21, 2025
* sdk!: Remove `program` feature

#### Problem

The `program` feature has existed since v1.3 so that people can use
solana-sdk in on-chain programs.

`cargo-build-sbf` even had a special case where it would enable the
`program` feature when building solana-sdk, but it was removed in
anza-xyz/agave#5870.

This means that our current build-sbf script fails when using v2.3 of
the tools.

#### Summary of changes

Remove the `program` feature from the sdk, and fix the build-sbf script
to exclude the sdk, and then try to build without default features.

Rather than adding more excludes, I also changes the build-sbf script to
use `cargo hack`, which is a bit cleaner.

* Exclude solana-sdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking PR contains breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants