Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 454192 - pcm abi problems when using libasound from a shared library
Summary: pcm abi problems when using libasound from a shared library
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: alsa-lib
Version: 9
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Martin Stransky
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
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:
Environment:
Last Closed: 2008-07-15 09:33:26 UTC


Attachments (Terms of Use)
testcase (deleted)
2008-07-06 10:59 UTC, Thomas Moschny
no flags Details
testcase (fixed) (deleted)
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):
alsa-lib-1.0.16-3.fc9.i386

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]
testcase

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.
thus.

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.