qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more bogus meson warnings


From: Paolo Bonzini
Subject: Re: more bogus meson warnings
Date: Thu, 4 Nov 2021 13:54:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]