qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>,
	Leonardo Bras <leobras@redhat.com>
Subject: Re: [PATCH 2/2] meson: Add static glib dependency for initrd-stress.img
Date: Fri, 26 May 2023 11:35:42 +0100	[thread overview]
Message-ID: <ZHCLfsReGU8nOkUE@redhat.com> (raw)
In-Reply-To: <20230525212044.30222-3-farosas@suse.de>

On Thu, May 25, 2023 at 06:20:44PM -0300, Fabiano Rosas wrote:
> We recently moved glib detection code to meson but the static libs
> were left out. Add a specific dependency for stress.c which is linked
> statically.
> 
> $ make V=1 tests/migration/initrd-stress.img
> 
> before:
>  cc -m64 -mcx16 -o tests/migration/stress ... -static -Wl,--start-group
>  /usr/lib64/libglib-2.0.so -Wl,--end-group
>  ...
>  bin/ld: attempted static link of dynamic object `/usr/lib64/libglib-2.0.so'
> 
> after:
>  cc -m64 -mcx16 -o tests/migration/stress ... -static -pthread
>  -Wl,--start-group -lm /usr/lib64/libpcre.a -lglib-2.0 -Wl,--end-group
> 
> Fixes: fc9a809e0d ("build: move glib detection and workarounds to meson")
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>  tests/migration/meson.build | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/migration/meson.build b/tests/migration/meson.build
> index dd562355a1..ac71f13290 100644
> --- a/tests/migration/meson.build
> +++ b/tests/migration/meson.build
> @@ -1,9 +1,11 @@
>  sysprof = dependency('sysprof-capture-4', required: false)
> +glib_static = dependency('glib-2.0', version: glib_req_ver, required: false,
> +                         method: 'pkg-config', static: true)

Since required: false, the result might be "not found", which means
we'll still hit the linker error. I think we need to surround the
'executable()' bit in

  if glib_static.found()
     ...
  endif
  
>  
>  stress = executable(
>    'stress',
>    files('stress.c'),
> -  dependencies: [glib, sysprof],
> +  dependencies: [glib_static, sysprof],
>    link_args: ['-static'],
>    build_by_default: false,
>  )
> 

With 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 :|



  parent reply	other threads:[~2023-05-26 10:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 21:20 [PATCH 0/2] meson: Fix initrd-stress.img build Fabiano Rosas
2023-05-25 21:20 ` [PATCH 1/2] meson: Remove leftover comment Fabiano Rosas
2023-05-25 21:20 ` [PATCH 2/2] meson: Add static glib dependency for initrd-stress.img Fabiano Rosas
2023-05-26 10:32   ` Juan Quintela
2023-05-26 10:35   ` Daniel P. Berrangé [this message]
2023-05-26 13:09     ` Fabiano Rosas
2023-05-26  8:19 ` [PATCH 0/2] meson: Fix initrd-stress.img build Paolo Bonzini
2023-05-26 11:36   ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZHCLfsReGU8nOkUE@redhat.com \
    --to=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=leobras@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).