移植alsa-lib遇到的问题

linux audio    alsa lib    VERSIONED_SYMBOLS

这两天移植alsa lib时遇到了一个问题,被困住了好久。

做个记录,以后再被相同问题困住。

问题背景是这种。有个项目,客户要求使用新的alsa-lib库。

到alsa官网上看了下。最新的是1.0.28。

既然能够要用新的。咱们就彻底满足客户,用个最新的。

接下来看看遇到了什么问题。

事实上项目中曾经也有alsa lib库,毕竟alsa是眼下linux系统普遍採用的音频架构。

移植起来事实上也没什么麻烦的。

首先,代码搞过来。

然后。运行configure,来生成一堆东东,当中最重要的一个是config.h文件。

一般linux下,应用程序或应用层的库文件。接下来就是make 和make install。

因为我们系统中有自己的make 脚本,所以这两步被我们自己的make 命令所替代。

第一个遇到的问题是:

externals/alsa-lib/src/alisp/alisp.c: In function 'obj_type_str':

externals/alsa-lib/src/alisp/alisp.c:1028:1: error: control reaches end of non-void function [-Werror=return-type]

看错误提示能够知道。这是一个类型非void的函数没有返回值。

可是从[-Werror=return-type]可知,这事实上是一个 warning,仅仅是被作为error对待了。

为什么会被作为error对待,由于有-Werror=return-type的配置。

在locl compile flag中,增加-Wno-error=return-type。问题解决。

上面这个问题非常快被消灭。以下这个问题则费了我不是血。

问题提示:

/ld: failed to set dynamic section sizes: Bad value

编译是我的弱项。一见到编译问题,就感觉束手无策。

事实上万果皆有因。没有无缘无故的错误。

先看了下error之前的编译log,没发现实用的信息。

接下来找度娘帮忙。

也有人遇到过类似问题。看到的一个该问题的解决方式是,其代码中有个函数声明了但没定义,导致了该问题,加上该函数定义,问题解决。

alsa lib的代码不是我写的。有没有声明了但没定义的函数。我也不知道。

alsa lib库的代码量也非常可观,检查一遍仅仅能是想想而已。

检查编译log,发现開始有非常多warning提示一些宏反复定义了。

通过#ifndef,将这些warning解决。

编译还是有相同的问题。

编译log中另一些函数參数未被使用的warning,找到这些函数看了下,没发现函数实现有哪个函数没定义(相应前面网上的解决方式)。

是不是在configure的时候有些參数指定的不正确,导致有问题?

网上搜了搜别人的移植案例,没发现与我的配置不一致的地方。

既然configure的一个重要功能是生成config.h文件。那就比較下新生成的config.h文件与之去workable版本号的config.h文件有什么差别。

比較发现,还是有不少差别。

先用旧的config.h替换过来。

make。通过了!



肯定是config.h的问题了。

通过逐类排除,最后发现新的config.h中多了个下面定义:

/* compiled with versioned symbols */

#define VERSIONED_SYMBOLS /**/

把该定义删除,编译就ok了。

用百度搜索该宏,发现有人已经遇到过相同的问题(度娘还是有两下子的):

http://www.android100.org/html/201409/16/65158.html

看到该定义,想起来编译错误之前有一句提示:

libasound.so: version node not found for symbol snd_ctl_elem_info_get_dimension@@ALSA_0.9.3

只是,度娘也仅仅有两下子。

想看看VERSIONED_SYMBOLS的说明,还得靠谷歌。

http://infocenter.arm.com/help/index.jsp?

topic=/com.arm.doc.dui0206j/Beijfhhg.html

You can add specially-named symbols to input objects that cause the linker to create symbol versions. These symbols are of the form:

name@version for a non-default version of a symbol

name@@version for a default version of a symbol.

You must define these symbols, at the address of the function or data, as that you want to export. The symbol name is divided into two parts, a symbol name name and a version definition version. The name is added to the dynamic symbol table and becomes part
of the interface to the shared object. Version creates a version called ver if it does not already exist and associates name with the version called ver.

For more information on how to create version symbols, see:

Adding symbol versions in the Compiler User Guide

Chapter 2 Writing ARM Assembly Language in the Assembler Guide.

Example 4.6 places the symbols foo@ver1,foo@@ver2, and
bar@@ver1 into the object symbol table:

Example 4.6. Creating versioned symbols, embedded symbols

int old_function(void) __asm__("foo@ver1");

int new_function(void) __asm__("foo@@ver2");

int other_function(void) __asm__("bar@@ver1");

