Skip to contentSkip to conversation

libasound and libpthread

DISCUSSION Thomas Roeder 4 participants 7 messages Jul 29, 2002

lore
Share & tools
lore
#0 lore raw

Hi all,

I am working with Alsa 0.9.0beta12 version and I am also using posix threads (libpthread) in my project. In the release version of the program I link both libraries (libpthread, libasound) dynamically and everything works well. In the debug version however, I have to do static linking of the libpthread for proper debugging.

Here is the problem:

If I try to link libasound dynamically and libpthread statically, the program crashes with a segmentation fault before even reaching the first line of my code (maybe, because libasound uses multithreading and libpthread itself ?). If I try to link both statically, the program runs at least some line of code, until it reaches the sound initialization. Then it crashes again with the following messages:

ALSA lib conf.c:2540:(snd_config_hook_load) Unable to find field files in the preload section ALSA lib conf.c:1785:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument ALSA lib conf.c:2127:(snd_config_update) hooks failed, removing configuration

Any help is appreciated.

Thanks in advance

Thomas

-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

#1 lore raw
Quoted 5 lines

I am working with Alsa 0.9.0beta12 version and I am also using posix threads (libpthread) in my project. In the release version of the program I link both libraries (libpthread, libasound) dynamically and everything works well. In the debug version however, I have to do static linking of the libpthread for proper debugging.

why? i use pthreads a great deal, and i have never had to do this.

and no, libasound does not use pthreads or any other form of threads.

--p

-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

#2 lore raw
Quoted 10 lines · Paul Davis
Quoted 6 lines

I am working with Alsa 0.9.0beta12 version and I am also using posix threads (libpthread) in my project. In the release version of the program I link both libraries (libpthread, libasound) dynamically and everything works well. In the debug version however, I have to do static linking of the libpthread for proper debugging.

why? i use pthreads a great deal, and i have never had to do this.

and no, libasound does not use pthreads or any other form of threads.

Thomas, you should know to not rely too strong to Paul's words.

He own a big heart, but unfortunately a big mouth too, that he's often unable to keep under control ;-)

Some portions of libasound *do* use pthreads.

Signature · 11 lines
Abramo Bagnara                       mailto:[email protected]

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
#3 lore raw
Quoted 10 lines · Abramo Bagnara
Quoted 8 lines · Paul Davis
Quoted 6 lines

I am working with Alsa 0.9.0beta12 version and I am also using posix threads (libpthread) in my project. In the release version of the program I link both libraries (libpthread, libasound) dynamically and everything works well. In the debug version however, I have to do static linking of the libpthread for proper debugging.

why? i use pthreads a great deal, and i have never had to do this.

More precisely, I would like to do some breakpoint debugging. The only way I know of doing this with multithreaded programs, is to link libpthread statically (and I tried this with gdb). Anyway, the question to me is, are there in general for some reasons problems to be expected, when linking libasound statically or is it only in connection with multithreading or is it because of some unknown error of mine ?

Quoted 11 lines
Quoted 2 lines

and no, libasound does not use pthreads or any other form of threads.

Thomas, you should know to not rely too strong to Paul's words.

He own a big heart, but unfortunately a big mouth too, that he's often unable to keep under control ;-)

Some portions of libasound *do* use pthreads.

I hope I did'nt raise any kind of fight between the two of you :-) .

Thanks for your comments

Regards Thomas

-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

#4 lore raw
Quoted 3 lines

More precisely, I would like to do some breakpoint debugging. The only way I know of doing this with multithreaded programs, is to link libpthread statically (and I tried this with gdb).

% gdb some-dynamically-linked-code
gdb> br main
gdb> run ...args...
Breakpoint 1: ....
gdb> br some_function_in_a_dynamically_linked_library gdb c

for code loaded by dlopen() and its cousins and wrappers, the breakpoint needs to be something other than main - use something called, or a line reached after the dlopen() call has happened.

--p

-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

#5 lore raw
In reply to Abramo Bagnara
Quoted 8 lines
Quoted 7 lines · Paul Davis
Quoted 6 lines

I am working with Alsa 0.9.0beta12 version and I am also using posix threads (libpthread) in my project. In the release version of the program I link both libraries (libpthread, libasound) dynamically and everything works well. In the debug version however, I have to do static linking of the libpthread for proper debugging.

Quoted 8 lines
Quoted 3 lines

why? i use pthreads a great deal, and i have never had to do this.

and no, libasound does not use pthreads or any other form of threads.

Thomas, you should know to not rely too strong to Paul's words.

He own a big heart, but unfortunately a big mouth too, that he's often unable to keep under control ;-)

its true. mea culpa.

this is what we get for a library containing large chunks of code and functionality not used by anyone except its author :)

is there anyone on the list except abramo or jaroslav that have ever used the "shared" PCM device type?

--p

-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

#6 lore raw
Quoted 18 lines · Paul Davis
Quoted 8 lines
Quoted 6 lines · Paul Davis
Quoted 5 lines

I am working with Alsa 0.9.0beta12 version and I am also using posix threads (libpthread) in my project. In the release version of the program I link both libraries (libpthread, libasound) dynamically and everything works well. In the debug version however, I have to do static linking of the libpthread for proper debugging.

Quoted 8 lines
Quoted 3 lines

why? i use pthreads a great deal, and i have never had to do this.

and no, libasound does not use pthreads or any other form of threads.

Thomas, you should know to not rely too strong to Paul's words.

He own a big heart, but unfortunately a big mouth too, that he's often unable to keep under control ;-)

Quoted 8 lines

its true. mea culpa.

this is what we get for a library containing large chunks of code and functionality not used by anyone except its author :)

is there anyone on the list except abramo or jaroslav that have ever used the "shared" PCM device type?

I have looked into it but cannot see clear reason for using it.

Signature · 12 lines
Patrick Shirkey - Boost Hardware Ltd.
For the discerning hardware connoisseur
Http://www.boosthardware.com
Http://www.boosthardware.com/LAU/guide/
========================================



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31