go-ceph icon indicating copy to clipboard operation
go-ceph copied to clipboard

[ERROR] could not determine kind of name for C.XXX while Docker build

Open shaekhhasanshoron opened this issue 6 years ago • 5 comments

I was facing the following issue while docker build. Please, can anyone give me any solution?

# github.com/ceph/go-ceph/rbd
/go/pkg/mod/github.com/ceph/[email protected]/rbd/rbd_nautilus.go:38:8: could not determine kind of name for C.rbd_image_spec_list_cleanup
/go/pkg/mod/github.com/ceph/[email protected]/rbd/rbd_nautilus.go:33:19: could not determine kind of name for C.rbd_image_spec_t
/go/pkg/mod/github.com/ceph/[email protected]/rbd/rbd_nautilus.go:23:9: could not determine kind of name for C.rbd_list2

This is my Dockerfile

FROM golang:latest as builder
RUN apt-get update && \
  apt-get install -y ceph libcephfs-dev librados-dev librbd-dev && \
  apt-get install librados2 && \
  apt-get install curl && \
  apt-get install gcc g++

WORKDIR /app
COPY go.mod go.sum ./

RUN go mod download
COPY . .
RUN go build -o /app/bin/go-ceph .

FROM golang:latest
RUN apt-get update && \
  apt-get install -y ceph libcephfs-dev librados-dev librbd-dev && \
  apt-get install librados2 && \
  apt-get install curl && \
  apt-get install gcc g++

WORKDIR /app
COPY --from=builder /app/bin /app
COPY --from=builder /app/ceph.conf /app/ceph.conf

# Run the executable
CMD ["./go-ceph"]

shaekhhasanshoron avatar Apr 01 '20 19:04 shaekhhasanshoron

Without digging into your base container I'm going to guess that whatever debian or ubuntu version that golang:latest is based on ships an older version of ceph than nautilus.

If that's the case you have a few choices I can think of off the top of my head:

  • Use build tags (example here) to choose either luminous or mimic
  • Install ceph packages from one of the ceph repos rather than debian/ubuntu
  • Use a different base container image (you don't have to use the "golang" image just because you are building go code)

phlogistonjohn avatar Apr 01 '20 19:04 phlogistonjohn

Without digging into your base container I'm going to guess that whatever debian or ubuntu version that golang:latest is based on ships an older version of ceph than nautilus.

If that's the case you have a few choices I can think of off the top of my head:

  • Use build tags (example here) to choose either luminous or mimic
  • Install ceph packages from one of the ceph repos rather than debian/ubuntu
  • Use a different base container image (you don't have to use the "golang" image just because you are building go code)

Thank you so much @phlogistonjohn for your suggestion. Yes, it worked after changing the base container from golang to ceph/daemon-base.

shaekhhasanshoron avatar Apr 02 '20 08:04 shaekhhasanshoron

Good to hear. Sounds like we can close this issue.

phlogistonjohn avatar Apr 02 '20 10:04 phlogistonjohn

can i ask which image tag of ceph/daemon-base you use? when i use the latest tag, i receive the error 'rados/librados.h no such file or directory'. Also i can't yum install librados-dev package.

lion19890901 avatar Jul 05 '23 01:07 lion19890901

We no longer use ceph/daemon-base directly. The images we use are either quay.io/ceph/ceph or quay.ceph.io/ceph-ci/ceph depending if we're testing against a released or unreleased version of ceph (respectively).

You're replying to an issue that was closed three years ago. I request that if you want to continue this conversation and/or need help with building with go-ceph, please start a new issue or discussion. I will not reply further in this thread.

phlogistonjohn avatar Jul 05 '23 14:07 phlogistonjohn