Trying to use "soundio", but has problems compiling ("undefined reference to 'x' ")


Im trying to use the crate "sondio" to use a mic in a raspberry programming in rust.

The problem that i have is when compiling the code(with "cargo b"), and the problem i think its because the libs are static but i cant find a solution.

this its the last part of the error, there is a lot of "undefined reference to 'something' "

PD: I have installed the libsoundio lib.

Have you also installed the libsoundio-dev package, which is necessary for linking to the library?

1 Like

the sudo apt-get install libsoundio-dev dont work, and dont know how continue

What happens when you try to sudo apt-get install libsoundio-dev? In what way does it not work?

"E: Unable to locate package libsoundio-dev"

Are you cross-compiling? If so, then apt may be installing for wrong OS.

If only a few symbols are missing, it's possible that you have an old version of libsoundio and you need a new one.

If you're generating bindgened bindings yourself, you also need to specify linker directives for cargo.

The missing symbols seem like they're part of alsa as libasound, not libsoundio. libsoundio looks to be getting bundled anyway.

Not sure offhand how to fix it since I don't have a lot of experience with sys packages in rust. The problem is libsoundio-sys probably isn't pulling in -lasound, but I don't know if that is a pkg-config problem or what without looking closer.

nono, im compiling directly on raspberry. I comunicate with the rasp for ssh. I saw on a forum a way for install the library using the cmake, but its doesn't work anyway.

i clone the "soundio-rs" from github and try to execute the examples and didnt work either.

(post deleted by author)

I continue with this projects this week and, the main error is this. I Was looking for on internet, but it didnt solve, with gcc... and everything i could see on forums. Have You know how to solve this?

PD: im on a raspberry

You'll need to find some way to install the development files for the library. If you are running the latest version of Raspian on the armhf architecture, the libsoundio-dev package should be in the main Raspian repository; you can find the file here.

If the package isn't in your distro for some reason, you might need to install libsoundio from source.

Ah, according to this issue, the package failed to build for the current stable version of Raspian (“buster”), and is only available in the latest testing version (“bullseye”): Packages libsoundio1, libsoundio-dev are missing from Raspian Buster · Issue #215 · RPi-Distro/repo · GitHub

1 Like