Alexa交叉编译(avs-device-sdk)

亚马逊alexa语音识别解决方案作为业界的主流的语音识别的解决方案,本次交叉编译旨在将alexa移植到arm平台,实现设备的智能语音识别功能。

2.1 工程目录构建

根据官方文档,先进行工程目录构建,其中source主要放avs源码,third-party存放第三方库文件。

 cd $HOME
 mkdir my_project
 cd my_project
 mkdir build source third-party application-necessities
 cd application-necessities
 mkdir sound-files

2.2 下载三方库文件

cd $HOME/my_project/third-party
wget https:
wget -c http:
wget https:
wget https:
wget https:
wget https:
wget https:
wget https:
wget https:
wget https:
wget https:
wget https:
wget https:

2.3 下载源码

cd $HOME/my_project/source
git clone --single-branch https:

3.1 编译portaudio

cd portaudio ./configure –host=arm-linux-gnueabihf –without-jack &&
make -j4

3.2编译nghttp2

cd nghttp2-1.39.2/
./configure –host=arm-linux-gnueabihf –prefix=$HOME/my_project/install/arm/
OPENSSL_CFLAGS=’-I/home/my_project/install/arm/include’
OPENSSL_LIBS=’-lssl -lcrypto -L/home/my_project/install/arm/lib’
ZLIB_CFLAGS=’-I/home/my_project/install/arm/include’
ZLIB_LIBS=’-lz -L/home/my_project/install/arm/lib’
–enable-app

3.3 编译curl

cd curl-7.67.0
./configure –with-nghttp2 –host=arm-linux-gnueabihf –prefix=/home/my_project/third-party/curl-7.67.0/install/arm –with-libssl make -j4 –with-nghttp2=$HOME/my_project/install/arm/

3.4 编译gstreamer

cd zlib-1.2.11/
CC=arm-linux-gnueabihf-gcc ./configure –prefix=$HOME/my_project/third-party/zlib-1.2.11/install/arm
make && make install

cd libffi-3.2.1/
CC=arm-linux-gnueabihf-gcc ./configure –host=arm-linux-gnueabihf –prefix=$HOME/my_project/third-party/libffi-3.2.1/install/arm
make && make install

先修改配置文件

cd glib-2.45.3/
vi glib.cache
glib_cv_long_long_format=ll
glib_cv_stack_grows=no
glib_cv_have_strlcpy=no
glib_cv_have_qsort_r=yes
glib_cv_va_val_copy=yes
glib_cv_uscore=no
glib_cv_rtldglobal_broken=no
ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes

编译glib库

cd glib-2.45.3/
CC=arm-linux-gnueabihf-gcc ./configure –with-pcre=internal –enable-libmount=no
–prefix=/home/my_project/third-party/glib-2.45.3/install/arm
LIBFFI_CFLAGS=’-I/home/my_project/third-party/libffi-3.2.1/install/arm/lib/libffi-3.2.1/include/’
LIBFFI_LIBS=’-lffi -L=/home/my_project/third-party/libffi-3.2.1/install/arm/lib’
ZLIB_CFLAGS=’-I/home/my_project/third-party/zlib-1.2.11/install/arm/include’
ZLIB_LIBS=’-lz -L/home/my_project/third-party/zlib-1.2.11/install/arm/lib’
–host=arm-linux-gnueabihf –cache-file=glib.cache –disable-selinux
–disable-xattr –disable-libelf

cd gstreamer-1.12.0/
CC=arm-linux-gnueabihf-gcc ./configure –prefix=$HOME/my_project/third-party/gstreamer-1.12.0/install/arm
–host=arm-linux-gnueabihf
LIBS=’-lz -L/home/my_project/third-party/zlib-1.2.11/install/arm/lib’
GLIB_CFLAGS=’-I/home/my_project/third-party/glib-2.45.3/install/arm/include/glib-2.0/
-I/home/my_project/third-party/glib-2.45.3/install/arm/include/glib-2.0/glib/
-I/home/my_project/third-party/glib-2.45.3/install/arm/lib/glib-2.0/include/’
GLIB_LIBS=’-lglib-2.0 -lgio-2.0 -lgmodule-2.0 -lgobject-2.0
-lgthread-2.0 -L=/home/my_project/third-party/glib-2.45.3/install/arm/lib
-lffi -L=/home/my_project/third-party/libffi-3.2.1/install/arm/lib’

