Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Failure: unknown type name 'rd_kafka_broker_t' in rdkafka_op.h #4802

Closed
4 of 7 tasks
pertorvund opened this issue Aug 5, 2024 · 2 comments
Closed
4 of 7 tasks

Comments

@pertorvund
Copy link

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:

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"]

Expected Behaviour

The build should complete successfully without errors.

Actual Behavior

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'


Checklist

IMPORTANT: We will close issues where the checklist has not been completed.

Please provide the following information:

  • librdkafka version (release number or git tag): <REPLACE with e.g., v0.10.5 or a git sha. NOT "latest" or "current">
  • Apache Kafka version: <REPLACE with e.g., 0.10.2.3>
  • librdkafka client configuration: <REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..>
  • Operating system: <REPLACE with e.g., Centos 5 (x64)>
  • Provide logs (with debug=.. as necessary) from librdkafka
  • Provide broker log excerpts
  • Critical issue
@pertorvund
Copy link
Author

The dockerfile used to build perfectly fine untill the last couple of months where it now fails

@emasab
Copy link
Collaborator

emasab commented Aug 5, 2024

Duplicate of #4793

@emasab emasab marked this as a duplicate of #4793 Aug 5, 2024
@emasab emasab closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants