简体   繁体   中英

stdint.h not found in Alpine docker image

I am getting a error: no include path in which to search for stdint.h error message when building a docker image from alpine:edge, that leads to other errors like unknown type name 'uint32_t' and failure when compiling a program.

As far as I understand, stdint.h is part of the C++ standard library and should be present, unless there is something broken within alpine:edge , which I don't think will be the case.

My docker image is the following:

FROM alpine:edge

RUN apk update && apk add \
        git \
        make \
        gcc \
        python3 \
        ldc \
        && git clone --recursive https://github.com/lomereiter/sambamba.git \
        && cd sambamba \
        && make \
        && mv sambamba /usr/local/bin/ \
        && cd ../.. \
        && rm -r sambamba

WORKDIR /wd
ENTRYPOINT ["/usr/local/bin/sambamba"]

Note that the image alpine:edge is necessary, because the ldc package is only available on it. How to fix this? Why isn't stdint.h found?

To successfully compile Sambamba, you need some additional packages:

  • g++ (for the C++ compiler and includes)
  • zlib
  • zlib-dev (for the zlib Header files)

Overall, this modified Dockerfile should do the trick:

FROM alpine:edge

RUN apk update && apk add \
        git \
        make \
        gcc \
        g++ \
        zlib \
        zlib-dev \
        python3 \
        ldc \
        && git clone --recursive https://github.com/lomereiter/sambamba.git \
        && cd sambamba \
        && make \
        && mv sambamba /usr/local/bin/ \
        && cd ../.. \
        && rm -r sambamba

WORKDIR /wd
ENTRYPOINT ["/usr/local/bin/sambamba"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM