There is an issue on Void Linux packages issue tracker about this bug[1]
# Steps to verify the issue on a fresh Git clone of QEMU source
$ git clone https://github.com/qemu/qemu
$ cd qemu
$ make DEBUG=1 docker-test-misc@alpine
[...]
COPY RUNNER
RUN test-misc in qemu/alpine
* Prepared to run command:
./test-misc
* Hit Ctrl-D to continue, or type 'exit 1' to abort
The filename path substitution appears to be done in the file `pc-bios/descriptors/meson.build`.
In particular, occurrences of `@DATADIR@` in the template files get substituted using the value of `qemu_datadir`:
From the Meson documentation on built-in (build) options[2], `datadir` option gets initialized to `"share"` (note: a relative path!) by default, unless `datadir` build option is configured explicitly, so the value of `qemu_datadir`, as well as the substitution made ends up being a relative path as well.
I found a commit which I think is relevant to why this choice was made[3].
# Test a workaround, try #1: specify `datadir` manually
$ make DEBUG=1 docker-test-misc@alpine
[...]
bash-5.1$ configure_qemu --datadir=/usr/share --disable-system --disable-user
Configure options:
--enable-werror --prefix=/tmp/qemu-test/install --datadir=/usr/share --disable-system --disable-user
cross containers no
The Meson build system
Version: 0.56.2
Source dir: /tmp/qemu-test/src
Build dir: /tmp/qemu-test/src/tests/docker
Build type: native build
../../meson.build:1:0: ERROR: The value of the 'datadir' option is '/usr/share' which must be a subdir of the prefix '/tmp/qemu-test/install'.
Note that if you pass a relative path, it is assumed to be a subdir of prefix.
A full log can be found at /tmp/qemu-test/src/tests/docker/meson-logs/meson-log.txt
ERROR: meson setup failed
Ah! So perhaps `datadir` can be an absolute path, but then it must be a subdir of the (already specified) `prefix`.
Let's try again.
# Test a workaround, try #2: specify `datadir` as subdir of <prefix> manually
There is an issue on Void Linux packages issue tracker about this bug[1]
# Steps to verify the issue on a fresh Git clone of QEMU source
$ git clone https:/ /github. com/qemu/ qemu test-misc@ alpine
$ cd qemu
$ make DEBUG=1 docker-
[...]
COPY RUNNER
RUN test-misc in qemu/alpine
* Prepared to run command:
./test-misc
* Hit Ctrl-D to continue, or type 'exit 1' to abort
bash-5.1$ . common-rc /tmp/qemu- test/install --disable-system --disable-user test/src/ tests/docker descriptors/ * descriptors/ 50-edk2- i386-secure. json: "filename": "share/ qemu/edk2- i386-secure- code.fd" , descriptors/ 50-edk2- i386-secure. json: "filename": "share/ qemu/edk2- i386-vars. fd",
[...]
bash-5.1$ configure_qemu --disable-system --disable-user
Configure options:
--enable-werror --prefix=
cross containers no
The Meson build system
Version: 0.56.2
Source dir: /tmp/qemu-test/src
Build dir: /tmp/qemu-
Build type: native build
Project name: qemu
Project version: 5.2.50
[...]
bash-5.1$ grep filename pc-bios/
pc-bios/
pc-bios/
[...all other matches have relative paths...]
bash-5.1$ exit 1
[...]
# Research
The filename path substitution appears to be done in the file `pc-bios/ descriptors/ meson.build` .
In particular, occurrences of `@DATADIR@` in the template files get substituted using the value of `qemu_datadir`:
configure_ file(input: files(f),
output: f,
configuratio n: {'DATADIR': qemu_datadir},
install: get_option( 'install_ blobs') ,
install_ dir: qemu_datadir / 'firmware')
The variable `qemu_datadir` gets initialized from toplevel `meson.build` file using:
qemu_datadir = get_option( 'datadir' ) / get_option( 'qemu_suffix' )
From the Meson documentation on built-in (build) options[2], `datadir` option gets initialized to `"share"` (note: a relative path!) by default, unless `datadir` build option is configured explicitly, so the value of `qemu_datadir`, as well as the substitution made ends up being a relative path as well.
I found a commit which I think is relevant to why this choice was made[3].
# Test a workaround, try #1: specify `datadir` manually
$ make DEBUG=1 docker- test-misc@ alpine /usr/share --disable-system --disable-user /tmp/qemu- test/install --datadir= /usr/share --disable-system --disable-user test/src/ tests/docker
[...]
bash-5.1$ configure_qemu --datadir=
Configure options:
--enable-werror --prefix=
cross containers no
The Meson build system
Version: 0.56.2
Source dir: /tmp/qemu-test/src
Build dir: /tmp/qemu-
Build type: native build
../../meson. build:1: 0: ERROR: The value of the 'datadir' option is '/usr/share' which must be a subdir of the prefix '/tmp/qemu- test/install' .
Note that if you pass a relative path, it is assumed to be a subdir of prefix.
A full log can be found at /tmp/qemu- test/src/ tests/docker/ meson-logs/ meson-log. txt
ERROR: meson setup failed
Ah! So perhaps `datadir` can be an absolute path, but then it must be a subdir of the (already specified) `prefix`.
Let's try again.
# Test a workaround, try #2: specify `datadir` as subdir of <prefix> manually
$ make DEBUG=1 docker- test-misc@ alpine /tmp/qemu- test/install/ share --disable-system --disable-user /tmp/qemu- test/install --datadir= /tmp/qemu- test/install/ share --disable-system --disable-user descriptors/ * descriptors/ 50-edk2- i386-secure. json: "filename": "share/ qemu/edk2- i386-secure- code.fd" , descriptors/ 50-edk2- i386-secure. json: "filename": "share/ qemu/edk2- i386-vars. fd",
[...]
bash-5.1$ configure_qemu --datadir=
Configure options:
--enable-werror --prefix=
[...]
bash-5.1$ grep filename pc-bios/
pc-bios/
pc-bios/
bash-5.1$ exit 1
Getting there, but the paths are still relative, missing the initial `/`.
[1]: https:/ /github. com/void- linux/void- packages/ issues/ 27965 /mesonbuild. com/Builtin- options. html /github. com/qemu/ qemu/commit/ ab4c0996f80d43d 1fc28c6e76f4ecb 27423a7e29
[2]: https:/
[3]: https:/