segmentation-fault

configure: error: cannot run C compiled programs

淺唱寂寞╮ 提交于 2020-08-22 10:52:48
问题 I'm trying to install different software onto my Raspberry Pi with Debian Wheezy OS. When I run try to configure software I'm trying to install I get this output checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in 'directory of where I'm installing the software' configure: error: cannot run C compiled programs. If you meant to cross compile, use '--host'. See config.log' for more

Segmentation fault when using C callback user data to store a boxed Rust closure

ぃ、小莉子 提交于 2020-08-05 09:59:05
问题 I am creating a Rust wrapper around a C API. One function in this C API sets a callback and accepts a void pointer which will be passed to the callback. It stores a reference to the callback and user data for later, so I am using the last code section from this answer. Here is my code. The Test::trigger_callback(...) function is meant to emulate the C library calling the callback. extern crate libc; use libc::c_void; use std::mem::transmute; struct Test { callback: extern "C" fn(data: i32,

How does Rust guarantee memory safety and prevent segfaults?

我怕爱的太早我们不能终老 提交于 2020-08-01 06:11:42
问题 I was looking for a language to learn, and I saw that Rust is getting quite popular. Two things impressed me about Rust, memory safety and preventing segfaults. How does Rust achieve this? What differences between Rust and Java for example enable Rust's safety features? 回答1: How Rust achieves memory safety is, at its core, actually quite simple. It hinges mainly on two principles: ownership and borrowing. Ownership The compiler uses an affine type system to track the ownership of each value: