Mac安装lldb-mi遇到Could not find a package configuration file provided by LLVM with any of the following

MAC M123系列芯片调试C++,不能用GDB,只能用LLDB,MAC系统自带了lldb,需要安装lldb-mi

按照lldb-mi的readme
https://github.com/lldb-tools/lldb-mi

显示找不到这俩 LLVMConfig.cmakellvm-config.cmake

xxxx@MacBook-Pro lldb-mi % cmake . 

xxxx
CMake Error at CMakeLists.txt:15 (find_package):
  Could not find a package configuration file provided by "LLVM" with any of
  the following names:

    LLVMConfig.cmake
    llvm-config.cmake

  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
  "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"
  provides a separate development package or SDK, be sure it has been
  installed.

安装一下 LLVM,如果已经有了,则跳到最后的GitHub链接

brew install llvm

如果没有 brew,执行

/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
brew install llvm

前面都是安装 llvm 的一些 log,后这几句有用

To use the bundled libc++ please add the following LDFLAGS:
  LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib -lunwind"

llvm is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have llvm first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc

For compilers to find llvm you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"

把这三句加到 ~/.zshrc

export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"

然后刷新一下

source ~/.zshrc

如果有 llvm 还有这个问题,可以参考
https://github.com/EOSIO/eos/issues/43
在这里插入图片描述

如果这两步 cmake 都没啥问题

cmake .
cmake --build .

那么最后执行

make install  # 不知道为啥github最后没有写这个 (莫非是默认的?)

之后vscode的 .vscode 中的 launch.json 改为:

{
    "version": "0.2.0",
    "configurations": [
        {
			......
            "osx": {
                "MIMode": "lldb",
                "miDebuggerPath": "lldb-mi",
                "program": "${workspaceFolder}/output/main"
            },
			.....
        }
    ]
}

PS:

lldb-mi 是什么

lldb-mi 是一个为 LLDB 调试器提供的机器接口(Machine Interface, MI)前端。MI 是一种用于与调试器交互的文本协议,通常用于实现 IDE 和调试器之间的通信。lldb-mi 允许那些期望使用 GDB/MI 接口的工具与 LLDB 调试器进行交互。

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值