logo
On this page

How to cross-compile Linux v4l-utils dependency library?

2023-04-27
Products / Plugins:Video Call / Audio Call
Platform / Framework:Linux

This article will introduce cross-compiling v4l-utils (libv4l) for an aarch64 architecture embedded machine on an x86_64 machine running Ubuntu 20.04 as an example.

  1. Install the dependency libraries required to compile v4l-utils.

    $ 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 V4l-utils source code from V4l official website and extract it.

    For example, download v4l-utils-1.22.1.tar.bz2 locally.

    $ wget https://linuxtv.org/downloads/v4l-utils/v4l-utils-1.22.1.tar.bz2
    $ tar xf v4l-utils-1.22.1.tar.bz2
    $ cd v4l-utils-1.22.1

    Then extract the source code through tar and cd into the directory.

Note
  • If you cannot find "wget", you can install "wget" through apt install wget.
  • If "tar" extraction fails, it may be because 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 --disable-doxygen-doc --without-jpeg --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)
Note

If you encounter "std" related errors during compilation, it may be because your compiler version is too low. You can try to specify the use of gnu++11 to compile C++ code by executing export CXXFLAGS="-std=gnu++11" before executing the ./configure in step 4.

  1. Install v4l-utils 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

How to reduce the app size when integrating Native SDK?

Next

How to implement switching camera/video screen/microphone/audio/speaker?