link with c only when target is bpf #195
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Running
Cargo test
compiles the oracle into native (none-bpf) code, which causes a linker error when linking with the bpf C oracle.This PR makes it so that we do not link on cargo test. I believe this is reasonable because unit tests should not involve FFI calls. It makes more sense to unit test each component in the language it is written in. If we think we want the linking to happen, then we would need to understand how to compile the c oracle into a native architecture as well, and link to that when we run cargo test. That seems like unnecessary work to me (specially with the issues around solana and libc compatibility), but happy to do it if we believe it's useful.