Reputation: 61
I am trying to cross compile ALSA Lib application for linux-arm based processor. I am using eclipse to do the build for me. The build phase of the application is successful but I get errrors when the gcc linker tries to complete.
I get the following errors
Building target: sound Invoking: Cross GCC Linker arm-linux-gnueabihf-gcc -L/proc/asound -L/srv/nfs/rootfs/usr/lib -Wl,-rpath-link,/srv/nfs/rootfs/usr/lib -L/srv/nfs/rootfs/lib -Wl,-rpath-link,/srv/nfs/rootfs/lib -o "sound" ./play.o
./play.o: In functionmain': /home/neonws/sound/Debug/../play.c:13: undefined reference to
snd_pcm_open' makefile:29: recipe for target 'sound' failed /home/neonws/sound/Debug/../play.c:14: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:20: undefined reference to
snd_pcm_hw_params_malloc' /home/neonws/sound/Debug/../play.c:21: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:26: undefined reference to
snd_pcm_hw_params_any' /home/neonws/sound/Debug/../play.c:27: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:32: undefined reference to
snd_pcm_hw_params_set_access' /home/neonws/sound/Debug/../play.c:33: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:38: undefined reference to
snd_pcm_hw_params_set_format' /home/neonws/sound/Debug/../play.c:39: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:44: undefined reference to
snd_pcm_hw_params_set_rate_near' /home/neonws/sound/Debug/../play.c:45: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:50: undefined reference to
snd_pcm_hw_params_set_channels' /home/neonws/sound/Debug/../play.c:51: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:56: undefined reference to
snd_pcm_hw_params' /home/neonws/sound/Debug/../play.c:57: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:62: undefined reference to
snd_pcm_hw_params_free' /home/neonws/sound/Debug/../play.c:64: undefined reference tosnd_pcm_prepare' /home/neonws/sound/Debug/../play.c:65: undefined reference to
snd_strerror' /home/neonws/sound/Debug/../play.c:71: undefined reference tosnd_pcm_writei' /home/neonws/sound/Debug/../play.c:72: undefined reference to
snd_strerror' /home/neonws/sound/Debug/../play.c:78: undefined reference to `snd_pcm_close' collect2: error: ld returned 1 exit status make: *** [sound] Error 1
11:15:58 Build Finished (took 75ms)
I am using the Sample Playback Program from ASLA-LIB api.
I am wondering what is causing the linker to fail?
Upvotes: 3
Views: 3624
Reputation: 5022
You're missing an asound
library linkage, add -lasound
to your linking flags (see this question which tells where to do that properly in Eclipse). And probably remove -L/proc/asound
, I don't think you have your libraries there.
Upvotes: 3