mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-17 09:56:59 +02:00
app-emulation/open-vmdk: fix build issues with gcc 10
As gcc 10 or newer defaults to `-fno-common`, we need to define only once in a *.c file, instead of *.h that can be imported multiple times by *.c files. See also https://github.com/vmware/open-vmdk/pull/13.
This commit is contained in:
parent
f2464ad27b
commit
257a513e77
@ -0,0 +1,51 @@
|
||||
From 74dffbca5d6fa37ed4ecd9b3a75206e33497e3df Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <74dffbca5d6fa37ed4ecd9b3a75206e33497e3df.1644245904.git.dpark@linux.microsoft.com>
|
||||
From: Dongsu Park <dpark@linux.microsoft.com>
|
||||
Date: Mon, 7 Feb 2022 15:44:24 +0100
|
||||
Subject: [PATCH] vmdk: fix build issues with gcc 10 or newer
|
||||
|
||||
As gcc 10 or newer defaults to `-fno-common`, we need to define only
|
||||
once in a *.c file, instead of *.h that can be imported multiple times
|
||||
by *.c files.
|
||||
|
||||
Otherwise, build would fail like:
|
||||
```
|
||||
.../x86_64-pc-linux-gnu/bin/ld:
|
||||
../build/vmdk/mkdisk.o:.../vmdk/diskinfo.h:38:
|
||||
multiple definition of `toolsVersion';
|
||||
../build/vmdk/flat.o:.../vmdk/diskinfo.h:38: first defined here
|
||||
```
|
||||
---
|
||||
vmdk/diskinfo.h | 2 +-
|
||||
vmdk/mkdisk.c | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/vmdk/diskinfo.h b/vmdk/diskinfo.h
|
||||
index 2b58f432..f4f94419 100644
|
||||
--- a/vmdk/diskinfo.h
|
||||
+++ b/vmdk/diskinfo.h
|
||||
@@ -35,7 +35,7 @@ struct DiskInfo {
|
||||
const DiskInfoVMT *vmt;
|
||||
};
|
||||
|
||||
-char *toolsVersion; /* toolsVersion in metadata */
|
||||
+extern char *toolsVersion; /* toolsVersion in metadata */
|
||||
|
||||
DiskInfo *Flat_Open(const char *fileName);
|
||||
DiskInfo *Flat_Create(const char *fileName, off_t capacity);
|
||||
diff --git a/vmdk/mkdisk.c b/vmdk/mkdisk.c
|
||||
index b6c0cc94..b66b7d5d 100644
|
||||
--- a/vmdk/mkdisk.c
|
||||
+++ b/vmdk/mkdisk.c
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
|
||||
+char *toolsVersion; /* toolsVersion in metadata */
|
||||
+
|
||||
static int
|
||||
copyData(DiskInfo *dst,
|
||||
off_t dstOffset,
|
||||
--
|
||||
2.34.1
|
||||
|
@ -21,6 +21,10 @@ IUSE=""
|
||||
DEPEND=""
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/vmdk-fix-build-issues-with-gcc-10-or-newer.patch"
|
||||
)
|
||||
|
||||
src_install() {
|
||||
emake DESTDIR="${D}" install
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user