[gjs] meson.build: Avoid putting two copies of libsysprof-capture-4.a in libgjs
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] meson.build: Avoid putting two copies of libsysprof-capture-4.a in libgjs
- Date: Wed, 26 May 2021 04:27:55 +0000 (UTC)
commit 74ad7c89e161364720bea4910cb7f4aaab15d29d
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Wed May 19 14:42:05 2021 +0800
meson.build: Avoid putting two copies of libsysprof-capture-4.a in libgjs
`libgjs` was getting two copies of `libsysprof-capture-4.a` from:
```
link_whole: libgjs_internal,
dependencies: base_build_dep,
```
With regular dependencies this wouldn't happen (it would remain a list
of unique dependencies), but the `link_whole` introduced in ed6370b9061
has now forced it in a way that Meson can't deduplicate it. So linking of
`libgjs` was failing as the linker found two separate copies (with
separate addresses) of each symbol from `libsysprof-capture-4.a`.
To resolve this we now ensure that `profiler_deps` is only requested by
`libgjs_internal`, which itself is `link_whole`'d into `libgjs`. So
`libgjs` still gets `profiler_deps` but now only one copy.
What's special about this case is that it's a static library included in
a static library, so if that happens again then the same approach will be
needed.
Closes: https://gitlab.gnome.org/GNOME/gjs/-/issues/414
meson.build | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/meson.build b/meson.build
index 253cdbbd..828f30bd 100644
--- a/meson.build
+++ b/meson.build
@@ -482,10 +482,6 @@ if build_readline
libgjs_dependencies += readline_deps
endif
-if build_profiler
- libgjs_dependencies += profiler_deps
-endif
-
libgjs_cpp_args = ['-DGJS_COMPILATION'] + directory_defines
# Check G-I and/or Meson on this one.
@@ -511,11 +507,16 @@ base_build_dep = declare_dependency(
compile_args: libgjs_cpp_args,
dependencies: libgjs_dependencies)
+internal_build_dep = [base_build_dep]
+if build_profiler
+ internal_build_dep += profiler_deps
+endif
+
libgjs_jsapi = static_library(meson.project_name() + '-jsapi',
libgjs_jsapi_sources, probes_header, probes_objfile,
cpp_args: libgjs_cpp_args,
cpp_pch: pch_headers,
- dependencies: base_build_dep,
+ dependencies: internal_build_dep,
install: false)
# We need to create an internal static library to be able to link with the tests
@@ -524,7 +525,7 @@ libgjs_jsapi = static_library(meson.project_name() + '-jsapi',
libgjs_internal = static_library('gjs-internal',
libgjs_sources, probes_header, probes_objfile,
cpp_pch: pch_headers,
- dependencies: base_build_dep,
+ dependencies: internal_build_dep,
link_with: libgjs_jsapi)
link_args = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]