Bug 454192 - pcm abi problems when using libasound from a shared library
pcm abi problems when using libasound from a shared library
Product: Fedora
Classification: Fedora
Component: alsa-lib (Show other bugs)
All Linux
high Severity high
: ---
: ---
Assigned To: Martin Stransky
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-07-06 06:59 EDT by Thomas Moschny
Modified: 2008-07-15 05:33 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-07-15 05:33:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
testcase (848 bytes, application/x-gzip)
2008-07-06 06:59 EDT, Thomas Moschny
no flags Details
testcase (fixed) (861 bytes, application/x-gzip)
2008-07-06 07:24 EDT, Thomas Moschny
no flags Details

  None (edit)
Description Thomas Moschny 2008-07-06 06:59:33 EDT
Description of problem:
When called from a shared lib instead of a binary, some functions of libasound
behave differently. To be precise, it seems the shared lib sees the old PCM abi
instead of the new one. Attached is a stripped-down testcase that demonstrates
the problem, for the snd_pcm_hw_params_get_channels_{min|max} functions. In the
old abi, they simply returned their result, whereas in the new abi they store it
in the location specified by the second arg.

Version-Release number of selected component (if applicable):

Steps to Reproduce:
1. tar xvzf alsa-test.tar.gz
2. cd alsa-test
3. make
Two executables are made and run: test1 is using libasound directly amd shows
the correct and expected behavior, whereas test2 uses libasound via a shared
library and demonstrates the (imho) incorrect behavior.
Comment 1 Thomas Moschny 2008-07-06 06:59:33 EDT
Created attachment 311092 [details]
Comment 2 Thomas Moschny 2008-07-06 07:24:28 EDT
Created attachment 311095 [details]
testcase (fixed)

-fPIC was missing
Comment 3 Nicolas Chauvet (kwizart) 2008-07-09 04:41:47 EDT
I have an error while trying to open the attached archive. (861bytes seems low)
Comment 4 Thomas Moschny 2008-07-09 05:20:56 EDT
For some strange reason bugzilla gzipped it once more, the file is a .tar.gz.gz.

So, download it, gunzip, and then tar xvzf. File size is correct, it's a small
testcase only :)
Comment 5 Jaroslav Kysela 2008-07-15 05:33:26 EDT
It's your fault. Add -lasound to the link command (otherwise symbol versions are
not set appropriately):

$(CC) -shared -Wl,-soname,$@ -lasound -o $@ $^

You can verify, if symbol has correct version using:

nm libatest.so | grep snd_pcm
nm test1 | grep snd_pcm

Note You need to log in before you can comment on or make changes to this bug.