initia icon indicating copy to clipboard operation
initia copied to clipboard

Docker buildkit build for linux/amd64 failed on apple silicon machine.

Open qj0r9j0vc2 opened this issue 9 months ago • 0 comments

Describe the bug When I build initia binary, it throws below messages.

[+] Building 127.2s (18/22)                                                                                                                                                         docker-container:multi
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 2.99kB                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/golang:1.22-alpine3.19                                                                                                                             1.6s
 => [internal] load metadata for docker.io/library/debian:stable                                                                                                                                      2.2s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                                                         0.0s
 => [auth] library/debian:pull token for registry-1.docker.io                                                                                                                                         0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 83B                                                                                                                                                                      0.0s
 => [go-builder  1/10] FROM docker.io/library/golang:1.22-alpine3.19@sha256:f1fe698725f6ed14eb944dc587591f134632ed47fc0732ec27c7642adbe90618                                                          0.0s
 => => resolve docker.io/library/golang:1.22-alpine3.19@sha256:f1fe698725f6ed14eb944dc587591f134632ed47fc0732ec27c7642adbe90618                                                                       0.0s
 => [stage-1 1/5] FROM docker.io/library/debian:stable@sha256:82f8da149d6d567c74564cccd6f355fb5ade42a958e4cde10a1100eaeb24d42e                                                                        0.0s
 => => resolve docker.io/library/debian:stable@sha256:82f8da149d6d567c74564cccd6f355fb5ade42a958e4cde10a1100eaeb24d42e                                                                                0.0s
 => [internal] load build context                                                                                                                                                                     0.0s
 => => transferring context: 77.76kB                                                                                                                                                                  0.0s
 => CACHED [go-builder  2/10] RUN set -eux; apk add --no-cache ca-certificates build-base;                                                                                                            0.0s
 => CACHED [go-builder  3/10] RUN apk add git cmake                                                                                                                                                   0.0s
 => CACHED [go-builder  4/10] WORKDIR /code                                                                                                                                                           0.0s
 => [go-builder  5/10] COPY . /code/                                                                                                                                                                  0.4s
 => [go-builder  6/10] RUN git clone --depth 1 https://github.com/microsoft/mimalloc; cd mimalloc; mkdir build; cd build; cmake ..; make -j$(nproc); make install                                    11.3s
 => [go-builder  7/10] RUN set -eux;     case "amd64" in         "amd64") GOARCH="amd64"; ARCH="x86_64";;         "arm64") GOARCH="arm64"; ARCH="aarch64";;         *) echo "Unsupported architectur  7.8s
 => [go-builder  8/10] RUN cp /lib/libmovevm_muslc.`uname -m`.a /lib/libmovevm_muslc.a                                                                                                                0.3s
 => [go-builder  9/10] RUN cp /lib/libcompiler_muslc.`uname -m`.a /lib/libcompiler_muslc.a                                                                                                            0.3s
 => ERROR [go-builder 10/10] RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS="-linkmode=external -extldflags "-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static"" make build               104.9s
------
 > [go-builder 10/10] RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS="-linkmode=external -extldflags "-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static"" make build:

...

16.09 go: downloading github.com/go-logr/stdr v1.2.2
73.53 github.com/klauspost/compress/zstd/internal/xxhash: /usr/local/go/pkg/tool/linux_amd64/asm: signal: illegal instruction
104.4 make: *** [Makefile:118: build] Error 1
------
Dockerfile:49
--------------------
  47 |     
  48 |     # force it to use static lib (from above) not standard libmovevm.so and libcompiler.so file
  49 | >>> RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS="-linkmode=external -extldflags \"-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static\"" make build
  50 |     
  51 |     FROM debian:stable
--------------------
ERROR: failed to solve: process "/bin/sh -c LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS=\"-linkmode=external -extldflags \\\"-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static\\\"\" make build" did not complete successfully: exit code: 2

View build details: docker-desktop://dashboard/build/multi/multi0/z37x0nga561b20wbgw4261t21

To Reproduce Steps to reproduce the behavior:

Prepare on apple silicon machine.

  1. git clone && checkout v0.2.24
  2. docker buildx build --platform=linux/arm64,linux/amd64 --tag=$(YOUR_TAG) --push .

Expected behavior

it'll throw some errors for building image like here.

16.09 go: downloading github.com/go-logr/stdr v1.2.2
73.53 github.com/klauspost/compress/zstd/internal/xxhash: /usr/local/go/pkg/tool/linux_amd64/asm: signal: illegal instruction
104.4 make: *** [Makefile:118: build] Error 1
------
Dockerfile:49
--------------------
  47 |     
  48 |     # force it to use static lib (from above) not standard libmovevm.so and libcompiler.so file
  49 | >>> RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS="-linkmode=external -extldflags \"-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static\"" make build
  50 |     
  51 |     FROM debian:stable
--------------------
ERROR: failed to solve: process "/bin/sh -c LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS=\"-linkmode=external -extldflags \\\"-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static\\\"\" make build" did not complete successfully: exit code: 2

Screenshots don't need

Desktop (please complete the following information):

  • OS: MacOS Sonoma v14.3

qj0r9j0vc2 avatar May 18 '24 09:05 qj0r9j0vc2