The linker reads these symbols and creates version definitions ver1 and ver2. The symbol foo is associated with a non-default version of ver1, and with a default version of ver2. The symbol bar is associated with a default version of ver1.

预计alsa lib中并未定义foo@ver1foo@@ver2类似的东东,所以出现了前面的错误。

解决的方法即删除:

#define VERSIONED_SYMBOLS

There is no way to create associations between versions with this method.

移植alsa-lib遇到的问题的更多相关文章

  1. ALSA lib编译

    http://blog.sina.com.cn/s/blog_7d7e9d0f0101lqlp.html alsa  lib: #!bin/sh rm -rf ./output/* mkdir -p ...

  2. ALSA lib基本概念

    1.channel 通道,即我们熟知的声道数.左/右声道,5.1channel等等 2.sample A sample is a single value that describes the amp ...

  3. Arm-Linux 移植 alsa

    ref : https://www.cnblogs.com/yutingliuyl/p/6718875.html https://blog.csdn.net/yuanxinfei920/article ...

  4. ALSA lib调用实例

    1. Display Some PCM Types and Formats 2. Opening PCM Device and Setting Parameters /* This example o ...

  5. 基于tiny6410的madplay播放器的移植

    在移植madplay之前需要先将所需要的库移植到开发板的文件系统中. 现在每个解压后的文件夹中创建一个文件夹 zlib-1.1.4.tar.gz 解压:tar xvzf  zlib-1.1.4.tar ...

  6. OK6410移植madplay播放器,王明学learn

    对于ok6410的madplay移植主要包括三部分.声卡驱动移植,播放器的移植,以及alsa库的移植. 一.首先移植声卡驱动以及播放器 ok6410采用WM97系列的声卡芯片,要使得内核支持该驱动,首 ...

  7. alsa-lib及alsa-utils成功移植(原…

    准备工作 alsa-lib版本:alsa-lib-1.0.23.tar.bz2 alsa-util版本:alsa-utils-1.0.23.tar.bz2 其他版本的alsa-lib和alsa-uti ...

  8. 36、ALSA声卡驱动和应用

    (注意:内核上电的时候会把一些没运行的控制器模块的时钟都关掉,所有在写驱动的时候需要在使用的使用使用clk_get和clk_enable使能时钟) (说明:与ALSA声卡对应的是OSS架构,第二期视频 ...

  9. alsa-lib及alsa-utils成功移植(转载)

    准备工作 alsa-lib版本:alsa-lib-1.0.23.tar.bz2 alsa-util版本:alsa-utils-1.0.23.tar.bz2 其他版本的alsa-lib和alsa-uti ...

随机推荐

  1. Linux删除非空目录的方法

    rmdir 无法删除非空目录. rm -rf 可以递归,强制,删除目录

  2. 将模型储存到本地-FastCoder

    // // ViewController.m // 模型转data储存 // // Created by 谭启宏 on 16/3/4. // Copyright © 2016年 tqh. All ri ...

  3. ZOJ 3772 Calculate the Function 线段树+矩阵

    Calculate the Function Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %ll ...

  4. APUE 学习笔记(一) Unix基础知识

    1. Unix 体系结构   内核的接口被称为系统调用 公用函数库构建在系统调用接口之上 应用软件既可以调用公用函数库,也可以直接进行系统调用   2. 文件和目录 目录操作函数:opendir--- ...

  5. FOJ Problem 2256 迷宫

                                                                                                        ...

  6. 2018.8.6 Noip2018模拟测试赛(十九)

    日期: 八月六号  总分: 300分  难度: 提高 ~ 省选    得分: 10分(MMP) 题目目录: T1:Tree T2:异或运算 T3:Tree Restoring 赛后反思: Emmmmm ...

  7. 洛谷P1372 a/b problem

    题目背景 “叮铃铃铃”,随着高考最后一科结考铃声的敲响,三年青春时光顿时凝固于此刻.毕业的欣喜怎敌那离别的不舍,憧憬着未来仍毋忘逝去的歌.1000多个日夜的欢笑和泪水,全凝聚在毕业晚会上,相信,这一定 ...

  8. 学习javascript设计模式之单例模式

    1.单例模式的核心是确保只有一个实例,并提供全局访问. 2.惰性单例 指的是在需要的时候才创建对象实例. 如在页面中创建唯一div 普通做法 var createDiv = (function(){  ...

  9. mfc对话框嵌入Flash的交互(转)

    原文转自 http://blog.csdn.net/yacper/article/details/5021081 研究Flash嵌入游戏中的可行性....... 渲染问题已解决 事件响应已解决 下面是 ...

  10. Delphi将图片缩放成指定大小

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...