bear工具使用:ERROR: ld.so: object ‘/usr/${LIB}/bear/libear.so‘ from LD_PRELOAD

这篇博客主要介绍了在Visual Studio Code(VSCode)开发环境中,遇到bear插件在生成compile_commands.json文件时出现的libear.so错误。错误信息显示找不到指定路径的libear.so库。为了解决这个问题,博主建议通过运行`find /usr/ -name *bear*`命令来查找libear.so的实际位置。找到后,使用正确的路径更新bear命令,例如`bear -l/usr/lib/x86_64-linux-gnu/bear/libear.so make -j4`,从而成功生成compile_commands.json。

vscode开发,生成compile_commands.json 

bear插件报错

ld.so: object '/usr/${LIB}/bear/libear.so' from LD_PRELOAD 

bear -h

usage: bear [-h] [--version] [--verbose] [--cdb <file>] [--use-cc <path>]
            [--use-c++ <path>] [--append] [--libear LIBEAR]
            ...

positional arguments:
  build                 Command to run.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --verbose, -v         Enable verbose output from 'bear'. A second, third and
                        fourth flags increases verbosity. (default: 0)
  --cdb <file>, -o <file>
                        The JSON compilation database. (default:
                        compile_commands.json)
  --use-cc <path>       Hint 'bear' to classify the given program name as C
                        compiler. (default: cc)
  --use-c++ <path>      Hint 'bear' to classify the given program name as C++
                        compiler. (default: c++)

advanced options:
  --append, -a          Extend existing compilation database with new entries.
                        Duplicate entries are detected and not present in the
                        final output. The output is not continuously updated,
                        it's done when the build command finished. (default:
                        False)
  --libear LIBEAR, -l LIBEAR
                        specify libear file location. (default:
                        /usr/${LIB}/bear/libear.so)

解决方式

find一下

find /usr/ -name "*bear*"

找到之后指导libbear路径

 bear -l /usr/lib/x86_64-linux-gnu/bear/libear.so make -j4

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值