#911

main (post-#886) GPU+FFI build fails on macOS: virglrenderer-krun missing virgl_renderer_resource_map_fixed (needs virglrenderer >= 1.3.0)

Openraghavendra-natarajopened 23d ago

Summary

Building libkrun from main (past #886, "virtio/gpu: offer VIRTIO_GPU_F_BLOB_ALIGNMENT when booting firmware") with the gpu + ffi features on macOS fails to link against the only macOS-compatible Venus-capable renderer, virglrenderer-krun (the fork used by the Homebrew libkrun/krun tap). This means the Apple Silicon host/guest page-size fix in #886 currently can't actually be built and tested on macOS with GPU support.

Environment

  • macOS, Apple Silicon (arm64)
  • krunkit 1.3.2, libkrun main @ commit past 51367cf (the #886 merge)
  • virglrenderer-krun 0.10.4e (from libkrun/homebrew-krun, built from gitlab.freedesktop.org/slp/virglrenderer tag 0.10.4e-krunkit)

Steps to reproduce

git clone https://github.com/libkrun/libkrun.git
cd libkrun
export PKG_CONFIG_PATH=/opt/homebrew/Cellar/virglrenderer-krun/0.10.4e/lib/pkgconfig:...
make BLK=1 NET=1 GPU=1 TIMESYNC=1 FFI=1

What happens

rutabaga_gfx's build.rs gates on pkg_config::Config::new().atleast_version("1.3.0").probe("virglrenderer"). virglrenderer-krun's .pc file reports Version: 0.10.4, so this fails outright.

Overriding the .pc version string to bypass that gate (just to see how far the build gets) surfaces the real issue — the build gets much further, then fails at link time:

Undefined symbols for architecture arm64:
  "_virgl_renderer_resource_map_fixed", referenced from:
      ...rutabaga_gfx::virgl_renderer::VirglRenderer::...::map_placed in librutabaga_gfx...
ld: symbol(s) not found for architecture arm64

Root cause

virgl_renderer_resource_map_fixed is a real API added in upstream virglrenderer 1.3.0 (per the 1.3.0 release notes). virglrenderer-krun (slp/virglrenderer @ 0.10.4e-krunkit) is based on a pre-1.3.0 upstream snapshot and genuinely does not have this symbol — this isn't just a stale version string, the function doesn't exist in the fork at all. So the atleast_version("1.3.0") check in rutabaga_gfx is actually correct/necessary here, it's just that there is currently no build of virglrenderer-krun that is both Venus/MoltenVK-capable and based on virglrenderer >= 1.3.0.

Impact

Anyone on macOS trying to build current libkrun main with GPU support is blocked, including testing #886 itself (which specifically targets the Apple Silicon 16 KiB host / 4 KiB guest page-size mismatch — i.e. exactly the macOS case). Right now there's no way to actually exercise that fix on macOS without someone porting slp/virglrenderer's krunkit-specific (Venus + MoltenVK) patches onto a virglrenderer >= 1.3.0 base.

Question

Is there a planned rebase of virglrenderer-krun onto a newer upstream virglrenderer base? If this is already known/tracked somewhere, apologies for the duplicate — happy to help test once a rebuilt virglrenderer-krun is available.

Activity

1
slp17d ago

This is a known issue. Before 2.x, we'll introduce changes to minimize the changes in virglrenderer and rebase on its latest release.