Qt Creator - 所选择的GDB构建不支持Python脚本。

问题描述 投票:0回答:1

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

enter image description here

我使用的是官方的标准GDB 树莓派工具链 (tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gdb).

那么到底是什么问题呢?为什么我用C++,GDB却需要Python脚本?

qt gdb qt-creator
1个回答
2
投票

我通常从源码中构建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所以,如果你还没有把它添加到你的路径上。

© www.soinside.com 2019 - 2024. All rights reserved.