Closed zavodil closed 3 weeks ago
@zavodil Can you provide a minimum reproducible example, please?
Hi! I faced similar issue while trying to test near-sdk-rs examples, but interesting enough when I tried to replicate this issue in ordinary smart contract everything was ok.
Here is the way to get error: linking with 'cc' failed: exit status: 1
Go to near-sdk-rs/examples/test-contract/src/lib.rs
Add this to the code:
use near_sdk::PanicOnDefault;
#[derive(PanicOnDefault)]
pub struct JustStruct {}
and create a test in test module:
#[cfg(not(target_arch = "wasm32"))]
#[cfg(test)]
mod tests {
use super::*;
#[test]
#[should_panic]
fn test_panic() {
JustStruct::default();
}
}
Then cargo test
@zavodil @StarGachinum I have finally identified the problem. You have to enable unit-testing
feature for near-sdk in your dev-dependencies
:
I will keep this issue open to invite contributors to add this section to all the examples in this repo and make sure we run all the tests as it seems that currently we don't run those tests in some examples. At least, the following examples are affected and running cargo test
fails there:
hi @frol i would love to take up this issue
Hi @g4titanx! Maintainers during the ODHack #6.0 will be tracking applications via OnlyDust. Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.
I am applying to this issue via OnlyDust platform.
I have contributed to rust projects like rust_codegen_gcc, reth, etc and have relevant experience to tackle this
As problem is found by @frol, I would enable unit-testing feature in examples to run tests successfully
I am applying to this issue via OnlyDust platform.
Hi team, I'm a software engineer who knows Rust well and has helped with many Rust open source projects(ibc-rs, reth, foundry-rs). I've been watching this project and I'm interested in it.
I will do research and also use @frol's clue to fix the issue, to ensure the repository tests run as expected.
Oh wow, there is a lot of interest. I will assign it to @lordshashank as we had a discussion about another issue and I shared this one instead
@lordshashank Are you working on it? If you won't submit a PR today, I will unassign it to let other contributors to take it
I can't run simple tests after upgrading to 5.1.0
throws an error:
error: linking with `cc` failed: exit status: 1
both foraarch64-apple-darwin
andx86_64-apple-darwin
Switching to sdk 4.1.1 resolves the issue.
Full output: