移植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. Ajax、Comet、Websocket、SSE

    从 http 协议说起 1996年IETF  HTTP工作组发布了HTTP协议的1.0版本 ,到现在普遍使用的版本1.1,HTTP协议经历了17 年的发展.这种分布式.无状态.基于TCP的请求/响应式 ...

  2. BZOJ-2049 [SDOI2008]洞穴勘测

    LCT模版题.... #include <cstdlib> #include <cstdio> #include <cstring> #include <al ...

  3. hdu 6119 小小粉丝度度熊

    小小粉丝度度熊 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Sub ...

  4. aoj 2226 Merry Christmas

    Merry Christmas Time Limit : 8 sec, Memory Limit : 65536 KB Problem J: Merry Christmas International ...

  5. UVa1362 Exploring Pyramids

    区间dp,枚举走完第一个子树之后回到根节点的位置. /*by SilverN*/ #include<algorithm> #include<iostream> #include ...

  6. Spring Boot的web开发&静态资源配置方式

    Web开发的自动配置类:org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration 1.1. 自动配置的ViewResolve ...

  7. 打印倒序NxN乘法表

    一.实验要求: 给定任意一个字符N(N>0),然后打印NxN的倒序乘法表. 二.解决问题: #/!bin/bash# #define functionNxN_fun(){ local i=$1 ...

  8. Laravel 5.1 框架返回状态拦截

    Laravel 5.1 返回信息状态拦截 可以在app\Exceptions\Handler.php文件中修改, public function render($request, Exception ...

  9. github每次push提交都要输入账号密码

    问题产生的原因是在克隆的时候使用的是https的方式或者用一些特殊的指令来克隆的github项目源,如 golang里的go get github.com/...... 没次提交push的时候都会提示 ...

  10. LeetCode OJ--Rotate Image

    http://oj.leetcode.com/problems/rotate-image/ 将矩阵顺时针旋转90度.要求为原地算法. 注意对输入的测试,矩阵为空,长度为1,为2时…… #include ...