Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 454192 - pcm abi problems when using libasound from a shared library
Summary: pcm abi problems when using libasound from a shared library
Alias: None
Product: Fedora
Classification: Fedora
Component: alsa-lib
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Martin Stransky
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2008-07-06 10:59 UTC by Thomas Moschny
Modified: 2008-07-15 09:33 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-07-15 09:33:26 UTC
Type: ---

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

Description Thomas Moschny 2008-07-06 10:59:33 UTC
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 10:59:33 UTC
Created attachment 311092 [details]

Comment 2 Thomas Moschny 2008-07-06 11:24:28 UTC
Created attachment 311095 [details]
testcase (fixed)

-fPIC was missing

Comment 3 Nicolas Chauvet (kwizart) 2008-07-09 08:41:47 UTC
I have an error while trying to open the attached archive. (861bytes seems low)

Comment 4 Thomas Moschny 2008-07-09 09:20:56 UTC
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 09:33:26 UTC
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.