systemd与C11标准兼容
程序员文章站
2022-07-14 08:07:22
...
systemd与C11标准兼容
从 systemd项目的 github 主线上拉取其源代码,但发现 tag 为 v238、v239 出现编译问题,去要再打兼容性补丁。
<gpg-error.h>需要使用noreturn而不是noreturn来避免与C11不兼容,特别是<stdnoreturn.h>。 请参阅: https://github.com/systemd/systemd/pull/8456](https://github.com/systemd/systemd/pull/8456)
已修改的问题: https://dev.gnupg.org/rE3eee9efc46f983fe0bf474c814944fef93a2a1b7
拉取 github 上的 systemd 主线分支编译 v238-systemd,编译不通过。
一. 编译v238-systemd两次编译报错
- v238-systemd编译报错信息如下
The Meson build system
Version: 0.48.0
Source dir: /home/loongson/SYSTEMD/238
Build dir: /home/loongson/SYSTEMD/238/build
Build type: native build
meson_options.txt:56:0: ERROR: Option name debug is reserved.
- 解决方法补丁:v238-meson-rename-Ddebug-to-Ddebug-extra.patch
From 4d9db8c0925c34d02b6a14022c9dd4ddbc2c4dc2 Mon Sep 17 00:00:00 2001
Date: Mon, 25 Feb 2019 13:40:44 +0800
Subject: [PATCH] meson rename Ddebug to Ddebug extra
---
meson.build | 2 +-
meson_options.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 30b7f1bafa..6cd89d6a86 100644
--- a/meson.build
+++ b/meson.build
@@ -811,7 +811,7 @@ conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
substs.set('SUSHELL', get_option('debug-shell'))
substs.set('DEBUGTTY', get_option('debug-tty'))
-debug = get_option('debug')
+debug = get_option('debug-extra')
enable_debug_hashmap = false
enable_debug_mmap_cache = false
if debug != ''
diff --git a/meson_options.txt b/meson_options.txt
index 4efb422f90..9025aebff3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -53,7 +53,7 @@ option('debug-shell', type : 'string', value : '/bin/sh',
description : 'path to debug shell binary')
option('debug-tty', type : 'string', value : '/dev/tty9',
description : 'specify the tty device for debug shell')
-option('debug', type : 'string',
+option('debug-extra', type : 'string',
description : 'enable extra debugging (hashmap,mmap-cache)')
option('memory-accounting-default', type : 'boolean',
description : 'enable MemoryAccounting= by default')
--
2.17.2
- 由 C11 关键字引发的编译错误
../src/basic/missing.h:528:17: 错误:expected identifier before numeric constant
#define MS_MOVE 8192
^~~~
In file included from ../src/basic/architecture.h:25,
from ../src/test/test-tables.c:21:
../src/basic/macro.h:423:18: 错误:expected ‘)’ before ‘__attribute__’
#define noreturn __attribute__((noreturn))
^~~~~~~~~~~~~
In file included from /usr/include/gcrypt.h:30,
from ../src/journal/journal-file.h:26,
from ../src/journal/journald-server.h:31,
from ../src/test/test-tables.c:30:
/usr/include/gpg-error.h:1563:46: 错误:expected ‘,’ or ‘;’ before ‘)’ token
void gpgrt_log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2);
^~~~~~~~~~~~~~~~~~~~
In file included from ../src/basic/architecture.h:25,
from ../src/test/test-tables.c:21:
- 解决方法补丁:basic-macros-rename-noreturn-into-noreturn-8456.patch,因为此补丁上游已有,就不再粘贴复制,此补丁是解决了编译时的 C11 兼容性问题。
- PATCHID: 848e863acc51ecfb0f3955c498874588201d9130
转载于:https://www.jianshu.com/p/bfb941d68972
上一篇:
C11并发 std::promise
下一篇: 确保对象的唯一性——单例模式 (四)