Skip to content

Segmentation fault running go and rust examples #165

@k0pernicus

Description

@k0pernicus

Hi,

This issue is related to (I think) other issues with rust and go projects, but I wanted to ask the community if anyone, running macOS Apple Silicon, tried successfully to run kraft builds on QEMU on their mac?

My configuration is:

> kraft version
kraft 0.11.5 (fb79ed2205e3d9bd5143275972c4056f04d253a4) go1.24.0 2025-03-10T15:41:21Z

on macOS Sonoma 14.7.4 (23H420).

I have tried on several different examples and it seems related to go and rust examples only.

As an example, on http-rust1.75:

> kraft --log-level=debug --log-type=basic run --rm -p 8080:8080 --plat qemu --arch x86_64 -M 512M .

 D  kraftkit version=0.11.5
 D  determining how to proceed given provided input and context
 D  using compatible context candidate=kraftfile-runtime
 i  searching for base:latest
 D  querying catalog local=true name=base remote=false version=latest
 D  found unikraft.org/base:latest (qemu/x86_64) (7cf3e31, 3e7d076, qemu/x86_64, 1.7 MB)
 D  found 1/2 matching packages in oci catalog
 D  querying manifest catalog local=true name=base remote=false version=latest
 D  found 0/0 matching packages in manifest catalog
 W  using hardware emulation
 i  using arch=x86_64 plat=qemu
 i  building rootfs via Dockerfile (x86_64)
 D  using buildkit addr=podman-container://buildkit version=v0.20.0
 D  could not find SSH agent socket path=/private/tmp/com.apple.launchd.92kj6clh4l/Listeners
 i  #1 [internal] load build definition from Dockerfile
 i  #1 transferring dockerfile: 463B done
 i  #1 DONE 0.0s
 i
 i  #2 [internal] load metadata for docker.io/library/rust:1.75.0-bookworm
 i  #2 DONE 2.2s
 i
 i  #3 [internal] load .dockerignore
 i  #3 transferring context: 2B done
 i  #3 DONE 0.0s
 i
 i  #4 [build 1/4] FROM docker.io/library/rust:1.75.0-bookworm@sha256:87f3b2f93b82995443a1a558c234212dafe79cfdc3af956539610560369ddcd0
 i  #4 resolve docker.io/library/rust:1.75.0-bookworm@sha256:87f3b2f93b82995443a1a558c234212dafe79cfdc3af956539610560369ddcd0 done
 i  #4 DONE 0.0s
 i
 i  #5 [internal] load build context
 i  #5 transferring context: 68B done
 i  #5 DONE 0.0s
 i
 i  #6 [build 2/4] WORKDIR /src
 i  #6 CACHED
 i
 i  #7 [build 3/4] COPY ./server.rs /src/server.rs
 i  #7 CACHED
 i
 i  #8 [build 4/4] RUN set -xe;     rustc -o /server /src/server.rs
 i  #8 0.104 + rustc -o /server /src/server.rs
 i  #8 0.594 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
 i  #8 0.647 Segmentation fault (core dumped)
 i  #8 ERROR: process "/dev/.buildkit_qemu_emulator /bin/sh -c set -xe;     rustc -o /server /src/server.rs" did not complete successfully: exit code: 139
 i  ------
 i   > [build 4/4] RUN set -xe;     rustc -o /server /src/server.rs:
 i  rustc -o /server /src/server.rs
 i  0.594 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
 i  0.647 Segmentation fault (core dumped)
 i  ------
 E  could not wait for err group: could not solve: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c set -xe;     rustc -o /server /src/server.rs" did not complete successfully: exit code: 139
 E  could not wait for err group: could not solve: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c set -xe;     rustc -o /server /src/server.rs" did not complete successfully: exit code: 139

For the Rust samples, it seems related to those issues:

  1. Build failure in x86 container on M1 chips rust-lang/rust#96479
  2. Docker Preview M1 rustc "error: internal compiler error: unexpected panic" rust-lang/rust#80346

For the Go sample, it seems related to this specific issue: golang/go#69255

I tried the helloworld-c and helloworld-zig and those run perfectly.

I do think those issues are related to qemu, but I don't really know how to debug the kraft while building it...
Can anyone help me on that subject please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions