All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/io_uring: use pkg-config for liburing
@ 2019-05-25  9:05 Stefan Hajnoczi
  2019-05-25  9:15 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
  2019-06-05 15:56 ` [Qemu-devel] " Daniel P. Berrangé
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2019-05-25  9:05 UTC (permalink / raw)
  To: qemu-devel, Aarushi Mehta
  Cc: Kevin Wolf, Julia Suvorova, Stefan Hajnoczi, qemu-block, Max Reitz

Now that liburing has pkg-config support, use it instead of hardcoding
compiler flags in QEMU's build scripts.  This way distros can customize
the location of liburing's headers and libraries without requiring
changes to QEMU.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
Hi Aarushi,
This change is needed to take advantage of the pkg-config patch that
I've just sent to liburing.  It works like this:

  $ cd liburing
  $ ./configure --libdir=/usr/lib64 # needed on Fedora x86_64
  $ make && sudo make install

That puts liburing.pc into /usr/lib64/pkgconfig/ where QEMU's
./configure will find it:

  $ cd qemu
  $ ./configure --target-list=x86_64-softmmu # it should detect liburing
  $ make -j$(nproc)

Feel free to squash this patch into your patches, I don't mind if the
authorship information gets lost.  It will be easier for reviewers if
this is present from the start instead of added in a later patch.

 configure           | 12 ++++++------
 block/Makefile.objs |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 86383dc0b3..acbdf04168 100755
--- a/configure
+++ b/configure
@@ -3972,15 +3972,13 @@ fi
 # linux-io-uring probe
 
 if test "$linux_io_uring" != "no" ; then
-  cat > $TMPC <<EOF
-#include <liburing.h>
-int main(void) { io_uring_queue_init(0, NULL, 0); io_uring_submit(NULL); return 0; }
-EOF
-  if compile_prog "" "-luring" ; then
+  if $pkg_config liburing; then
+    linux_io_uring_cflags=$($pkg_config --cflags liburing)
+    linux_io_uring_libs=$($pkg_config --libs liburing)
     linux_io_uring=yes
   else
     if test "$linux_io_uring" = "yes" ; then
-      feature_not_found "linux io_uring" "Install liburing"
+      feature_not_found "linux io_uring" "Install liburing devel"
     fi
     linux_io_uring=no
   fi
@@ -6884,6 +6882,8 @@ if test "$linux_aio" = "yes" ; then
 fi
 if test "$linux_io_uring" = "yes" ; then
   echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak
+  echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak
+  echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak
 fi
 if test "$attr" = "yes" ; then
   echo "CONFIG_ATTR=y" >> $config_host_mak
diff --git a/block/Makefile.objs b/block/Makefile.objs
index 262d413c6d..eed8043740 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -62,6 +62,7 @@ block-obj-$(if $(CONFIG_LZFSE),m,n) += dmg-lzfse.o
 dmg-lzfse.o-libs   := $(LZFSE_LIBS)
 qcow.o-libs        := -lz
 linux-aio.o-libs   := -laio
-io_uring.o-libs    := -luring
+io_uring.o-flags   := $(LINUX_IO_URING_CFLAGS)
+io_uring.o-libs    := $(LINUX_IO_URING_LIBS)
 parallels.o-cflags := $(LIBXML2_CFLAGS)
 parallels.o-libs   := $(LIBXML2_LIBS)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] block/io_uring: use pkg-config for liburing
  2019-05-25  9:05 [Qemu-devel] [PATCH] block/io_uring: use pkg-config for liburing Stefan Hajnoczi
@ 2019-05-25  9:15 ` Stefan Hajnoczi
  2019-06-05 15:56 ` [Qemu-devel] " Daniel P. Berrangé
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2019-05-25  9:15 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Kevin Wolf, qemu block, qemu-devel, Max Reitz, Julia Suvorova,
	Aarushi Mehta

On Sat, May 25, 2019 at 10:07 AM Stefan Hajnoczi <stefanha@redhat.com> wrote:

Based-on: <20190524140337.13415-1-mehta.aaru20@gmail.com>
           "[RFC PATCH v2 0/9] Add support for io_uring"

> diff --git a/block/Makefile.objs b/block/Makefile.objs
> index 262d413c6d..eed8043740 100644
> --- a/block/Makefile.objs
> +++ b/block/Makefile.objs
> @@ -62,6 +62,7 @@ block-obj-$(if $(CONFIG_LZFSE),m,n) += dmg-lzfse.o
>  dmg-lzfse.o-libs   := $(LZFSE_LIBS)
>  qcow.o-libs        := -lz
>  linux-aio.o-libs   := -laio
> -io_uring.o-libs    := -luring
> +io_uring.o-flags   := $(LINUX_IO_URING_CFLAGS)

Oops, this should be -cflags instead of -flags.  The current
liburing.pc file doesn't define any special cflags so I didn't notice
this problem.

Please fix this up when integrating this into your patch series, thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] block/io_uring: use pkg-config for liburing
  2019-05-25  9:05 [Qemu-devel] [PATCH] block/io_uring: use pkg-config for liburing Stefan Hajnoczi
  2019-05-25  9:15 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
@ 2019-06-05 15:56 ` Daniel P. Berrangé
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2019-06-05 15:56 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Kevin Wolf, qemu-block, qemu-devel, Max Reitz, Julia Suvorova,
	Aarushi Mehta

On Sat, May 25, 2019 at 10:05:59AM +0100, Stefan Hajnoczi wrote:
> Now that liburing has pkg-config support, use it instead of hardcoding
> compiler flags in QEMU's build scripts.  This way distros can customize
> the location of liburing's headers and libraries without requiring
> changes to QEMU.

I was going to say that we should keep the existing code as a fallback
for installs which lack the pkg-config support. It seems liburing is so
new as a project that its not in distros yet. So on that basis we can
justifiably just do pkg-config only and not worry about back compat.

> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-05 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-25  9:05 [Qemu-devel] [PATCH] block/io_uring: use pkg-config for liburing Stefan Hajnoczi
2019-05-25  9:15 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2019-06-05 15:56 ` [Qemu-devel] " Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.