Skip to contentSkip to conversation

Detecting runtime ALSA library version

DISCUSSION Glenn Maynard 3 participants 5 messages Apr 6, 2004

lore
Share & tools
lore
#0 lore raw

I can't find any way to detect the running ALSA version, for diagnostic purposes. It can't be derived from the library name, which doesn't seem to change (it's always "libasound.so.2.0.0" here, which has no relation to the actual version).

It's frustrating to receive bug reports like

https://sourceforge.net/tracker/?func=detail&atid=421366&aid=930335&group_id=37892
https://sourceforge.net/tracker/download.php?group_id=37892&atid=421366&file_id=82701&aid=930335

and not being able to tell what version of alsa-lib is in use.

I'd recommend an entry point eg. "const char *snd_lib_version()" to get this information.

As an aside: is it safe to assume that if /proc/asound/ doesn't exist, ALSA is not in use? It'd be useful to short circuit ALSA initialization for OSS people, since they often have old, broken versions of alsa-lib installed.

(I know that the converse isn't true--it's possible to load the basic "snd" module, not load anything else, and then load OSS modules, resulting in a working OSS environment but /proc/asound/ existing.)

Signature · 8 lines
Glenn Maynard


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#1 lore raw
Quoted 1 line

I can't find any way to detect the running ALSA version, for diagnostic

cat /proc/asound/version

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#2 lore raw
Quoted 3 lines · Paul Davis
Quoted 1 line

I can't find any way to detect the running ALSA version, for diagnostic

cat /proc/asound/version

That's the driver version, which I'm already logging. Like I said, I want the alsa-lib version that's being linked in, which very often has no relation to the alsa-driver version.

Signature · 8 lines
Glenn Maynard


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#3 lore raw
Quoted 11 lines · Glenn Maynard
Quoted 3 lines · Paul Davis
Quoted 1 line

I can't find any way to detect the running ALSA version, for diagnostic

cat /proc/asound/version

That's the driver version, which I'm already logging. Like I said, I want the alsa-lib version that's being linked in, which very often has no relation to the alsa-driver version.

cat /usr/include/alsa/version.h tells you the currently installed version.

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#4 lore raw
Quoted 1 line · James Courtier-Dutton

cat /usr/include/alsa/version.h tells you the currently installed version.

Nope. That only works if the development files are installed; on user systems, they usually aren't. I can't simply #include it; that'll tell me what version of ALSA was installed by the person that built the binary (which is usually not the same person), and won't follow dynamic library upgrades.

Also, even if ALSA development files are installed, there's always a chance there's a mismatch; for example, there may be one version of ALSA in /usr/lib and another in /usr/local/lib.

I want to know what real version of libasound.so the application is linked against, without having to worry about user error or unusual configurations resulting in incorrect output.

This is why many libraries export a function to return the version in
use: png_access_version_number, png_get_libpng_ver, zlibVersion(), SDL_Linked_Version(), confstr(_CS_GNU_LIBC_VERSION), and so on.

Signature · 8 lines
Glenn Maynard


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click