cd orc-0.4.26/
CC=arm-linux-gnueabihf-gcc ./configure –prefix=$HOME/my_project/third-party/orc-0.4.26/install/arm
–host=arm-linux-gnueabihf
make && make install

export PKG_CONFIG_PATH=/home/my_project/third-party/orc-0.4.26/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/my_project/third-party/glib-2.45.3/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/my_project/third-party/zlib-1.2.11/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/my_project/third-party/libffi-3.2.1/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/my_project/third-party/orc-0.4.26/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH

cd gst-plugins-base-1.12.0/
CC=arm-linux-gnueabihf-gcc ./configure –prefix=$HOME/my_project/third-party/gst-plugins-base-1.12.0/install/arm
–host=arm-linux-gnueabihf
LIBS=’-lz -L/home/my_project/third-party/zlib-1.2.11/install/arm/lib’
GLIB_CFLAGS=’-I/home/my_project/third-party/glib-2.45.3/install/arm/include/glib-2.0/
-I/home/my_project/third-party/glib-2.45.3/install/arm/include/glib-2.0/glib/
-I/home/my_project/third-party/glib-2.45.3/install/arm/lib/glib-2.0/include/’
GLIB_LIBS=’-lglib-2.0 -lgio-2.0 -lgmodule-2.0 -lgobject-2.0
-lgthread-2.0 -L=/home/my_project/third-party/glib-2.45.3/install/arm/lib
-lffi -L=/home/my_project/third-party/libffi-3.2.1/install/arm/lib’
ORC_CFLAGS=’-I/home/my_project/third-party/orc-0.4.26/install/arm/include/orc-0.4′
ORC_LIBS=’-lorc-0.4 -L=/home/my_project/third-party/orc-0.4.26/install/arm/lib’
–disable-x –disable-xvideo –disable-ogg –disable-oggtest –disable-freetypetest –disable-vorbis –disable-vorbistest –disable-pango –disable-alsa

cd gst-plugins-good-1.12.0/
CC=arm-linux-gnueabihf-gcc ./configure –prefix=$HOME/my_project/install/arm/
–host=arm-linux-gnueabihf
LIBS=’-lz -L/home/my_project/install/arm/lib’
GLIB_CFLAGS=’-I/home/my_project/install/arm/include/glib-2.0/
-I/home/my_project/install/arm/include/glib-2.0/glib/
-I/home/my_project/install/arm/lib/glib-2.0/include/’
GLIB_LIBS=’-lglib-2.0 -lgio-2.0 -lgmodule-2.0 -lgobject-2.0
-lgthread-2.0 -L=/home/my_project/install/arm/lib
-lffi -L=/home/my_project/install/arm/lib’
ORC_CFLAGS=’-I/home/my_project/install/arm/include/orc-0.4′
ORC_LIBS=’-lorc-0.4 -L=/home/my_project/install/arm/lib’
–disable-x –disable-rtsp –disable-videobox –disable-oss
–disable-cairo
–disable-jack
–disable-jpeg
–disable-libcaca
–disable-libdv
–disable-libpng
–disable-pulse
–disable-dv1394
–disable-shout2
–disable-soup
–disable-speex
–disable-taglib
–disable-vpx
–disable-wavpack
–disable-bz2
–disable-gdk_pixbuf
–disable-flac

make -j 4 && make install

