[alsa-devel] Plug In Creation - aplay can't find existing .so
Hello,
I am working on a new pcm plugin. At this point it is basically just a Hello World plugin, to make sure I have the tools working and understand the workflow. I created a simple file which is just basically:
#include <alsa/asoundlib.h> #include <alsa/pcm_external.h> SND_PCM_PLUGIN_DEFINE_FUNC(my_mod) { printf("hello world\n"); return 0; } SND_PCM_PLUGIN_SYMBOL(my_mod);
I compiled this as a shared lib named 'libasound_module_pcm_my_mod.so' and copied it to '/usr/lib/i386-linux-gnu/alsa-lib/'
I edited my ~/.asoundrc to create a new device that uses this plugin. Then I try to use it with `aplay --device=my_mod_test out.pcm`
I get the error message
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/i386-linux-gnu/alsa-lib/libasound_module_pcm_my_mod.so aplay: main:682: audio open error: No such device or address
But this file actually does exist, I just copied it there.
Any idea why this happens?
Thanks much, Brandon
At Tue, 10 Jun 2014 13:55:39 -0400, Brandon Yates wrote:
Hello,
I am working on a new pcm plugin. At this point it is basically just a Hello World plugin, to make sure I have the tools working and understand the workflow. I created a simple file which is just basically:
#include <alsa/asoundlib.h> #include <alsa/pcm_external.h> SND_PCM_PLUGIN_DEFINE_FUNC(my_mod) { printf("hello world\n"); return 0; } SND_PCM_PLUGIN_SYMBOL(my_mod);
I compiled this as a shared lib named 'libasound_module_pcm_my_mod.so' and copied it to '/usr/lib/i386-linux-gnu/alsa-lib/'
I edited my ~/.asoundrc to create a new device that uses this plugin. Then I try to use it with `aplay --device=my_mod_test out.pcm`
I get the error message
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/i386-linux-gnu/alsa-lib/libasound_module_pcm_my_mod.so aplay: main:682: audio open error: No such device or address
But this file actually does exist, I just copied it there.
Any idea why this happens?
Try strace to see what happens. If it fails in dlopen(), it's likely because your shared object is invalid.
Takashi
Actually on close inspection it looks like open is succeeding. Not sure what's going on here. Here's more of the strace:
open("/usr/lib/i386-linux-gnu/alsa-lib/libasound_module_pcm_adt_dsp.so", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\7\0\0004\0\0\0"..., 512) = 512 fstat64(3, {st_mode=S_IFREG|0644, st_size=7655, ...}) = 0 mmap2(NULL, 8464, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x166000 mmap2(0x167000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x167000 close(3) = 0 munmap(0x166000, 8464) = 0 write(2, "ALSA lib dlmisc.c:254:(snd1_dlob"..., 45ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) ) = 45 write(2, "Cannot open shared library /usr/"..., 91Cannot open shared library /usr/lib/i386-linux-gnu/alsa-lib/libasound_module_pcm_adt_dsp.so) = 91
Any insight?
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Friday, June 13, 2014 8:42 AM To: Brandon Yates Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] Plug In Creation - aplay can't find existing .so
At Tue, 10 Jun 2014 13:55:39 -0400, Brandon Yates wrote:
Hello,
I am working on a new pcm plugin. At this point it is basically just a
Hello World plugin, to make sure I have the tools working and understand the workflow. I created a simple file which is just
basically:
#include <alsa/asoundlib.h> #include <alsa/pcm_external.h> SND_PCM_PLUGIN_DEFINE_FUNC(my_mod) { printf("hello world\n"); return 0; } SND_PCM_PLUGIN_SYMBOL(my_mod);
I compiled this as a shared lib named
'libasound_module_pcm_my_mod.so'
and copied it to '/usr/lib/i386-linux-gnu/alsa-lib/'
I edited my ~/.asoundrc to create a new device that uses this plugin. Then I try to use it with `aplay --device=my_mod_test out.pcm`
I get the error message
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/i386-linux-gnu/alsa-lib/libasound_module_pcm_my_mod.so aplay: main:682: audio open error: No such device or address
But this file actually does exist, I just copied it there.
Any idea why this happens?
Try strace to see what happens. If it fails in dlopen(), it's likely because your shared object is invalid.
Takashi
participants (2)
-
Brandon Yates
-
Takashi Iwai