systemd與C11標準兼容

systemd與C11標準兼容

從 systemd項目的 github 主線上拉取其源代碼,但發現 tag 爲 v238、v239 出現編譯問題,去要再打兼容性補丁。

拉取 github 上的 systemd 主線分支編譯 v238-systemd,編譯不通過。

一. 編譯v238-systemd兩次編譯報錯

  1. 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
  1. 由 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
github 項目主頁: https://github.com/lina-not-linus

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章