우분투 20.04 e2fsprogs patch

우분투 20.04 버전에 설치된 glibc 버전은 2.31이며 C++ 표준으르 따르기 위해 <sys/type.h>에서 <sys/sysmacros.h>가 제거되어 아래의 빌드 에러가 발생한다.

| gcc  -L/media/gon/proj/RDK/temp/build-raspberrypi-rdk-hybrid/tmp/sysroots/x86_64-linux/usr/lib -L/media/gon/proj/RDK/temp/build-raspberrypi-rdk-hybrid/tmp/sysroots/x86_64-linux/lib -Wl,-rpath-link,/media/gon/proj/RDK/temp/build-raspberrypi-rdk-hybrid/tmp/sysroots/x86_64-linux/usr/lib -Wl,-rpath-link,/media/gon/proj/RDK/temp/build-raspberrypi-rdk-hybrid/tmp/sysroots/x86_64-linux/lib -Wl,-rpath,/media/gon/proj/RDK/temp/build-raspberrypi-rdk-hybrid/tmp/sysroots/x86_64-linux/usr/lib -Wl,-rpath,/media/gon/proj/RDK/temp/build-raspberrypi-rdk-hybrid/tmp/sysroots/x86_64-linux/lib -Wl,-O1  -Wl,-rpath-link,../lib -rdynamic -o e2fsck unix.o e2fsck.o super.o pass1.o pass1b.o pass2.o pass3.o pass4.o pass5.o journal.o badblocks.o util.o dirinfo.o dx_dirinfo.o ehandler.o problem.o message.o quota.o recovery.o region.o revoke.o ea_refcount.o rehash.o logfile.o sigcatcher.o  readahead.o extents.o  ../lib/libsupport.a ../lib/libext2fs.so ../lib/libcom_err.so  -L/media/gon/proj/RDK/temp/build-raspberrypi-rdk-hybrid/tmp/sysroots/x86_64-linux/usr/lib -lblkid  -L/media/gon/proj/RDK/temp/build-raspberrypi-rdk-hybrid/tmp/sysroots/x86_64-linux/usr/lib -luuid   ../lib/libe2p.so -ldl -lblkid
| /usr/bin/ld: ../lib/libext2fs.so: undefined reference to `major'
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:420: e2fsck] Error 1

아래와 같이 빌드 에러가 발생하는 소스 파일에 <sys/sysmacros.h>를 포함시켜 해결할 수 있다.

diff -Nura git_old/debugfs/debugfs.c git_new/debugfs/debugfs.c
--- git_old/debugfs/debugfs.c	2020-11-03 12:41:03.195705000 +0900
+++ git_new/debugfs/debugfs.c	2020-11-05 12:54:42.969980867 +0900
@@ -25,6 +25,9 @@
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
 #include <fcntl.h>
 
 #include "debugfs.h"
diff -Nura git_old/lib/blkid/devname.c git_new/lib/blkid/devname.c
--- git_old/lib/blkid/devname.c	2020-11-03 12:41:01.923701000 +0900
+++ git_new/lib/blkid/devname.c	2020-11-05 12:43:12.377513245 +0900
@@ -36,6 +36,9 @@
 #if HAVE_SYS_MKDEV_H
 #include <sys/mkdev.h>
 #endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
 #include <time.h>
 
 #include "blkidP.h"
diff -Nura git_old/lib/blkid/devno.c git_new/lib/blkid/devno.c
--- git_old/lib/blkid/devno.c	2020-11-03 12:41:01.923701000 +0900
+++ git_new/lib/blkid/devno.c	2020-11-05 12:43:58.234172532 +0900
@@ -31,6 +31,9 @@
 #if HAVE_SYS_MKDEV_H
 #include <sys/mkdev.h>
 #endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
 
 #include "blkidP.h"
 
diff -Nura git_old/lib/ext2fs/finddev.c git_new/lib/ext2fs/finddev.c
--- git_old/lib/ext2fs/finddev.c	2020-11-03 12:41:01.951701000 +0900
+++ git_new/lib/ext2fs/finddev.c	2020-11-05 12:44:22.378511700 +0900
@@ -31,6 +31,9 @@
 #if HAVE_SYS_MKDEV_H
 #include <sys/mkdev.h>
 #endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
 
 #include "ext2_fs.h"
 #include "ext2fs.h"
diff -Nura git_old/lib/ext2fs/ismounted.c git_new/lib/ext2fs/ismounted.c
--- git_old/lib/ext2fs/ismounted.c	2020-11-03 12:41:01.955701000 +0900
+++ git_new/lib/ext2fs/ismounted.c	2020-11-05 12:45:18.167276073 +0900
@@ -44,6 +44,9 @@
 #include <sys/param.h>
 #include <sys/mount.h>
 #endif /* HAVE_GETMNTINFO */
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
 #include <string.h>
 #include <sys/stat.h>
 #if HAVE_SYS_TYPES_H
diff -Nura git_old/misc/create_inode.c git_new/misc/create_inode.c
--- git_old/misc/create_inode.c	2020-11-03 12:41:04.327708000 +0900
+++ git_new/misc/create_inode.c	2020-11-05 12:48:56.638054292 +0900
@@ -26,6 +26,10 @@
 #include <ext2fs/ext2_types.h>
 #include <ext2fs/fiemap.h>
 
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
+
 #include "create_inode.h"
 #include "support/nls-enable.h"
 
diff -Nura git_old/misc/mk_hugefiles.c git_new/misc/mk_hugefiles.c
--- git_old/misc/mk_hugefiles.c	2020-11-03 12:41:01.971701000 +0900
+++ git_new/misc/mk_hugefiles.c	2020-11-05 12:46:00.159834979 +0900
@@ -35,6 +35,9 @@
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
 #include <libgen.h>
 #include <limits.h>
 #include <blkid/blkid.h>