【问题标题】:ALSA Lib 1.1.2 Compilation errorALSA Lib 1.1.2 编译错误
【发布时间】:2017-01-27 11:06:52
【问题描述】:

我正在尝试为基于 linux-arm 的处理器交叉编译 ALSA Lib 应用程序。我正在使用 eclipse 为我进行构建。应用程序的构建阶段成功,但当 gcc 链接器尝试完成时出现错误。

我收到以下错误

建筑目标:声音 调用:跨 GCC 链接器 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 "声音" ./play.o
./play.o:在函数main': /home/neonws/sound/Debug/../play.c:13: undefined reference tosnd_pcm_open' makefile:29: 目标“声音”的配方失败 /home/neonws/sound/Debug/../play.c:14:未定义对snd_strerror' /home/neonws/sound/Debug/../play.c:20: undefined reference tosnd_pcm_hw_params_malloc 的引用 /home/neonws/sound/Debug/../play.c:21:未定义对snd_strerror' /home/neonws/sound/Debug/../play.c:26: undefined reference tosnd_pcm_hw_params_any' 的引用 /home/neonws/sound/Debug/../play.c:27: 未定义引用 snd_strerror' /home/neonws/sound/Debug/../play.c:32: undefined reference tosnd_pcm_hw_params_set_access' /home/neonws/sound/Debug/../play.c:33:未定义对snd_strerror' /home/neonws/sound/Debug/../play.c:38: undefined reference tosnd_pcm_hw_params_set_format 的引用 /home/neonws/sound/Debug/../play.c:39:未定义对snd_strerror' /home/neonws/sound/Debug/../play.c:44: undefined reference tosnd_pcm_hw_params_set_rate_near 的引用 /home/neonws/sound/Debug/../play.c:45: 未定义引用snd_strerror' /home/neonws/sound/Debug/../play.c:50: undefined reference tosnd_pcm_hw_params_set_channels' /home/neonws/sound/Debug/../play.c:51:未定义对snd_strerror' /home/neonws/sound/Debug/../play.c:56: undefined reference tosnd_pcm_hw_params'的引用 /home/neonws/sound/Debug/../play.c:57:未定义对snd_strerror' /home/neonws/sound/Debug/../play.c:62: undefined reference tosnd_pcm_hw_params_free' 的引用 /home/neonws/sound/Debug/../play.c:64: 未定义引用 snd_pcm_prepare' /home/neonws/sound/Debug/../play.c:65: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:71: 未定义引用 snd_pcm_writei' /home/neonws/sound/Debug/../play.c:72: undefined reference tosnd_strerror' /home/neonws/sound/Debug/../play.c:78:未定义对“snd_pcm_close”的引用 collect2:错误:ld 返回 1 个退出状态 make: *** [声音] 错误 1

11:15:58 构建完成(耗时 75 毫秒)

我正在使用来自 ASLA-LIB api 的 Sample Playback Program。

我想知道是什么导致链接器失败?

【问题讨论】:

    标签: c linux gcc audio libalsa


    【解决方案1】:

    您缺少asound 库链接,请将-lasound 添加到您的链接标志(请参阅this question,它告诉您在Eclipse 中正确执行该操作的位置)。并且可能删除-L/proc/asound,我认为你那里没有你的库。

    【讨论】:

    • >构建目标:声音调用:跨 GCC 链接器 arm-linux-gnueabihf-gcc -L/home/alsa-lib-1.1.2/include -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 "声音" ./play.o -lasound /home/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.2.1/../.. /../../arm-linux-gnueabihf/bin/ld: 找不到 -lasound makefile:29: 目标“声音”的配方失败 collect2: 错误: ld 返回 1 退出状态 make: *** [声音] 错误1 14:18:14 构建完成(耗时 76 毫秒)
    • 嗨@Roman 我按照您建议的指示进行操作,它给了我一个链接器错误,说“-lasound not found”您能否提出解决方案。我在库(-l)中添加了“asound”,然后是链接器的库搜索路径(-L)中的路径。
    • @JavaProgrammer:很难判断你的库在哪里,现在你的库搜索路径中缺少库,你应该使用-L 参数添加正确的路径。您的目标根文件系统在哪里?
    猜你喜欢
    • 1970-01-01
    • 2022-11-12
    • 2020-04-14
    • 1970-01-01
    • 2015-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-09
    相关资源
    最近更新 更多