qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: more bogus meson warnings
Date: Thu, 4 Nov 2021 13:54:25 +0100	[thread overview]
Message-ID: <c9debb07-6e36-fd04-bb80-6af40266897b@redhat.com> (raw)
In-Reply-To: <CAFEAcA-F-f7TcmbtZTJ8O0q9Ebxf-7aLHbawQCz-jQ5q8xgFRg@mail.gmail.com>

On 11/4/21 12:02, Peter Maydell wrote:
> The link of the test program against libsnappy.a fails because
> it is being linked with cc and nothing is putting the C++ stdlib
> that libsnappy needs on the link line, so you get errors like:
> 
>   /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libsnappy.a(snappy.cc.o):
> In function `snappy::internal::WorkingMemory::GetHashTable(unsigned
> long, int*)':
> (.text+0x15b): undefined reference to `operator new[](unsigned long)'

That's interesting.  So there was also a bug before moving the test
to meson; statically-linked binaries would not use snappy even if
linking would be done by a C++ compiler.  This should fix it:

diff --git a/meson.build b/meson.build
index e330438270..cbc5c7a868 100644
--- a/meson.build
+++ b/meson.build
@@ -197,6 +197,9 @@ add_project_arguments('-iquote', '.',
  link_language = meson.get_external_property('link_language', 'cpp')
  if link_language == 'cpp'
    add_languages('cpp', required: true, native: false)
+  linker = cxx = meson.get_compiler('cpp')
+else
+  linker = cc
  endif
  if host_machine.system() == 'darwin'
    add_languages('objc', required: false, native: false)
@@ -1111,7 +1114,7 @@ if not get_option('snappy').auto() or have_system
                             required: get_option('snappy'),
                             kwargs: static_kwargs)
  endif
-if snappy.found() and not cc.links('''
+if snappy.found() and not linker.links('''
     #include <snappy-c.h>
     int main(void) { snappy_max_compressed_length(4096); return 0; }''', dependencies: snappy)
    snappy = not_found


> There's generally
> nothing much the user can do about this, beyond file a bug report with
> the distro if they're feeling enthusiastic.

It could be filed in snappy as well, but yeah I'm not feeling
enthusiastic about that.  Besides in this case we're not even using the
.pc file, but rather looking for -lsnappy by hand.

Paolo



      reply	other threads:[~2021-11-04 13:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 13:38 more bogus meson warnings Peter Maydell
2021-11-02 13:40 ` Peter Maydell
2021-11-03  8:01 ` Paolo Bonzini
2021-11-03 12:19   ` Peter Maydell
2021-11-03 13:37     ` Paolo Bonzini
2021-11-04 11:02       ` Peter Maydell
2021-11-04 12:54         ` Paolo Bonzini [this message]

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=c9debb07-6e36-fd04-bb80-6af40266897b@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).