[Solved] In the arm64 environment, the third-party library hajimehoshi/oto of golang depends on the solutions of alsa-lib and cgo

Last updated on 19 Jul 2022 17:13:05

Note the following:

# oto library requires cross-compile must be explicitly specified
export CGO_ENABLED=1
# Must explicitly set C compile (or cross compile, who knows what CC is short for)
export CC=aarch64-linux-gnu-gcc

Download a lib compressed package from ALSA’s official website, I am using version 1.2.4: download address

Unzip, cross compile and install:

tar -xvf ./alsa-lib-1.2.4.tar.bz2
cd alsa-lib-1.2.4/
mkdir build/
cd build/
CC=aarch64-linux-gnu-gcc ../configure --host=arm-linux
make
make install

This can be successfully compiled, toss me for an afternoon

refer to:
hajimehoshi/oto issue: cannot find -lasound
hajimehoshi/oto issue: Compilation error for ARM architecture