All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libvhost-user: add a link-static option
@ 2020-12-12  9:08 marcandre.lureau
  2020-12-14 16:22 ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: marcandre.lureau @ 2020-12-12  9:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, pbonzini, Marc-André Lureau, mst

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Fix linking vhost-user binaries with with ./configure -static.

Fixes: 0df750e9d3a5fea5e1 ("libvhost-user: make it a meson subproject")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 configure                                   | 1 +
 subprojects/libvhost-user/meson.build       | 3 ++-
 subprojects/libvhost-user/meson_options.txt | 5 +++++
 3 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 subprojects/libvhost-user/meson_options.txt

diff --git a/configure b/configure
index 18c26e0389..465f7bb150 100755
--- a/configure
+++ b/configure
@@ -7014,6 +7014,7 @@ NINJA=$ninja $meson setup \
         -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
+        -Dlibvhost-user:link-static=$(if test "$static" = yes; then echo true; else echo false; fi) \
         $cross_arg \
         "$PWD" "$source_path"
 
diff --git a/subprojects/libvhost-user/meson.build b/subprojects/libvhost-user/meson.build
index c5d85c11d7..5a9cc8675e 100644
--- a/subprojects/libvhost-user/meson.build
+++ b/subprojects/libvhost-user/meson.build
@@ -2,7 +2,8 @@ project('libvhost-user', 'c',
         license: 'GPL-2.0-or-later',
         default_options: ['c_std=gnu99'])
 
