1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00

meson: add libatomic dependency

Building with GCC 12.2 and binutils 2.39 fails on riscv64 Ubuntu Kinetic
with:

FAILED: systemd-oomd
/usr/bin/ld: systemd-oomd.p/src_oom_oomd-util.c.o:
in function `oomd_cgroup_context_acquire':
build/../src/oom/oomd-util.c:415:
undefined reference to `__atomic_exchange_1'

We have to link with -latomic.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
(cherry picked from commit 132c73b57a)
(cherry picked from commit 738eca5e05)
This commit is contained in:
Heinrich Schuchardt 2022-09-12 18:41:34 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 01ea6ba5f1
commit 87d6e6a14f
3 changed files with 16 additions and 4 deletions

View File

@ -981,6 +981,16 @@ endif
#####################################################################
libatomic = []
if not cc.links('''#include <stdint.h>
int main() {
char i;
__atomic_exchange_1(&i, 1, 0);
return 1;
}''',
name : 'Atomic builtin requires -latomic')
libatomic = cc.find_library('atomic')
endif
threads = dependency('threads')
librt = cc.find_library('rt')
libm = cc.find_library('m')
@ -2968,7 +2978,7 @@ if conf.get('ENABLE_OOMD') == 1
systemd_oomd_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [],
dependencies : [libatomic],
install_rpath : rootlibexecdir,
install : true,
install_dir : rootlibexecdir)

View File

@ -280,13 +280,13 @@ tests += [
[['src/network/test-networkd-address.c'],
[libnetworkd_core,
libsystemd_network],
[],
[libatomic],
network_includes],
[['src/network/test-networkd-conf.c'],
[libnetworkd_core,
libsystemd_network],
[],
[libatomic],
network_includes],
[['src/network/test-networkd-util.c'],

View File

@ -28,5 +28,7 @@ endif
tests += [
[['src/oom/test-oomd-util.c',
'src/oom/oomd-util.c',
'src/oom/oomd-util.h']],
'src/oom/oomd-util.h'],
[],
[libatomic]],
]