[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] meson: Propagate gnutls dependency
From: |
Roman Bolshakov |
Subject: |
Re: [PATCH] meson: Propagate gnutls dependency |
Date: |
Tue, 5 Jan 2021 17:37:58 +0300 |
On Mon, Jan 04, 2021 at 09:50:32PM +0100, Paolo Bonzini wrote:
> On 04/01/21 18:24, Roman Bolshakov wrote:
> > Hi Paolo,
> >
> > I'm sorry I didn't reply earlier. As I showed in an example to Peter
> > (https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg00085.html):
> > https://github.com/mesonbuild/meson/commit/ff5dc65ef841857dd306694dff1fb1cd2bf801e4
> >
> > The approach doesn't propogate dependencies of crypto beyond libcrypto.
> > i.e. if you specify crypto somewhere else as depedency, it won't pull
> > CFLAGS needed for gnutls.
>
> Hi Roman,
>
> After writing the meson patch in fact I noticed that get_dependencies() is
> used only for linker flags. I got a very quick reply from the Meson
> maintainer (https://github.com/mesonbuild/meson/pull/8151):
>
Thanks for providing a PR! I'll try if it works for QEMU with previous
proposal of fixing it (where we specify dependency in source set only
once and don't duplicate in declare_dependency).
I wonder if we should add a source set method like public_add to allow
the behavior we want and permit propogation of a dependency beyond
static_library without breaking all other users of meson out there?
> The fact that header flags are not passed transitively but libraries
> are (in some cases) is intentional. Otherwise compiler flag counts
> explode in deep hierarchies. Because of this include paths must be
> exported manually, typically by adding the appropriate bits to a
> declare_dependency.
>
> Libs are a bit stupid, because you need to add direct dependencies
> if, for example, you link to a static library.
>
> Does it work if you do:
>
> crypto_ss.add(authz, qom)
> libcrypto = static_library('crypto', crypto_ss.sources() + genh,
> dependencies: crypto_ss.dependencies(),
> ...)
> crypto = declare_dependency(link_whole: libcrypto,
> dependencies: crypto_ss.dependencies())
>
I tried that approach before I sent the patch in the subject. It
produces duplicate symbols:
duplicate symbol '_qauthz_pam_new' in:
libcrypto.fa(authz_pamacct.c.o)
libauthz.fa(authz_pamacct.c.o)
[...]
duplicate symbol '_object_property_set_qobject' in:
libcrypto.fa(qom_qom-qobject.c.o)
libqom.fa(qom_qom-qobject.c.o)
My impression that it links in every static library that's mentioned in
dependencies of static_library, so they grow like a snow ball. Patch
below:
diff --git a/block/meson.build b/block/meson.build
index 7595d86c41..7eaf48c6dc 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -40,7 +40,7 @@ block_ss.add(files(
'vmdk.c',
'vpc.c',
'write-threshold.c',
-), zstd, zlib)
+), crypto, zstd, zlib)
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
diff --git a/hw/nvram/meson.build b/hw/nvram/meson.build
index fd2951a860..1f2ed013b2 100644
--- a/hw/nvram/meson.build
+++ b/hw/nvram/meson.build
@@ -1,6 +1,3 @@
-# QOM interfaces must be available anytime QOM is used.
-qom_ss.add(files('fw_cfg-interface.c'))
-
softmmu_ss.add(files('fw_cfg.c'))
softmmu_ss.add(when: 'CONFIG_CHRP_NVRAM', if_true: files('chrp_nvram.c'))
softmmu_ss.add(when: 'CONFIG_DS1225Y', if_true: files('ds1225y.c'))
diff --git a/io/meson.build b/io/meson.build
index bcd8b1e737..a844271b17 100644
--- a/io/meson.build
+++ b/io/meson.build
@@ -12,4 +12,4 @@ io_ss.add(files(
'dns-resolver.c',
'net-listener.c',
'task.c',
-))
+), crypto)
diff --git a/meson.build b/meson.build
index 372576f82c..1a8c653067 100644
--- a/meson.build
+++ b/meson.build
@@ -1538,6 +1538,34 @@ libqemuutil = static_library('qemuutil',
qemuutil = declare_dependency(link_with: libqemuutil,
sources: genh + version_res)
+# QOM interfaces must be available anytime QOM is used.
+qom_ss.add(files('hw/nvram/fw_cfg-interface.c'))
+qom_ss = qom_ss.apply(config_host, strict: false)
+libqom = static_library('qom', qom_ss.sources() + genh,
+ dependencies: [qom_ss.dependencies()],
+ name_suffix: 'fa')
+
+qom = declare_dependency(link_whole: libqom)
+
+authz_ss = authz_ss.apply(config_host, strict: false)
+libauthz = static_library('authz', authz_ss.sources() + genh,
+ dependencies: [authz_ss.dependencies()],
+ name_suffix: 'fa',
+ build_by_default: false)
+
+authz = declare_dependency(link_whole: libauthz,
+ dependencies: qom)
+
+crypto_ss.add(authz)
+crypto_ss = crypto_ss.apply(config_host, strict: false)
+libcrypto = static_library('crypto', crypto_ss.sources() + genh,
+ dependencies: crypto_ss.dependencies(),
+ name_suffix: 'fa',
+ build_by_default: false)
+
+crypto = declare_dependency(link_whole: libcrypto,
+ dependencies: crypto_ss.dependencies())
+
decodetree = generator(find_program('scripts/decodetree.py'),
output: 'decode-@BASENAME@.c.inc',
arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o',
'@OUTPUT@'])
@@ -1652,31 +1680,6 @@ qemu_syms = custom_target('qemu.syms', output:
'qemu.syms',
capture: true,
command: [undefsym, nm, '@INPUT@'])
-qom_ss = qom_ss.apply(config_host, strict: false)
-libqom = static_library('qom', qom_ss.sources() + genh,
- dependencies: [qom_ss.dependencies()],
- name_suffix: 'fa')
-
-qom = declare_dependency(link_whole: libqom)
-
-authz_ss = authz_ss.apply(config_host, strict: false)
-libauthz = static_library('authz', authz_ss.sources() + genh,
- dependencies: [authz_ss.dependencies()],
- name_suffix: 'fa',
- build_by_default: false)
-
-authz = declare_dependency(link_whole: libauthz,
- dependencies: qom)
-
-crypto_ss = crypto_ss.apply(config_host, strict: false)
-libcrypto = static_library('crypto', crypto_ss.sources() + genh,
- dependencies: [crypto_ss.dependencies()],
- name_suffix: 'fa',
- build_by_default: false)
-
-crypto = declare_dependency(link_whole: libcrypto,
- dependencies: [authz, qom])
-
io_ss = io_ss.apply(config_host, strict: false)
libio = static_library('io', io_ss.sources() + genh,
dependencies: [io_ss.dependencies()],
> ? If so, that is also a good option. If not, I will try to extend the test
> case to pitch the Meson change.
>
This one seems the only sane approach left.
Thanks,
Roman
- [PATCH] meson: Propagate gnutls dependency, Roman Bolshakov, 2021/01/02
- Re: [PATCH] meson: Propagate gnutls dependency, Peter Maydell, 2021/01/02
- Re: [PATCH] meson: Propagate gnutls dependency, Roman Bolshakov, 2021/01/02
- Re: [PATCH] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/02
- Re: [PATCH] meson: Propagate gnutls dependency, Roman Bolshakov, 2021/01/04
- Re: [PATCH] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/04
- Re: [PATCH] meson: Propagate gnutls dependency,
Roman Bolshakov <=
- Re: [PATCH] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/05
- Re: [PATCH] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/07
- Re: [PATCH] meson: Propagate gnutls dependency, Roman Bolshakov, 2021/01/07
- Re: [PATCH] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/07
- Re: [PATCH] meson: Propagate gnutls dependency, Roman Bolshakov, 2021/01/07
- Re: [PATCH] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/07
- Re: [PATCH] meson: Propagate gnutls dependency, Roman Bolshakov, 2021/01/07
- Re: [PATCH] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/07
- Re: [PATCH] meson: Propagate gnutls dependency, Roman Bolshakov, 2021/01/08
- Re: [PATCH] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/08