Skip to content

Commit

Permalink
meson: build libsystemd-core via an intermediate static library
Browse files Browse the repository at this point in the history
By itself, this is not useful. I'm making this a separate commit to
make debugging easier. It turns out that meson does static libraries
using references, so the "static library" a tiny stub stub that refers
to the object files on disk and this has negligible cost:
$ ls -lhd build/src/core/libsystemd-core-257.{a,so}
-rw-r--r-- 1 zbyszek zbyszek  36K Jul  3 16:54 build/src/core/libsystemd-core-257.a
-rwxr-xr-x 1 zbyszek zbyszek 6.1M Jul  3 16:54 build/src/core/libsystemd-core-257.so

see currently unmerged systemd/systemd#33599

RHEL-only workaround

Resolves: RHEL-46020
  • Loading branch information
keszybz authored and lnykryn committed Jul 3, 2024
1 parent d645b5b commit 6f9e8b0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/core/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,13 @@ load_fragment_gperf_nulstr_c = custom_target(

libcore_name = 'systemd-core-@0@'.format(shared_lib_tag)

libcore = shared_library(
libcore_static = static_library(
libcore_name,
libcore_sources,
load_fragment_gperf_c,
load_fragment_gperf_nulstr_c,
include_directories : includes,
c_args : ['-fvisibility=default'],
link_args : ['-shared',
'-Wl,--version-script=' + libshared_sym_path],
link_depends : libshared_sym_path,
link_with : libshared,
dependencies : [libacl,
libapparmor,
libaudit,
Expand All @@ -135,6 +131,16 @@ libcore = shared_library(
libselinux,
threads,
userspace],
build_by_default : false)

libcore = shared_library(
libcore_name,
c_args : ['-fvisibility=default'],
link_args : ['-shared',
'-Wl,--version-script=' + libshared_sym_path],
link_depends : libshared_sym_path,
link_whole: libcore_static,
link_with : libshared,
install : true,
install_dir : pkglibdir)

Expand Down

0 comments on commit 6f9e8b0

Please sign in to comment.