- 简介
alsa-lib是针对音频应用编程的库,供应用层使用; - 下载
下载链接 - 移植
解压后运行下面脚本:
#!/bin/bash
prefix=$(pwd)/_install
datarootdir=$(pwd)/_datarootdir
if [ ! -d "${prefix}" ]; then
mkdir ${prefix}
if [ $? != 0 ]; then
echo "文件夹:${prefix}创建失败"
exit 0
fi
echo "文件夹:${prefix}创建成功"
else
echo "文件夹:${prefix}已存在"
fi
if [ ! -d "${datarootdir}" ]; then
mkdir ${datarootdir}
if [ $? != 0 ]; then
echo "文件夹:${datarootdir}创建失败"
exit 0
fi
echo "文件夹:${datarootdir}创建成功"
else
echo "文件夹:${datarootdir}已存在"
fi
#INSTALL_DIR=$(pwd)/_install
#cross_compiler=arm-linux-gnueabihf-
HOST=arm-linux-gnueabihf
./configure --prefix=${prefix} --host=${HOST} --enable-shared --datarootdir=${datarootdir}
make
make install
成功后在当前目录的_install生成库bin、include和lib文件,拷贝到交叉编译工具链和开发板文件系统中,在当前目录_datarootdir文件夹生成了alsa配置文件,将alsa配置文件拷贝到开发板文件系统/etc下(其他地方也可以),但是设置的环境变量不同;
设置环境变量:
#在/etc/profile最后添加
export ALSA_CONFIG_PATH=/etc/alsa/alsa.conf
export ALSA_CONFIG_DIR=/etc/alsa/
编译过程中出错:
error: ‘__kernel_long_t’ undeclared (first use in this function)
解决:vim src/timer/timer_local.h
添加:
#ifndef __kernel_long_t
typedef long __kernel_long_t;
typedef unsigned long __kernel_ulong_t;
#endif