Trying to build Qemu from source to run kvm. I am following the instructions from https://wiki.qemu.org/Hosts/Linux. This resulting following error message.

block/file-posix.c:67:21: fatal error: scsi/sg.h: No such file or directory compilation terminated.

CC block/nbd-client.o

qemu/rules.mak:69: recipe for target 'block/file-posix.o' failed

I can locate the header file in /usr/src/linux-headers-4.13.0-41/include/scsi/sg.h. What could be the reason of failure.

  • 1
    AFAIK it should be in /usr/include - provided by libc6-dev – steeldriver Jun 13 '18 at 4:47
  • Thanks @steeldriver . Reinstalling libc6-dev did not put appropriate header in /usr/include. What can I do to resolve it? – Proy Jun 13 '18 at 5:07
  • What version of Ubuntu is this? – steeldriver Jun 13 '18 at 5:22
  • 1
    In that case I don't understand why it's not there - packages.ubuntu.com/xenial/amd64/libc6-dev/filelist – steeldriver Jun 13 '18 at 5:26
  • 1
    Installing the debian package(libc6-dev_2.23-0ubuntu10_amd64.deb) resolved the issue. Thanks. – Proy Jun 13 '18 at 6:37

You can use apt to start at the way it is usually built for packaging. The error you mention seems just like missing dependencies, which you'd automatically pull in via

apt-get build-dep qemu

One has to realize that this is for the config that the Distribution builds qemu. So you might either get the source as used by the Distro and check debian/rules what is done.

# for Xenial it will be 2.5
apt install dpkg-dev
apt-get source qemu
vim qemu-2.5+dfsg/debian/rules

Or you can check any release build log (and thereby effective configure call) from qemu package to e.g. the build log of xenial To do so click on the version you want, then the architetcture you are interested and then on "buildlog".

From there you can start to derive/modify as you need it.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.