-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alsa Lib segfaults when built statically #349
Comments
Follow INSTALL (https://github.com/alsa-project/alsa-lib/blob/master/INSTALL):
|
A little bit further analysis: The But... The crash is in
Use |
The executable is still segfaulting. i ran the updated commands:
i use the i moved them to a new include and lib folder, and made sure the .pc points to them:
It compiles/links successfully in rust (x86_64-unknown-linux-gnu) both using: Is there anything that i am doing wrong? My player tester was not able to provide me with a core dump. and as of now virtualbox.org is down, i would try but i am also not a skilled linux user. Can you try it out directly at https://cybergate.app so that we can track the issue quicker? |
Provide a straight small binary which shows the issue. Also, you may compile your code with debugging symbols and use gdb debugger to get the full back trace ( |
This should be a MVP to repro the issue. use std::{io::BufReader, thread::sleep, time::Duration};
fn main() {
println!("starting");
std::panic::set_hook(Box::new(|panic_info| {
use std::io::Write;
let mut file = std::fs::File::create("./error").unwrap();
file.write_all(panic_info.to_string().as_bytes()).unwrap();
println!("{}", panic_info.to_string());
}));
println!("starting2");
let (_stream, stream_handle) = rodio::OutputStream::try_default().unwrap();
println!("OutputStream");
let file = std::fs::File::open("./sound.wav").unwrap();
let sink = stream_handle.play_once(BufReader::new(file)).unwrap();
println!("played");
sink.set_volume(0.5);
while sink.empty() == false {}
println!("is empty");
sleep(Duration::from_secs_f32(4.0));
println!("exit");
} |
Backtrace:
So it crashes in the standard libc code (getenv). Your program uses system's glibc:
It seems that your statically linked parts are incompatible with distro specific glibc. Try to compile whole executable as static. |
Or you just overwrite memory and those crashes are just a side-effect of a bad code. |
why would this be? And why does it Compile and Links successfuly? I used two different crates, kira and rodio. both segfault. It could be the cpal and the alsa-sys crate (dependencies that they both use), but they work when compiling from linux to linux. (but that doesn't need the manual building alsa-lib). The problem that i am having is when compiling from mac to linux with the static library. Rust code is usually pretty robust with memory, but we can open this issue on the rust alsa-sys |
so, the ubuntu machine that i build the static alsa-lib has version: I build the executable with 2.36 using cargo-zigbuild. rodio_test (matches glibc).zip see if we can get this one to work. could the toolchain be the fault? where is says "Known upstream zig issues"? |
Maybe try a very simple C build to isolate whether alsa is really the issue before doing complex integrated builds. |
since then, i used cargo cross, to successfully compile Alsa on a arm mac to x86 linux. |
I am building a game that uses alsa. All of my linux players segfault. This has been going for over 1 year.
Alsa-lib is built statically on a ubuntu machine with the following commands:
Then i use libasound.a to build my Rust executable (On my mac machine).
I do the same process to build openssl for linux and it works great.
So There definitely is an issue when building alsa lib statically.
One of my players was able to provide me with a core dump that might be helpful to track down the fault:
coredump.txt
The text was updated successfully, but these errors were encountered: