在Docker中的Python Slim映像中安装GDB

在Docker中的Python Slim映像中安装GDB,docker,gdb,Docker,Gdb,我需要在Docker容器中安装pip cfgrib,以便使用xarray读取.grib文件。为了安装cfgrib,我需要ECCODE。要获得ECCODE,显然我需要一个需要gdb的fortran编译器 安装gdb被证明是有问题的。根据文档,我遇到了一个我不完全理解的错误: amd64-linux-nat.c:248:1: error: conflicting types for ‘ps_get_thread_area’ ps_get_thread_area (const struct ps_p

我需要在Docker容器中安装pip cfgrib,以便使用xarray读取.grib文件。为了安装cfgrib,我需要ECCODE。要获得ECCODE,显然我需要一个需要gdb的fortran编译器

安装gdb被证明是有问题的。根据文档,我遇到了一个我不完全理解的错误:

amd64-linux-nat.c:248:1: error: conflicting types for ‘ps_get_thread_area’
 ps_get_thread_area (const struct ps_prochandle *ph,
 ^~~~~~~~~~~~~~~~~~
In file included from gdb_proc_service.h:30,
                 from amd64-linux-nat.c:30:
/usr/include/proc_service.h:72:17: note: previous declaration of ‘ps_get_thread_area’ was here
 extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
                 ^~~~~~~~~~~~~~~~~~
make[2]: Leaving directory '/gdb-7.11/gdb'
make[2]: *** [Makefile:1141: amd64-linux-nat.o] Error 1
make[1]: Leaving directory '/gdb-7.11'
make[1]: *** [Makefile:9157: all-gdb] Error 2
make: *** [Makefile:847: all] Error 2 
包括我的Dockerfile

FROM python:3.7-slim

RUN apt update && \
    apt-get install -y cmake libgtest-dev libboost-test-dev && rm -rf /var/lib/apt/lists/*
    
COPY eccodes-2.18.0-Source.tar.gz .

# install gdb - this is where I am getting a problem
ADD "http://ftp.gnu.org/gnu/gdb/gdb-7.11.tar.gz" gdb-7.11.tar.gz 
RUN tar -xvzf gdb-7.11.tar.gz &&\
    cd gdb-7.11 && ./configure && make &&\
    make install &&\
    cd ..\

#install fortran compiler
RUN apt-get install -y gcc-gfortran 
RUN tar -xzf  eccodes-2.18.0-Source.tar.gz
RUN cmake -DCMAKE_INSTALL_PREFIX=. ../eccodes-2.18.0-Source

RUN pip install xarray

RUN pip install eccodes-python

RUN pip install cfgrib

您的链接让您下载了GDB7.11,它比DebianBuster更早(python:3.7-slim下载就是这个版本)。这个声明冲突似乎是在Linux头文件被更改时出现的,并且在gdb中通过将
ps\u-get\u-thread\u区域(const-struct-ps\u-prochhandle*ph
更改为
ps\u-get\u-thread\u区域(struct-ps\u-prochhandle*ph
)来修复的。您可以使用gdb的最新版本,比如9.2吗?或者,您可以编辑(比如使用sed)amd64 linux nat.c进行了更改。您的链接引导您下载了gdb 7.11,它比Debian Buster(这是python:3.7-slim下载的版本)更早。这看起来像是linux头文件更改时出现的声明冲突,并通过更改
ps_get_thread_区域在gdb中得到修复(const-struct-ps\u-prochhandle*ph
ps\u-get\u-thread\u区域(struct-ps\u-prochhandle*ph
)。您可以使用gdb的最新版本,如9.2吗?或者,您可以编辑(比如说,使用sed)amd64 linux nat.c来进行更改。