logo
On this page

How to cross-compile Linux alsa-lib dependency library?

2023-02-21
Products / Plugins:Video Call / Audio Call
Platform / Framework:Linux

This document will introduce how to cross-compile alsa-lib (libasound) for an aarch64 architecture embedded machine on an x86_64 machine with Ubuntu 20.04 as the system.

  1. Install the dependency libraries required to compile alsa-lib.

    $ apt update
    $ apt install make automake libtool
  2. Install the cross-compilation toolchain.

Note

This example installs the latest version of the GNU GCC toolchain. Please install the correct cross-compilation toolchain for your embedded machine according to your actual situation.

$ apt update
$ apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
  1. Download the latest version of alsa-lib source code from ALSA Official Website and extract it.

    For example, download alsa-lib-1.2.7.2.tar.bz2 to local.

    $ wget https://www.alsa-project.org/files/pub/lib/alsa-lib-1.2.7.2.tar.bz2
    $ tar xf alsa-lib-1.2.7.2.tar.bz2
    $ cd alsa-lib-1.2.7.2

    Then use tar to extract the source code and cd into the extracted directory.

Note
  • If you cannot find "wget", you can install "wget" through apt install wget.
  • If "tar" extraction fails, it may be that the system does not have the "bzip2" library installed. You can install it through apt install bzip2.
  1. Generate the configuration file through ./configure.

    $ ./configure --enable-shared=yes --enable-static=no --with-pic \
    --host=aarch64-linux-gnu --prefix=/usr/aarch64-linux-gnu
    • Specify the cross-compilation target as aarch64-linux-gnu through the --host parameter. You need to modify this according to your actual situation to your cross-compilation target.
    • Specify the installation path as /usr/aarch64-linux-gnu through the --prefix parameter. You need to modify this according to your actual situation to the installation path of your cross-compilation toolchain.
  2. Specify the number of parallel tasks for concurrent compilation through the -j parameter, or compile directly through make.

    $ make -j$(nproc)
  3. Install alsa-lib to the installation path of the cross-compilation toolchain through make install, which is the path specified by the prefix parameter in step 4.

    $ make install

Previous

Why is it unable to get device ID on Chrome 81 and above browsers?

Next

Does ZIM SDK support automatic reconnection mechanism?