ktock / container2wasm

Container to WASM converter
https://ktock.github.io/container2wasm-demo/
Apache License 2.0
1.97k stars 72 forks source link

Failed to build qemu-tci on emscripten. #285

Closed yomaytk closed 2 months ago

yomaytk commented 3 months ago

Description

I tried to use the qemu-tci on emscripten on the commit: 788e909f3e702bbd7209fa86037cbd8cfb444e36, and followed the commands of the README.md.

However, I got an error exec /bin/sh: no such file or directory as follows when I executed ./out/c2w --assets=. --to-js --build-arg OPTIMIZATION_MODE=native --target-arch=aarch64 alpine:3.19 /tmp/out-js4/htdocs/, and it seems that I failed to execute /bin/sh in the ubuntu:22.04 base image.

Could you give me some advice?🙏

Error details ```bash ... #19 [rootfs-aarch64-dev 2/9] RUN apt-get update -y && apt-get install -y mkisofs #19 0.210 exec /bin/sh: no such file or directory #19 ERROR: process "/bin/sh -c apt-get update -y && apt-get install -y mkisofs" did not complete successfully: exit code: 1 #20 [gcc-aarch64-linux-gnu-base 2/2] RUN apt-get update && apt-get install -y gcc-aarch64-linux-gnu linux-libc-dev-arm64-cross git make #20 0.221 exec /bin/sh: no such file or directory #20 ERROR: process "/bin/sh -c apt-get update && apt-get install -y gcc-aarch64-linux-gnu linux-libc-dev-arm64-cross git make" did not complete successfully: exit code: 1 #13 [golang-base 1/1] FROM docker.io/library/golang:1.21-bullseye@sha256:6815d296f20c3cb3afa67bf5dc862a831b6080f5dd8b5b423bb5f862539299de #13 sha256:3d53ef4019fc129ba03f90790f8f7f28fd279b9357cf3a71423665323b8807d3 55.10MB / 55.10MB 6.7s done #13 CANCELED #17 [glib-emscripten-base 1/6] FROM docker.io/emscripten/emsdk:3.1.40@sha256:c1e807a6e03ac5bd5b37bae2ace3c46c08579e2ddeb951037a3b8dac7067f2cc #17 sha256:8b795d8f70cabbff9c390138dc5ec98b1d2cf5c8af157991ed028b2fce6292ba 247.49MB / 397.30MB 6.7s #17 sha256:a128c619347831c893bb6823ab47c91deb0591459722f505047f74247949fc41 203.42MB / 225.32MB 6.7s ------ > [gcc-aarch64-linux-gnu-base 2/2] RUN apt-get update && apt-get install -y gcc-aarch64-linux-gnu linux-libc-dev-arm64-cross git make: 0.221 exec /bin/sh: no such file or directory ------ ------ > [rootfs-aarch64-dev 2/9] RUN apt-get update -y && apt-get install -y mkisofs: 0.210 exec /bin/sh: no such file or directory ------ Dockerfile:298 -------------------- 296 | 297 | FROM ubuntu:22.04 AS gcc-aarch64-linux-gnu-base 298 | >>> RUN apt-get update && apt-get install -y gcc-aarch64-linux-gnu linux-libc-dev-arm64-cross git make 299 | 300 | FROM gcc-aarch64-linux-gnu-base AS linux-aarch64-dev-common -------------------- ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y gcc-aarch64-linux-gnu linux-libc-dev-arm64-cross git make" did not complete successfully: exit code: 1 exit status 1 ```

Environment

$ lsb_release -a
Linux *** 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May  7 11:19:33 UTC 2 aarch64 aarch64 aarch64 GNU/Linux

$ go version
go version go1.20 linux/arm64

$ docker --version
Docker version 26.1.3, build b72abbb

$ docker buildx version
github.com/docker/buildx v0.14.0 171fcbe
ktock commented 3 months ago

@yomaytk Thanks for reporting the issue. Possible solutions:

yomaytk commented 3 months ago

@ktock Thank you for giving the some solutions.

It worked by the solution B. Thanks. However, I executed the conversion (./out/c2w --assets=. --to-js --build-arg OPTIMIZATION_MODE=native --target-arch=aarch64 alpine:3.19 /tmp/out-js4/htdocs/) with root user because I failed to mknod in the rootfs-aarch64-dev image. Can I execute without sudo?

ktock commented 3 months ago

It worked by the solution B.

:+1:

I failed to mknod in the rootfs-aarch64-dev image. Can I execute without sudo?

Are you running BuildKit as rootless mode (i.e. inside user namespace)? I don't think mknod is possible inside user namespace.

yomaytk commented 2 months ago

@ktock Thanks for the advice, and I'm sorry for the late reply.

Are you running BuildKit in rootless mode (i.e. inside the user namespace)? I don't think mknod is possible inside user namespace.

As you said, I used the buildkit with rootless mode, and it worked without rootless mode. Thanks!

yomaytk commented 2 months ago

I will close this issue because it is resolved.