Message ID | 20190525090559.31914-1-stefanha@redhat.com |
---|---|
State | New |
Headers | show |
Series | block/io_uring: use pkg-config for liburing | expand |
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!
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
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)
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(-)