MinixのMultipleDefinition
Minixのビルドエラー
MinixをUbuntu21…gcc10でビルドするとMultipleDefinitionエラーが出る。
明らかにソースコードがおかしいのだけど、古いgcc(8とか)だと問題ないようだ。
これ前もやった気がするので、もうしないようにパッチ登録しておきます。。
クイックハックなので動くかどうかは見てない
From 1e95e04e7ed7e1b01ff1e1c99433b8aeede22315 Mon Sep 17 00:00:00 2001 From: Yusuke SHIROYAMA <shiroyagiyuu@gmail.com> Date: Sun, 4 Jul 2021 09:16:22 +0900 Subject: [PATCH] fix multiple definition fix error on gcc10 --- bin/pax/extern.h | 1 - bin/pax/options.c | 1 + sbin/newfs_udf/newfs_udf.h | 4 ++-- sbin/newfs_udf/udf_create.c | 3 +++ usr.bin/make/main.c | 1 + usr.bin/make/make.h | 2 +- usr.sbin/installboot/machines.c | 8 ++++++-- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bin/pax/extern.h b/bin/pax/extern.h index 298600c2d..94ee13911 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -204,7 +204,6 @@ void options(int, char **); OPLIST * opt_next(void); int bad_opt(void); int mkpath(char *); -char *chdname; #if !HAVE_NBTOOL_CONFIG_H int do_chroot; #endif diff --git a/bin/pax/options.c b/bin/pax/options.c index 1af5fe4b7..ddb6a0e54 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -76,6 +76,7 @@ __RCSID("$NetBSD: options.c,v 1.116 2015/04/11 15:41:33 christos Exp $"); /* * Routines which handle command line options */ +char *chdname; static int nopids; /* tar mode: suppress "pids" for -p option */ static char flgch[] = FLGCH; /* list of all possible flags (pax) */ diff --git a/sbin/newfs_udf/newfs_udf.h b/sbin/newfs_udf/newfs_udf.h index 1c21a0b48..e9ff149a5 100644 --- a/sbin/newfs_udf/newfs_udf.h +++ b/sbin/newfs_udf/newfs_udf.h @@ -53,8 +53,8 @@ extern float meta_fract; /* shared structure between udf_create.c users */ -struct udf_create_context context; -struct udf_disclayout layout; +extern struct udf_create_context context; +extern struct udf_disclayout layout; /* prototypes */ int udf_write_sector(void *sector, uint64_t location); diff --git a/sbin/newfs_udf/udf_create.c b/sbin/newfs_udf/udf_create.c index ef92874af..856a6746b 100644 --- a/sbin/newfs_udf/udf_create.c +++ b/sbin/newfs_udf/udf_create.c @@ -45,6 +45,9 @@ __RCSID("$NetBSD: udf_create.c,v 1.25 2015/06/16 23:18:55 christos Exp $"); #include "unicode.h" #include "udf_create.h" +/* shared structure between udf_create.c users */ +struct udf_create_context context; +struct udf_disclayout layout; #if 0 # ifndef DEBUG diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 73f4aaa9c..66dd3e8d0 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -160,6 +160,7 @@ static Lst variables; /* list of variables to print */ int maxJobs; /* -j argument */ static int maxJobTokens; /* -j argument */ Boolean compatMake; /* -B argument */ +FILE *debug_file; /* Output written here - default stdout */ int debug; /* -d argument */ Boolean debugVflag; /* -dV */ Boolean noExecute; /* -n flag */ diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index f162ef670..968710d05 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -440,7 +440,7 @@ extern pid_t myPid; * There is one bit per module. It is up to the module what debug * information to print. */ -FILE *debug_file; /* Output written here - default stdout */ +extern FILE *debug_file; /* Output written here - default stdout */ extern int debug; #define DEBUG_ARCH 0x00001 #define DEBUG_COND 0x00002 diff --git a/usr.sbin/installboot/machines.c b/usr.sbin/installboot/machines.c index 357652b83..96dc99419 100644 --- a/usr.sbin/installboot/machines.c +++ b/usr.sbin/installboot/machines.c @@ -46,15 +46,19 @@ __RCSID("$NetBSD: machines.c,v 1.39 2014/02/24 07:23:44 skrll Exp $"); * isn't built with all the architectures defined. * A lot simpler that conditionally including the definitions themselves. */ +extern struct ib_mach + ib_mach_amd64, + ib_mach_i386; + struct ib_mach ib_mach_alpha, - ib_mach_amd64, +/* ib_mach_amd64, */ ib_mach_amiga, ib_mach_emips, ib_mach_ews4800mips, ib_mach_hp300, ib_mach_hppa, - ib_mach_i386, +/* ib_mach_i386, */ ib_mach_landisk, ib_mach_macppc, ib_mach_news68k, -- 2.30.2