Install flex and bison from ubuntu source code

perf source code download link

>$ uname -r
5.4.0-122-generic
# 去官网上下载内核源码,可以手动下载,也可以使用wget
>$ wget http://ftp.sjtu.edu.cn/sites/ftp.kernel.org/pub/linux/kernel/v5.x/linux-5.4.122.tar.gz
# 下载完毕之后,接下内核源代码
>$ tar -zxvf linux-5.4.122.tar.gz
# 进入如下目录
>$ cd linux-5.4.122/tools/perf/
# 源码级安装, 如有些依赖包没有安装,得安装一下,依赖包在下面第二个链接
>$ make -j10 && make install
# 查看perf的安装情况
>$ perf --version
perf version 5.4.192

During the process of installing perf from the source code, it will prompt that flex and bison are missing

flex source code download compile
flex source code download link

https://github.com/westes/flex/tags

Unzip, get the folder flex-2.6.4, enter this folder

./configure CFLAGS=-D_GNU_SOURCE
make
sudo make install

bison source code download compile
bison source code download link

http://ftp.gnu.org/gnu/bison/

Unzip and enter this folder

./configure
make
sudo make install

Guess you like

Origin blog.csdn.net/weixin_42445727/article/details/129546725