【问题标题】:Qt Creator - The selected build of GDB does not support Python scriptingQt Creator - GDB 的选定版本不支持 Python 脚本
【发布时间】:2020-04-25 20:11:06
【问题描述】:

我在 CentOS 主机上使用交叉编译的 Qt 设置。开发 Qt 应用程序并在 Raspberry Pi 上远程执行它们工作正常。但是当我尝试调试应用程序时出现以下错误:

我使用的是来自官方Raspberry Pi toolchaintools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gdb)的标准GDB。

那么有什么问题吗?为什么我使用 C++ 时 GDB 需要 Python 脚本?

【问题讨论】:

    标签: qt gdb qt-creator


    【解决方案1】:

    我通常从源代码构建 GDB,因此您可以将其配置为包含 Python 支持:

    首先是一些依赖:

    yum install -y texinfo gcc gcc-c++ make python3-devel wget
    

    然后自己构建和安装 GDB:

    target=arm-linux-gnueabihf
    version=9.1
    
    # Download and extract
    cd /tmp
    [ -e gdb-$version.tar.xz ] || wget https://ftp.gnu.org/gnu/gdb/gdb-$version.tar.xz
    rm -rf gdb-$version
    tar xf gdb-$version.tar.xz
    mkdir -p gdb-$version/build
    cd gdb-$version/build
    
    # Get the Python executable and library directory
    [ -z "${PYTHON}" ] && export PYTHON=python3
    PYTHON_LIBDIR=$("${PYTHON}" -c \
        "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
    
    # Configure GDB
    ../configure \
        --prefix="$HOME/.local" \
        --target=$target \
        --with-python="${PYTHON}" \
        LDFLAGS="-L${PYTHON_LIBDIR}"
    
    # Build and install GDB
    make -j$(nproc)
    make -C gdb install
    

    GDB 将安装在 ~/.local/bin 中,如果您还没有安装,请将其添加到您的路径中。

    【讨论】:

      【解决方案2】:

      您可以在终端中运行此命令来安装 gdb

      sudo apt-get install gdb
      

      【讨论】:

      • 我的 Debian 上只安装了最小版本的 GDB (gdb-minimal)。 sudo apt install gdb 是解决方案。
      猜你喜欢
      • 2014-11-13
      • 2016-06-19
      • 1970-01-01
      • 1970-01-01
      • 2023-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-12
      相关资源
      最近更新 更多