cd gst-plugins-ugly-1.12.0/
CC=arm-linux-gnueabihf-gcc ./configure –prefix=$HOME/my_project/install/arm/
–host=arm-linux-gnueabihf
LIBS=’-lz -L/home/my_project/install/arm/lib’
GLIB_CFLAGS=’-I/home/my_project/install/arm/include/glib-2.0/
-I/home/my_project/install/arm/include/glib-2.0/glib/
-I/home/my_project/install/arm/lib/glib-2.0/include/’
GLIB_LIBS=’-lglib-2.0 -lgio-2.0 -lgmodule-2.0 -lgobject-2.0
-lgthread-2.0 -L=/home/my_project/install/arm/lib
-lffi -L=/home/my_project/install/arm/lib’
ORC_CFLAGS=’-I/home/my_project/install/arm/include/orc-0.4′
ORC_LIBS=’-lorc-0.4 -L=/home/my_project/install/arm/lib’
–disable-a52dec
–disable-amrnb
–disable-amrwb
–disable-cdio
–disable-dvdread
–disable-lame
–disable-mpeg2dec
–disable-mpg123
–disable-sidplay
–disable-twolame
–disable-x264

make -j 4 && make install

3.5 编译sqlite3

cd sqlite-autoconf-3360000/
./configure –host=arm-linux-gnueabihf –prefix=$HOME/my_project/third-party/sqlite-autoconf-3360000/install/arm
make && make install

3.6 编译openssl

cd openssl-OpenSSL_1_1_1d/
./config no-asm –prefix=$HOME/my_project/third-party/openssl-OpenSSL_1_1_1d/install/arm –cross-compile-prefix=arm-linux-gnueabihf-
vi Makefile

删除 -m64

make && make install

cd $HOME/my_project/build
cmake $HOME/my_project/source/avs-device-sdk \
 -DCMAKE_TOOLCHAIN_FILE=../source/avs-device-sdk/AvsDeviceSdk.cmake \
 -DGSTREAMER_MEDIA_PLAYER=ON \
 -DCMAKE_INSTALL_PREFIX=$HOME/my_project/install/arm_avs \
 -DTARGET_RPATH=$HOME/my_project/install/arm/ \
 -DUSE_CCACHE=ON \
 -DPORTAUDIO=ON \
 -DPORTAUDIO_LIB_PATH=$HOME/my_project/install/arm/lib/libportaudio.so \
 -DPORTAUDIO_INCLUDE_DIR=$HOME/my_project/install/arm/include \
 -DCMAKE_BUILD_TYPE=DEBUG \
 -DCURL_INCLUDE_DIR=$HOME/my_project/install/arm/include/ \
 -DCURL_LIBRARY=$HOME/my_project/install/arm/lib/libcurl.so \
 -DSQLITE_INCLUDE_DIR=$HOME/my_project/install/arm/include \
 -DSQLITE_LIBRARY=$HOME/my_project/install/arm/lib/libsqlite3.so \
 -DCRYPTO_INCLUDE_DIR=$HOME/my_project/install/arm/include \
 -DCRYPTO_LIBRARY=$HOME/my_project/install/arm/lib/libcrypto.so \
 -DGLIB_INCLUDE_DIR=$HOME/my_project/install/arm/include/glib-2.0 \
 -DGLIB_LIBRARY=$HOME/my_project/install/arm/lib/libglib-2.0.so

make SampleApp

认证,下载相关的db文件到database

 mkdir $HOME/my_project/build/Integration/database
 cd $HOME/my_project/source/avs-device-sdk/tools/Install
   sudo bash genConfig.sh config.json 12345 \
   $HOME/my_project/build/Integration/database \
   $HOME/my_project/source/avs-device-sdk \
   $HOME/my_project/build/Integration/AlexaClientSDKConfig.json \
   -DSDK_CONFIG_MANUFACTURER_NAME="my_project" \
   -DSDK_CONFIG_DEVICE_DESCRIPTION="ubuntu"

拷贝挂载运行,查看log看还有什么报错需要解决。

 cd $HOME/my_project/build
 ./SampleApp/src/SampleApp ./Integration/AlexaClientSDKConfig.json DEBUG9

Original: https://blog.csdn.net/qq_38731735/article/details/120869805
Author: 响箭零零一
Title: Alexa交叉编译(avs-device-sdk)

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/498178/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球