0

I'm trying to start a program using solana-program-test, but I'm having trouble getting the examples in SPL to run.

If I use the examples/rust/transfer-lamports program, extract it into its own project, and try using "cargo test-sbf" I get many errors about lifetimes in the termcolor crate. Here is the first:

error[E0106]: missing lifetime specifier
   --> /home/fzzyyti/.cargo/registry/src/index.crates.io-6f17d22bba15001f/termcolor-1.4.1/src/lib.rs:464:30
    |
464 |     StdoutLock(io::StdoutLock<a>),
    |                              ^ expected named lifetime parameter
    |
help: consider introducing a named lifetime parameter
    |
463 ~ enum IoStandardStreamLock<'a, a> {
464 ~     StdoutLock(io::StdoutLock<'a, a>),
    |

It builds with no errors for "cargo build-sbf".

I'm guessing it is trying to build the solana-sdk in sbf architecture. solana-sdk is in the dev dependencies, so I don't think it is supposed to.

Am I missing something that will allow this to run with "cargo test-sbf"?

I'm using solana --version 1.18.15 SPL repo latest master branch

1 Answer 1

0

It seems like this is a real issue with termcolor for the non-sbf part of the program.

I resolved this by downgrading termcolor with termcolor = "=1.4.0" under [dev-dependencies] in Cargo.toml, which are compiled to my local architecture.

I ran into the same issue in a different rust program not compiling to SBF and fixed it by downgrading termcolor in the [dependencies] section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.