geohot / qira

QEMU Interactive Runtime Analyser
MIT License
3.92k stars 471 forks source link

QEMU build error "static declaration of ‘memfd_create’ follows non-static declaration" #234

Open aumars opened 5 years ago

aumars commented 5 years ago

I'm currently writing a PKGBUILD on qira for the Arch Linux distribution. Currently, it packages qira using the official install.sh script. It attempts to install QEMU even though I have the qemu Arch Linux package and outputs the following error:

...
NUMA host support yes
tcmalloc support  no
jemalloc support  no
  GEN   config-host.h
  GEN   trace/generated-tracers.h
  GEN   trace/generated-helpers-wrappers.h
  GEN   trace/generated-tcg-tracers.h
  GEN   trace/generated-helpers.h
    CHK version_gen.h
  LINK  tests/qemu-iotests/socket_scm_helper
  GEN   qemu-doc.html
  GEN   qemu.1
  GEN   qemu-img.1
  CC    qga/commands.o
  CC    qga/guest-agent-command-state.o
  CC    qga/main.o
  CC    qga/commands-posix.o
  CC    qga/channel-posix.o
  CC    qga/qapi-generated/qga-qapi-visit.o
  CC    qga/qapi-generated/qga-qapi-types.o
  CC    qga/qapi-generated/qga-qmp-marshal.o
  CC    qmp-introspect.o
  CC    qapi-types.o
  CC    qapi-visit.o
  CC    qapi-event.o
qga/commands-posix.c: In function ‘dev_major_minor’:
qga/commands-posix.c:668:21: warning: implicit declaration of function ‘major’ [-Wimplicit-function-declaration]
  668 |         *devmajor = major(st.st_rdev);
      |                     ^~~~~
qga/commands-posix.c:668:21: warning: nested extern declaration of ‘major’ [-Wnested-externs]
qga/commands-posix.c:669:21: warning: implicit declaration of function ‘minor’; did you mean ‘mincore’? [-Wimplicit-function-declaration]
  669 |         *devminor = minor(st.st_rdev);
      |                     ^~~~~
      |                     mincore
qga/commands-posix.c:669:21: warning: nested extern declaration of ‘minor’ [-Wnested-externs]
  CC    trace/generated-events.o
  CC    util/memfd.o
  CC    util/error.o
  CC    util/qemu-error.o
util/memfd.c:43:12: error: static declaration of ‘memfd_create’ follows non-static declaration
   43 | static int memfd_create(const char *name, unsigned int flags)
      |            ^~~~~~~~~~~~
In file included from /usr/include/bits/mman-linux.h:111,
                 from /usr/include/bits/mman.h:34,
                 from /usr/include/sys/mman.h:41,
                 from /home/pradana/qira/src/qira-1.3/tracers/qemu/qemu-latest/include/qemu/osdep.h:142,
                 from util/memfd.c:28:
/usr/include/bits/mman-shared.h:50:5: note: previous declaration of ‘memfd_create’ was here
   50 | int memfd_create (const char *__name, unsigned int __flags) __THROW;
      |     ^~~~~~~~~~~~
make: *** [/home/pradana/qira/src/qira-1.3/tracers/qemu/qemu-latest/rules.mak:57: util/memfd.o] Error 1

In any case, is it necessary to install QEMU through qemu_build.sh? Is it possible to run qira with a separate installation of QEMU?