You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kafka client version is: github.com/confluentinc/confluent-kafka-go/v2/[email protected]
error message is:
25.17 # runtime/cgo
25.17 gcc_arm64.S: Assembler messages:
25.17 gcc_arm64.S:30: Error: no such instruction: stp x29,x30,[sp,' 25.17 gcc_arm64.S:34: Error: operand size mismatch for mov'
25.17 gcc_arm64.S:36: Error: no such instruction: stp x19,x20,[sp,' 25.17 gcc_arm64.S:39: Error: no such instruction: stp x21,x22,[sp,'
25.17 gcc_arm64.S:42: Error: no such instruction: stp x23,x24,[sp,' 25.17 gcc_arm64.S:45: Error: no such instruction: stp x25,x26,[sp,'
25.17 gcc_arm64.S:48: Error: no such instruction: stp x27,x28,[sp,' 25.17 gcc_arm64.S:52: Error: operand size mismatch for mov'
25.17 gcc_arm64.S:53: Error: operand size mismatch for mov' 25.17 gcc_arm64.S:54: Error: operand size mismatch for mov'
25.17 gcc_arm64.S:56: Error: no such instruction: blr x20' 25.17 gcc_arm64.S:57: Error: no such instruction: blr x19'
25.17 gcc_arm64.S:59: Error: no such instruction: ldp x27,x28,[sp,' 25.17 gcc_arm64.S:62: Error: no such instruction: ldp x25,x26,[sp,'
25.17 gcc_arm64.S:65: Error: no such instruction: ldp x23,x24,[sp,' 25.17 gcc_arm64.S:68: Error: no such instruction: ldp x21,x22,[sp,'
25.17 gcc_arm64.S:71: Error: no such instruction: ldp x19,x20,[sp,' 25.17 gcc_arm64.S:74: Error: no such instruction: ldp x29,x30,[sp],'
Dockerfile:19
17 | go env -w GOPROXY=https://goproxy.cn,direct
18 |
19 | >>> RUN GOARCH=${TARGETARCH} CGO_ENABLED=1 GOOS=linux go build -tags musl -ldflags="-extldflags -static" -o cmd/bin/main cmd/analyzer/main.go
20 |
21 |
ERROR: failed to solve: process "/bin/sh -c GOARCH=${TARGETARCH} CGO_ENABLED=1 GOOS=linux go build -tags musl -ldflags="-extldflags -static" -o cmd/bin/main cmd/analyzer/main.go" did not complete successfully: exit code: 1
How to reproduce
FROM --platform=linux/amd64 golang:1.21.8-alpine3.18 AS builder
ARG GO_MODULES_USER
ARG GO_MODULES_PERSONAL_ACCESS_TOKEN
ARG TARGETARCH
WORKDIR /build
COPY . .
RUN echo -e "machine gitlab.bingex.com\nlogin ${GO_MODULES_USER} \npassword ${GO_MODULES_PERSONAL_ACCESS_TOKEN}" > ~/.netrc
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories &&
apk --no-cache update &&
apk --no-cache add git gcc libc-dev
@Jeremy-boo I understand that what you're trying to do is cross compile from an alpine linux amd64 builder, to an arm64 architecture. in this case, during the compilation step, the CC needs to be set to a cross compiler which can cross compile from your builder to your target architecture. This is required for the cgo bits of the library to be compiled.
For example, from glibc amd64 -> glibc arm64, I use CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 go build
Please try a cross compiler. I believe you will need aarch64-linux-musl-gcc from aarch64-linux-musl-cross available on the musl website. Similar to this answer.
Description
Build fails on arm64 architecture
kafka client version is: github.com/confluentinc/confluent-kafka-go/v2/[email protected]
error message is:
25.17 # runtime/cgo
25.17 gcc_arm64.S: Assembler messages:
25.17 gcc_arm64.S:30: Error: no such instruction:
stp x29,x30,[sp,' 25.17 gcc_arm64.S:34: Error: operand size mismatch for
mov'25.17 gcc_arm64.S:36: Error: no such instruction:
stp x19,x20,[sp,' 25.17 gcc_arm64.S:39: Error: no such instruction:
stp x21,x22,[sp,'25.17 gcc_arm64.S:42: Error: no such instruction:
stp x23,x24,[sp,' 25.17 gcc_arm64.S:45: Error: no such instruction:
stp x25,x26,[sp,'25.17 gcc_arm64.S:48: Error: no such instruction:
stp x27,x28,[sp,' 25.17 gcc_arm64.S:52: Error: operand size mismatch for
mov'25.17 gcc_arm64.S:53: Error: operand size mismatch for
mov' 25.17 gcc_arm64.S:54: Error: operand size mismatch for
mov'25.17 gcc_arm64.S:56: Error: no such instruction:
blr x20' 25.17 gcc_arm64.S:57: Error: no such instruction:
blr x19'25.17 gcc_arm64.S:59: Error: no such instruction:
ldp x27,x28,[sp,' 25.17 gcc_arm64.S:62: Error: no such instruction:
ldp x25,x26,[sp,'25.17 gcc_arm64.S:65: Error: no such instruction:
ldp x23,x24,[sp,' 25.17 gcc_arm64.S:68: Error: no such instruction:
ldp x21,x22,[sp,'25.17 gcc_arm64.S:71: Error: no such instruction:
ldp x19,x20,[sp,' 25.17 gcc_arm64.S:74: Error: no such instruction:
ldp x29,x30,[sp],'Dockerfile:19
17 | go env -w GOPROXY=https://goproxy.cn,direct
18 |
19 | >>> RUN GOARCH=${TARGETARCH} CGO_ENABLED=1 GOOS=linux go build -tags musl -ldflags="-extldflags -static" -o cmd/bin/main cmd/analyzer/main.go
20 |
21 |
ERROR: failed to solve: process "/bin/sh -c GOARCH=${TARGETARCH} CGO_ENABLED=1 GOOS=linux go build -tags musl -ldflags="-extldflags -static" -o cmd/bin/main cmd/analyzer/main.go" did not complete successfully: exit code: 1
How to reproduce
FROM --platform=linux/amd64 golang:1.21.8-alpine3.18 AS builder
ARG GO_MODULES_USER
ARG GO_MODULES_PERSONAL_ACCESS_TOKEN
ARG TARGETARCH
WORKDIR /build
COPY . .
RUN echo -e "machine gitlab.bingex.com\nlogin ${GO_MODULES_USER} \npassword ${GO_MODULES_PERSONAL_ACCESS_TOKEN}" > ~/.netrc
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories &&
apk --no-cache update &&
apk --no-cache add git gcc libc-dev
RUN go env -w GO111MODULE=on &&
go env -w GOPROXY=https://goproxy.cn,direct
RUN GOARCH=${TARGETARCH} CGO_ENABLED=1 GOOS=linux go build -tags musl -ldflags="-extldflags -static" -o cmd/bin/main cmd/analyzer/main.go
FROM alpine:3.13.5-iss
RUN mkdir /tmp/coupon-log-analyzer && touch /tmp/coupon-log-analyzer/coupon-log-analyzer.log && ln -sf /dev/stdout /tmp/coupon-log-analyzer/coupon-log-analyzer.log
COPY --from=builder /build/resources /resources
COPY --from=builder /build/cmd/bin/main ./main
CMD ./main
Checklist
Please provide the following information:
LibraryVersion()
):ConfigMap{...}
"debug": ".."
as necessary)The text was updated successfully, but these errors were encountered: