Failed (`could not compile cap-primitives (lib) due to 2 previous errors`)
imxade opened this issue · 2 comments
imxade commented
what I did:
$ c2w -v
c2w version 0.5.2
$ tree /tmp/testctx/
/tmp/testctx
├── Dockerfile
├── requirements.txt
└── test.py
$ cat /tmp/testctx/Dockerfile
FROM python:3
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY test.py .
CMD ["python", "test.py"]
$ cat /tmp/testctx/test.py
print("Hello, world");
$ docker build -t test-py /tmp/testctx/
$ c2w --target-arch=amd64 test-py /tmp/out/python.wasm
log:
#50 [bochs-dev-common 8/25] RUN git clone https://github.com/bytecodealliance/wizer && cd wizer && git checkout "04e49c989542f2bf3a112d60fbf88a62cce2d0d0" && cargo build --bin wizer --all-features && mkdir -p /tools/wizer/ && mv include target/debug/wizer /tools/wizer/ && cargo clean
#50 ERROR: process "/bin/sh -c git clone https://github.com/bytecodealliance/wizer && cd wizer && git checkout \"${WIZER_VERSION}\" && cargo build --bin wizer --all-features && mkdir -p /tools/wizer/ && mv include target/debug/wizer /tools/wizer/ && cargo clean" did not complete successfully: exit code: 101
#49 [linux-amd64-dev 4/4] RUN make ARCH=x86 CROSS_COMPILE=x86_64-linux-gnu- -j$(nproc) all && mkdir /out && mv /work-buildlinux/linux/arch/x86/boot/bzImage /out/bzImage && make clean
#49 427.0 CC arch/x86/kernel/ptrace.o
#49 CANCELED
------
> [bochs-dev-common 8/25] RUN git clone https://github.com/bytecodealliance/wizer && cd wizer && git checkout "04e49c989542f2bf3a112d60fbf88a62cce2d0d0" && cargo build --bin wizer --all-features && mkdir -p /tools/wizer/ && mv include target/debug/wizer /tools/wizer/ && cargo clean:
287.7 Compiling fs-set-times v0.15.0
288.8 Compiling object v0.26.2
297.9 Compiling wasmtime-runtime v0.35.3
300.8 Compiling ittapi-rs v0.2.0
301.3 Compiling ipnet v2.3.1
302.0 Compiling cpp_demangle v0.3.3
304.1 Compiling maybe-owned v0.3.4
304.2 Compiling rustc-demangle v0.1.21
: could not compile `cap-primitives` (lib) due to 2 previous errors
308.4 warning: build failed, waiting for other jobs to finish...
------
Dockerfile:435
--------------------
434 | WORKDIR /work/
435 | >>> RUN git clone https://github.com/bytecodealliance/wizer && \
436 | >>> cd wizer && \
437 | >>> git checkout "${WIZER_VERSION}" && \
438 | >>> cargo build --bin wizer --all-features && \
439 | >>> mkdir -p /tools/wizer/ && \
440 | >>> mv include target/debug/wizer /tools/wizer/ && \
441 | >>> cargo clean
442 |
--------------------
ERROR: failed to solve: process "/bin/sh -c git clone https://github.com/bytecodealliance/wizer && cd wizer && git checkout \"${WIZER_VERSION}\" && cargo build --bin wizer --all-features && mkdir -p /tools/wizer/ && mv include target/debug/wizer /tools/wizer/ && cargo clean" did not complete successfully: exit code: 101
exit status 1
ktock commented
@imxade Thanks for reporting this. Fixing in #184.
If you want to try the patch now, try the following:
$ c2w --show-dockerfile > /tmp/org-dockerfile
$ cat <<'EOF' > /tmp/dockerfile.diff
--- a/Dockerfile
+++ b/Dockerfile
@@ -204,7 +204,7 @@ COPY --link --from=linux-riscv64-dev /out/Image /pack/Image
COPY --link --from=rootfs-riscv64-dev /out/rootfs.bin /pack/rootfs.bin
COPY --link --from=tinyemu-config-dev /out/tinyemu.config /pack/config
-FROM rust:1-buster AS tinyemu-dev-common
+FROM rust:1.74.1-buster AS tinyemu-dev-common
ARG WASI_VFS_VERSION
ARG WASI_SDK_VERSION
ARG WASI_SDK_VERSION_FULL
@@ -408,7 +408,7 @@ COPY --link --from=bios-amd64-dev /out/ /pack/
COPY --link --from=rootfs-amd64-dev /out/rootfs.bin /pack/
COPY --link --from=bochs-config-dev /out/bochsrc /pack/
-FROM rust:1-buster AS bochs-dev-common
+FROM rust:1.74.1-buster AS bochs-dev-common
ARG WASI_VFS_VERSION
ARG WASI_SDK_VERSION
ARG WASI_SDK_VERSION_FULL
EOF
$ patch -o /tmp/new-dockerfile /tmp/org-dockerfile /tmp/dockerfile.diff
patching file /tmp/new-dockerfile (read from /tmp/org-dockerfile)
$ c2w --dockerfile /tmp/new-dockerfile alpine:3.18 /tmp/out/out.wasm
ktock commented
#184 has been merged.
EDIT: the patch is included since v0.5.3 https://github.com/ktock/container2wasm/releases/tag/v0.5.3