Closed pertorvund closed 3 months ago
I encountered a build error while compiling librdkafka as part of my Docker build process. The error seems related to an unknown type rd_kafka_broker_t.
Docker Image: golang:1.22.5-alpine3.20 librdkafka Version: Latest commit from https://github.com/edenhill/librdkafka.git Build Tools: gcc, make, pkgconf, git, bash, sudo
Do docker build on the following Dockerfile:
FROM public.ecr.aws/docker/library/golang:1.22.5-alpine3.20 as build ENV GO111MODULE=on ENV CGO_ENABLED=1 ENV GOOS=linux ENV GOARCH=amd64 WORKDIR /go/src COPY go.mod . COPY go.sum . COPY schemas . RUN go mod download RUN apk -U add ca-certificates RUN apk update && apk upgrade && apk add pkgconf git bash build-base sudo RUN git clone https://github.com/edenhill/librdkafka.git && cd librdkafka && ./configure --prefix /usr && make && make install COPY . . RUN go test -tags musl --ldflags "-extldflags -static" ./... RUN go build -tags musl --ldflags "-extldflags -static" -o app . FROM gcr.io/distroless/static COPY --from=build /go/src/app /app ENTRYPOINT ["/app"]
The build should complete successfully without errors.
The build fails with the following error:
gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -DLIBRDKAFKA_GIT_VERSION="\"v2.5.0\"" -I. -c rdkafka.c -o rdkafka.o In file included from rdkafka_int.h:110, from rdkafka.c:43: rdkafka_op.h:696:25: error: unknown type name 'rd_kafka_broker_t' 696 | rd_kafka_broker_t *rkb; | ^~~~~~~~~~~~~~~~~ rdkafka.c: In function 'rd_kafka_poll_cb': rdkafka.c:4093:52: warning: passing argument 2 of 'rd_kafka_set_telemetry_broker_maybe' from incompatible pointer type [-Wincompatible-pointer-types] 4093 | rk, rko->rko_u.telemetry_broker.rkb); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ | | | int * In file included from rdkafka.c:49: rdkafka_telemetry.h:51:61: note: expected 'rd_kafka_broker_t *' {aka 'struct rd_kafka_broker_s *'} but argument is of type 'int *' 51 | rd_kafka_broker_t *rkb); | ~~~~~~~~~~~~~~~~~~~^~~ make[1]: *** [../mklove/Makefile.base:97: rdkafka.o] Error 1 make[1]: Leaving directory '/go/src/librdkafka/src'
IMPORTANT: We will close issues where the checklist has not been completed.
Please provide the following information:
<REPLACE with e.g., v0.10.5 or a git sha. NOT "latest" or "current">
<REPLACE with e.g., 0.10.2.3>
<REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..>
<REPLACE with e.g., Centos 5 (x64)>
debug=..
The dockerfile used to build perfectly fine untill the last couple of months where it now fails
Duplicate of #4793
Description
I encountered a build error while compiling librdkafka as part of my Docker build process. The error seems related to an unknown type rd_kafka_broker_t.
Environment
Docker Image: golang:1.22.5-alpine3.20 librdkafka Version: Latest commit from https://github.com/edenhill/librdkafka.git Build Tools: gcc, make, pkgconf, git, bash, sudo
How to reproduce
Do docker build on the following Dockerfile:
Expected Behaviour
The build should complete successfully without errors.
Actual Behavior
The build fails with the following error:
Checklist
IMPORTANT: We will close issues where the checklist has not been completed.
Please provide the following information:
<REPLACE with e.g., v0.10.5 or a git sha. NOT "latest" or "current">
<REPLACE with e.g., 0.10.2.3>
<REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..>
<REPLACE with e.g., Centos 5 (x64)>
debug=..
as necessary) from librdkafka