-glib = dependency('glib-2.0')
+link_static = get_option('link-static')
+glib = dependency('glib-2.0', static: link_static)
 inc = include_directories('../../include', '../../linux-headers')
 
 vhost_user = static_library('vhost-user',
diff --git a/subprojects/libvhost-user/meson_options.txt b/subprojects/libvhost-user/meson_options.txt
new file mode 100644
index 0000000000..03fe088e36
--- /dev/null
+++ b/subprojects/libvhost-user/meson_options.txt
@@ -0,0 +1,5 @@
+option('link-static',
+  type: 'boolean',
+  value: false,
+)
+
-- 
2.29.0



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

* Re: [PATCH] libvhost-user: add a link-static option
  2020-12-12  9:08 [PATCH] libvhost-user: add a link-static option marcandre.lureau
@ 2020-12-14 16:22 ` Paolo Bonzini
  2020-12-14 17:07   ` Marc-André Lureau
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2020-12-14 16:22 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel; +Cc: peter.maydell, mst

On 12/12/20 10:08, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Fix linking vhost-user binaries with with ./configure -static.
> 
> Fixes: 0df750e9d3a5fea5e1 ("libvhost-user: make it a meson subproject")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   configure                                   | 1 +
>   subprojects/libvhost-user/meson.build       | 3 ++-
>   subprojects/libvhost-user/meson_options.txt | 5 +++++
>   3 files changed, 8 insertions(+), 1 deletion(-)
>   create mode 100644 subprojects/libvhost-user/meson_options.txt
> 
> diff --git a/configure b/configure
> index 18c26e0389..465f7bb150 100755
> --- a/configure
> +++ b/configure
> @@ -7014,6 +7014,7 @@ NINJA=$ninja $meson setup \
>           -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
>           -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
>           -Dvhost_user_blk_server=$vhost_user_blk_server \
> +        -Dlibvhost-user:link-static=$(if test "$static" = yes; then echo true; else echo false; fi) \
>           $cross_arg \
>           "$PWD" "$source_path"
>   
> diff --git a/subprojects/libvhost-user/meson.build b/subprojects/libvhost-user/meson.build
> index c5d85c11d7..5a9cc8675e 100644
> --- a/subprojects/libvhost-user/meson.build
> +++ b/subprojects/libvhost-user/meson.build
> @@ -2,7 +2,8 @@ project('libvhost-user', 'c',
>           license: 'GPL-2.0-or-later',
>           default_options: ['c_std=gnu99'])
>   
> -glib = dependency('glib-2.0')
> +link_static = get_option('link-static')
> +glib = dependency('glib-2.0', static: link_static)
>   inc = include_directories('../../include', '../../linux-headers')
>   
>   vhost_user = static_library('vhost-user',
> diff --git a/subprojects/libvhost-user/meson_options.txt b/subprojects/libvhost-user/meson_options.txt
> new file mode 100644
> index 0000000000..03fe088e36
> --- /dev/null
> +++ b/subprojects/libvhost-user/meson_options.txt
> @@ -0,0 +1,5 @@
> +option('link-static',
> +  type: 'boolean',
> +  value: false,
> +)
> +

No, this is wrong.  We need to use the results of the configure test 
uniformly until we can move it to meson.build.

Ask yourself if you'd like to have this option in a standalone project, 
the answer most likely is no...  Can you use override_dependency from 
the toplevel meson.build instead?  It's usually meant for 
sub->superproject, but we can use it in this case as well I think.

Paolo



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

* Re: [PATCH] libvhost-user: add a link-static option
  2020-12-14 16:22 ` Paolo Bonzini
@ 2020-12-14 17:07   ` Marc-André Lureau
  2020-12-14 20:48     ` Marc-André Lureau
  0 siblings, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2020-12-14 17:07 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Peter Maydell, QEMU, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 2976 bytes --]

On Mon, Dec 14, 2020 at 8:23 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 12/12/20 10:08, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Fix linking vhost-user binaries with with ./configure -static.
> >
> > Fixes: 0df750e9d3a5fea5e1 ("libvhost-user: make it a meson subproject")
> > Reported-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >   configure                                   | 1 +
> >   subprojects/libvhost-user/meson.build       | 3 ++-
> >   subprojects/libvhost-user/meson_options.txt | 5 +++++
> >   3 files changed, 8 insertions(+), 1 deletion(-)
> >   create mode 100644 subprojects/libvhost-user/meson_options.txt
> >
> > diff --git a/configure b/configure
> > index 18c26e0389..465f7bb150 100755
> > --- a/configure
> > +++ b/configure
> > @@ -7014,6 +7014,7 @@ NINJA=$ninja $meson setup \
> >           -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
> >           -Ddocs=$docs -Dsphinx_build=$sphinx_build
> -Dinstall_blobs=$blobs \
> >           -Dvhost_user_blk_server=$vhost_user_blk_server \
> > +        -Dlibvhost-user:link-static=$(if test "$static" = yes; then
> echo true; else echo false; fi) \
> >           $cross_arg \
> >           "$PWD" "$source_path"
> >
> > diff --git a/subprojects/libvhost-user/meson.build
> b/subprojects/libvhost-user/meson.build
> > index c5d85c11d7..5a9cc8675e 100644
> > --- a/subprojects/libvhost-user/meson.build
> > +++ b/subprojects/libvhost-user/meson.build
> > @@ -2,7 +2,8 @@ project('libvhost-user', 'c',
> >           license: 'GPL-2.0-or-later',
> >           default_options: ['c_std=gnu99'])
> >
> > -glib = dependency('glib-2.0')
> > +link_static = get_option('link-static')
> > +glib = dependency('glib-2.0', static: link_static)
> >   inc = include_directories('../../include', '../../linux-headers')
> >
> >   vhost_user = static_library('vhost-user',
> > diff --git a/subprojects/libvhost-user/meson_options.txt
> b/subprojects/libvhost-user/meson_options.txt
> > new file mode 100644
> > index 0000000000..03fe088e36
> > --- /dev/null
> > +++ b/subprojects/libvhost-user/meson_options.txt
> > @@ -0,0 +1,5 @@
> > +option('link-static',
> > +  type: 'boolean',
> > +  value: false,
> > +)
> > +
>
> No, this is wrong.  We need to use the results of the configure test
> uniformly until we can move it to meson.build.
>
> Ask yourself if you'd like to have this option in a standalone project,
>

I took the option from a meson test case:
https://github.com/mesonbuild/meson/blob/master/test%20cases/frameworks/15%20llvm/meson.build

the answer most likely is no...  Can you use override_dependency from
> the toplevel meson.build instead?  It's usually meant for
> sub->superproject, but we can use it in this case as well I think.
>
>
ok I'll try


-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 4460 bytes --]

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

* Re: [PATCH] libvhost-user: add a link-static option
  2020-12-14 17:07   ` Marc-André Lureau
@ 2020-12-14 20:48     ` Marc-André Lureau
  2020-12-14 21:07       ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2020-12-14 20:48 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Peter Maydell, QEMU, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 3379 bytes --]

On Mon, Dec 14, 2020 at 9:07 PM Marc-André Lureau <
marcandre.lureau@gmail.com> wrote:

>
>
> On Mon, Dec 14, 2020 at 8:23 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>> On 12/12/20 10:08, marcandre.lureau@redhat.com wrote:
>> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
>> >
>> > Fix linking vhost-user binaries with with ./configure -static.
>> >
>> > Fixes: 0df750e9d3a5fea5e1 ("libvhost-user: make it a meson subproject")
>> > Reported-by: Peter Maydell <peter.maydell@linaro.org>
>> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> > ---
>> >   configure                                   | 1 +
>> >   subprojects/libvhost-user/meson.build       | 3 ++-
>> >   subprojects/libvhost-user/meson_options.txt | 5 +++++
>> >   3 files changed, 8 insertions(+), 1 deletion(-)
>> >   create mode 100644 subprojects/libvhost-user/meson_options.txt
>> >
>> > diff --git a/configure b/configure
>> > index 18c26e0389..465f7bb150 100755
>> > --- a/configure
>> > +++ b/configure
>> > @@ -7014,6 +7014,7 @@ NINJA=$ninja $meson setup \
>> >           -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
>> >           -Ddocs=$docs -Dsphinx_build=$sphinx_build
>> -Dinstall_blobs=$blobs \
>> >           -Dvhost_user_blk_server=$vhost_user_blk_server \
>> > +        -Dlibvhost-user:link-static=$(if test "$static" = yes; then
>> echo true; else echo false; fi) \
>> >           $cross_arg \
>> >           "$PWD" "$source_path"
>> >
>> > diff --git a/subprojects/libvhost-user/meson.build
>> b/subprojects/libvhost-user/meson.build
>> > index c5d85c11d7..5a9cc8675e 100644
>> > --- a/subprojects/libvhost-user/meson.build
>> > +++ b/subprojects/libvhost-user/meson.build
>> > @@ -2,7 +2,8 @@ project('libvhost-user', 'c',
>> >           license: 'GPL-2.0-or-later',
>> >           default_options: ['c_std=gnu99'])
>> >
>> > -glib = dependency('glib-2.0')
>> > +link_static = get_option('link-static')
>> > +glib = dependency('glib-2.0', static: link_static)
>> >   inc = include_directories('../../include', '../../linux-headers')
>> >
>> >   vhost_user = static_library('vhost-user',
>> > diff --git a/subprojects/libvhost-user/meson_options.txt
>> b/subprojects/libvhost-user/meson_options.txt
>> > new file mode 100644
>> > index 0000000000..03fe088e36
>> > --- /dev/null
>> > +++ b/subprojects/libvhost-user/meson_options.txt
>> > @@ -0,0 +1,5 @@
>> > +option('link-static',
>> > +  type: 'boolean',
>> > +  value: false,
>> > +)
>> > +
>>
>> No, this is wrong.  We need to use the results of the configure test
>> uniformly until we can move it to meson.build.
>>
>> Ask yourself if you'd like to have this option in a standalone project,
>>
>
> I took the option from a meson test case:
>
> https://github.com/mesonbuild/meson/blob/master/test%20cases/frameworks/15%20llvm/meson.build
>
> the answer most likely is no...  Can you use override_dependency from
>> the toplevel meson.build instead?  It's usually meant for
>> sub->superproject, but we can use it in this case as well I think.
>>
>>
> ok I'll try
>
>
Adding:
 meson.override_dependency('glib-2.0', dependency('glib-2.0', static:
enable_static))

just before the "vhost_user = not_found..." works. Is that what you had in
mind?


> --
> Marc-André Lureau
>


-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 5399 bytes --]

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

* Re: [PATCH] libvhost-user: add a link-static option
  2020-12-14 20:48     ` Marc-André Lureau
@ 2020-12-14 21:07       ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2020-12-14 21:07 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: Peter Maydell, QEMU, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

Il lun 14 dic 2020, 21:48 Marc-André Lureau <marcandre.lureau@gmail.com> ha
scritto:

> Adding:
>  meson.override_dependency('glib-2.0', dependency('glib-2.0', static:
> enable_static))
>
> just before the "vhost_user = not_found..." works. Is that what you had in
> mind?
>

Why not "meson.override_dependency('glib-2.0', glib)", either there before
the vhost_user assignmeny or in meson.build where glib is assigned to?

Thanks,

Paolo

>
>
>> --
>> Marc-André Lureau
>>
>
>
> --
> Marc-André Lureau
>

[-- Attachment #2: Type: text/html, Size: 1508 bytes --]

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

end of thread, other threads:[~2020-12-14 21:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-12  9:08 [PATCH] libvhost-user: add a link-static option marcandre.lureau
2020-12-14 16:22 ` Paolo Bonzini
2020-12-14 17:07   ` Marc-André Lureau
2020-12-14 20:48     ` Marc-André Lureau
2020-12-14 21:07       ` Paolo Bonzini

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.