前情提要:
在源码构建python的时候,想借助bear工具观察中间的编译过程
安装bear
环境:ubuntu22.04
安装bear:3.0.18
#先更新一下
sudo apt-get update
sudo apt-get upgrade
#下载
sudo apt install bear
问题解决
高版本中 需要使用 --execute 来表明执行的命令
$ bear --help
Usage: bear [--output <arg>] [--verbose] -- ...--output <arg> path of the result file (default: compile_commands.json)
--verbose run in verbose mode
-- ... command to executeadvanced options
--append append result to an existing output file
--config <arg> path of the config file
--force-preload force to use library preload
--force-wrapper force to use compiler wrappersdeveloper options
--citnames <arg> path to the citnames executable (default: /usr/bin/citnames)
--interceptor <arg> path to the intercept executable (default: /usr/bin/intercept)
--library <arg> path to the preload library (default: /usr/$LIB/bear/libexec.so)
--wrapper <arg> path to the wrapper executable (default: /usr/lib/x86_64-linux-gnu/bear/wrapper)
--wrapper-dir <arg> path to the wrapper directory (default: /usr/lib/x86_64-linux-gnu/bear/wrapper.d)query options
--help print help and exit
--version print version and exit
所以应该执行
bear -- make