From af5993fffd37944a15326cb9510775b269352ce0 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 24 Nov 2021 17:29:06 +0530 Subject: shared_module: Add soname when used as a link target Emit a detailed deprecation warning that explains what to do instead. Also add a unittest. ``` DEPRECATION: target prog links against shared module mymod, which is incorrect. This will be an error in the future, so please use shared_library() for mymod instead. If shared_module() was used for mymod because it has references to undefined symbols, use shared_libary() with `override_options: ['b_lundef=false']` instead. ``` Fixes https://github.com/mesonbuild/meson/issues/9492 --- docs/yaml/functions/shared_library.yaml | 7 ------- docs/yaml/functions/shared_module.yaml | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'docs') diff --git a/docs/yaml/functions/shared_library.yaml b/docs/yaml/functions/shared_library.yaml index 46e5a1cfb..15ac782ca 100644 --- a/docs/yaml/functions/shared_library.yaml +++ b/docs/yaml/functions/shared_library.yaml @@ -2,13 +2,6 @@ name: shared_library returns: lib description: Builds a shared library with the given sources. -notes: - - | - Linking to a shared module is not supported on some - platforms, notably OSX. Consider using a - [[shared_library]] instead, if you need to both - `dlopen()` and link with a library. - posargs_inherit: _build_target_base varargs_inherit: _build_target_base kwargs_inherit: _build_target_base diff --git a/docs/yaml/functions/shared_module.yaml b/docs/yaml/functions/shared_module.yaml index 8909c2f9c..ff374e763 100644 --- a/docs/yaml/functions/shared_module.yaml +++ b/docs/yaml/functions/shared_module.yaml @@ -13,6 +13,15 @@ description: | you will need to set the `export_dynamic` argument of the executable to `true`. +notes: + - | + *Linking to a shared module is deprecated, and will be an error in the future*. + It used to be allowed because it was the only way to have a shared-library-like target that + contained references to undefined symbols. However, since 0.40.0, the `override_options:` + [[build_target]] keyword argument can be used to create such a [[shared_library]], and shared + modules have other characteristics that make them incompatible with linking, such as a lack of + SONAME. Linking to shared modules also does not work on some platforms, such as on macOS / iOS. + posargs_inherit: _build_target_base varargs_inherit: _build_target_base kwargs_inherit: _build_target_base -- cgit v1.2.3