3

I have build qemu-7.2.0 and then, when running it I am getting

qemu-system-x86_64: -nic user,model=virtio: network backend 'user' is not compiled into this binary

Apparently, I should enable this feature during build, but how to know which is it namely?

Dims
  • 47,675
  • 117
  • 331
  • 600

2 Answers2

7

The 'user' networking backend is provided by the 'slirp' library; you get this message when the QEMU binary was built without slirp support compiled in.

As noted in the 7.2 changelog, QEMU no longer ships a copy of the slirp module with its sources. Instead you need to make sure you have installed your distro's libslirp development package (which is probably called libslirp-devel or libslirp-dev or something similar) before configuring and building QEMU. You need at least libslirp 4.7 or better.

QEMU's configure convention for optional features which require some build-time dependency is:

  • by default, check for the dependency, and build in the feature if we find it
  • if --enable-foo is passed, check for the dependency, and fail configure with an error if it is missing
  • if --disable-foo is passed, don't check, and never build in the feature

So you can pass configure --enable-slirp to force it to give you an error if you haven't got the dependency, as a way of checking that you've installed the right system package for libslirp.

Peter Maydell
  • 9,707
  • 1
  • 19
  • 25
  • 1
    Can you elaborate please, where did `slirp` arose from? – Dims Mar 09 '23 at 14:37
  • 1
    It's a library that was originally part of QEMU proper but has been spun out into its own project : https://gitlab.freedesktop.org/slirp/libslirp – Peter Maydell Mar 09 '23 at 15:16
  • But how is it related to my question? `slirp` is not mentionned in error message – Dims Mar 10 '23 at 09:48
  • 1
    slirp is the library that provides the 'user' networking backend – Peter Maydell Mar 10 '23 at 10:15
  • How is it knowable? I think other times I didn't do anything, but `user` network was working? Can it be? – Dims Mar 10 '23 at 10:58
  • 1
    If you were using an older QEMU it had the submodule so it would have automatically compiled it in. Now it doesn't, so you need to install the dependency. I agree that the error message is a bit unhelpful. – Peter Maydell Mar 10 '23 at 13:29
  • 1
    @Peter - thanks for keeping QEMU cats corralled! – dturvene Jun 21 '23 at 15:14
0

$ git clone https://gitlab.com/qemu-project/qemu.git

$ sudo apt-get install git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev ninja-build meson

$ git clone https://gitlab.freedesktop.org/slirp/libslirp.git

$ cd libslirp

$ meson build

$ ninja -C build install

$ cd ..

$ cd qemu

$ mkdir -p bin/debug/native

$ cd bin/debug/native

$ ../../.././configure --enable-slirp --enable-debug

$ make -j$(nproc)

$ make install

$ cd ../../..

vince
  • 11
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 28 '23 at 00:36