Anchor #[program]
macro appears to ignore cargo feature flags
#2257
Labels
#[program]
macro appears to ignore cargo feature flags
#2257
I expect to be able to use Cargo feature flags when developing a rust application. They are useful when following continuous integration allowing partially developed features to be integrated within a team to improve a teams workflow.
Take the following example:
With a configured
my-feature
feature flag in./programs/cfg_issue/Cargo.toml
Expected Behaviour
The program should compile as if the
only_my_feature
function was not in the source code.Actual Behaviour
The following will fail:
Whilst including the feature makes the macro succeed as expected:
$ anchor build -- --features my-feature BPF SDK: /home/vscode/.local/share/solana/install/releases/1.10.39/solana-release/bin/sdk/bpf Features: my-feature cargo-build-bpf child: rustup toolchain list -v cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release --features my-feature Compiling cfg-issue v0.1.0 (/workspaces/test-bug-anchor/cfg-issue/programs/cfg-issue) Finished release [optimized] target(s) in 0.64s cargo-build-bpf child: /home/vscode/.local/share/solana/install/releases/1.10.39/solana-release/bin/sdk/bpf/scripts/strip.sh /workspaces/test-bug-anchor/cfg-issue/target/bpfel-unknown-unknown/release/cfg_issue.so /workspaces/test-bug-anchor/cfg-issue/target/deploy/cfg_issue.so cargo-build-bpf child: /home/vscode/.local/share/solana/install/releases/1.10.39/solana-release/bin/sdk/bpf/dependencies/bpf-tools/llvm/bin/llvm-readelf --dyn-symbols /workspaces/test-bug-anchor/cfg-issue/target/deploy/cfg_issue.so To deploy this program: $ solana program deploy /workspaces/test-bug-anchor/cfg-issue/target/deploy/cfg_issue.so The program address will default to this keypair (override with --program-id): /workspaces/test-bug-anchor/cfg-issue/target/deploy/cfg_issue-keypair.json
The text was updated successfully, but these errors were encountered: