From d8a58946ab3679efc3fe59444f2f97c0b69467f2 Mon Sep 17 00:00:00 2001 From: Zhou Kang Date: Mon, 18 Sep 2023 13:09:24 +0000 Subject: [PATCH] fix compile for openeuler 2203SP2 --- src/static_template/meson.build | 8 +++++++- src/static_template/static_template.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/static_template/meson.build b/src/static_template/meson.build index 88ad57a..359a2f2 100644 --- a/src/static_template/meson.build +++ b/src/static_template/meson.build @@ -7,7 +7,13 @@ temp_cflags = ['-O2', '-Wall', '-Wextra', '-Wformat', '-D_GNU_SOURCE', '-fno-jum '-Wno-nonnull', '-Wno-unused-variable', '-Wno-stringop-truncation', '-Wno-unused-result', '-D_FORTIFY_SOURCE=2'] +libc_ver=run_command('rpm', '-qi', 'glibc', check: true).stdout().strip() +# openEuler 2309 +if libc_ver.contains('2.38') + temp_cflags += ['-DGLIBC236'] +endif + executable('sysboost_static_template', sources, install: true, c_args: temp_cflags, - link_args: temp_cflags + ['-Wl,--emit-relocs', '-ldl']) \ No newline at end of file + link_args: temp_cflags + ['-Wl,--emit-relocs', '-ldl']) diff --git a/src/static_template/static_template.c b/src/static_template/static_template.c index 4db83bf..a7f34dc 100644 --- a/src/static_template/static_template.c +++ b/src/static_template/static_template.c @@ -113,7 +113,12 @@ int main(void) NO_COMPILE_OPTIMIZE("sigfillset"); NO_COMPILE_OPTIMIZE("siglongjmp"); NO_COMPILE_OPTIMIZE("vfprintf"); + +#ifdef GLIBC236 + // arc4random@@GLIBC_2.36 NO_COMPILE_OPTIMIZE("arc4random"); +#endif + NO_COMPILE_OPTIMIZE("optarg"); NO_COMPILE_OPTIMIZE("getopt_long"); NO_COMPILE_OPTIMIZE("error"); -- Gitee