Using the below code in main.rs, when I run cargo test
it returns error code 176, when I add a test or `any statement in main function. It starts returning error code 160.
#![no_std]
#![no_main]
#[cfg(test)]
#[macro_use]
extern crate std;
#[cfg(not(test))]
extern crate panic_halt;
#[no_mangle]
pub unsafe extern "C" fn main() {
}
From this link I found out, that
Exit code 176 means "Unable to install on a network drive. Select another install location in your preferences and retry installing."
When I tried to find back trace through lldb it returned
error: invalid thread
I couldn't find any thread which mentions similar error, so asking it here. Any help is appreciated.
Using nightly (nightly-x86_64-apple-darwin) Thanks.
The problem is your
main
function, which has an invalid signature for unix platforms. It must return ani32
(or betterc_int
, but for simplicity we suppose they are idential). The176
is just some random value in therax
register when leaving themain
function.So change your
main
signature to:and return a return code (e.g.
0
which means success)or
and use the
exit
syscall on linux (or an infinite loop on embedded systems).