Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Petr Pisar Newsgroups: gnu.utils.bug Subject: Re: [sharutils] Does not compile with -fno-common Date: Thu, 23 Jan 2020 16:19:04 +0100 Lines: 202 Approved: bug-gnu-utils@gnu.org Message-ID: References: <20200123151904.GA16884@dhcp-0-146.brq.redhat.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eAbsdosE1cNLO4uF" X-Trace: usenet.stanford.edu 1579792757 7672 209.51.188.17 (23 Jan 2020 15:19:17 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-gnu-utils@gnu.org Envelope-to: bug-gnu-utils@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579792750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7YsTMqu6vSlVkJbmQFlPAYe2J2VvCS6ceE2Ee4TV/f0=; b=Iqhf3OSinCLkabk+SPYGxHKbmXwW3a1ibM0M90Dk09UaDLNx0T/HN03jIAj0hDBHZZfQNJ 9jkzCLW8Vw/166ofEB63JRiDW9EXpMT6djutX0wTvdCQclwp/bRHxqhISDGK21BhiqRFcS ZzUOd9zWWLAX2L9lHQbK1Xnv/MnNf2o= X-MC-Unique: IVaGiGW9N0mxxXrTXcD9pQ-1 X-Authentication-Warning: dhcp-0-146.brq.redhat.com: petr set sender to ppisar@redhat.com using -f Mail-Followup-To: bug-gnu-utils@gnu.org In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: bug-gnu-utils@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU utilities List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20200123151904.GA16884@dhcp-0-146.brq.redhat.com> X-Mailman-Original-References: Xref: csiph.com gnu.utils.bug:2273 --eAbsdosE1cNLO4uF Content-Type: multipart/mixed; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline --J/dobhs11T7y2rNN Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 20, 2020 at 07:47:15PM +0100, Christian Voegl wrote: > Trying to build sharutils 4.15.2 with=C2=A0 -fno-common fails with >=20 > [=C2=A0=C2=A0 30s] > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/l= d: > shar-opts.o:(.data.rel.ro.local+0x0): multiple definition of > `program_name'; shar.o:(.rodata+0x10): first defined here > [=C2=A0=C2=A0 30s] > /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/l= d: > ../lib/libgnu.a(md5.o): in function `md5_stream': > [=C2=A0=C2=A0 30s] md5.c:(.text+0x15d): multiple definition of `md5_st= ream'; > shar.o:shar.c:(.text+0x28): first defined here >=20 >=20 > As -fno-common is going to be the default, I think this should be fixed. >=20 Please try the two patches attached. The first one should fix the program_n= ame symbol. The second the md5_stream symbol. I was able to reproduce the first one, but not the second one. (Depiste tha fact I do not link to openssl.) -- Petr --J/dobhs11T7y2rNN Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="sharutils-4.15.2-Fix-building-with-GCC-10.patch" Content-Transfer-Encoding: quoted-printable >From ec4ceb632abc0d54061269bc779459e13172f264 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Petr=3D20P=3DC3=3DADsa=3DC5=3D99?=3D Date: Thu, 23 Jan 2020 15:42:41 +0100 Subject: [PATCH 1/2] Fix building with GCC 10 MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit GCC 10 defaults to -fno-common that results into errors on multiple global variable definitions: /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: shar-opts.o:(.data.rel.ro.local+0x0): multiple definition of `program_name'; shar.o:(.rodata+0x10): first defined here This patch fixes it by changing the definitions in header files into extern declarations. Signed-off-by: Petr P=C3=ADsa=C5=99 --- src/shar-opts.h | 2 +- src/shar-std.def | 2 +- src/unshar-opts.h | 2 +- src/uudecode-opts.h | 2 +- src/uuencode-opts.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/shar-opts.h b/src/shar-opts.h index 75dcae2..5055d1c 100644 --- a/src/shar-opts.h +++ b/src/shar-opts.h @@ -352,7 +352,7 @@ extern "C" { * global exported definitions */ #include "local.h" -char const * const program_name; +extern char const * const program_name; =20 extern bool initialization_done; extern int optidx; diff --git a/src/shar-std.def b/src/shar-std.def index ed06b77..a28f61c 100644 --- a/src/shar-std.def +++ b/src/shar-std.def @@ -41,7 +41,7 @@ no-misuse-usage; usage-message; die-code; =20 -export =3D '#include "local.h"'"\nchar const * const program_name;"; +export =3D '#include "local.h"'"\nextern char const * const program_name;= "; =20 #shell echo "include =3D 'char const * const program_name =3D \"${progname}\";';" diff --git a/src/unshar-opts.h b/src/unshar-opts.h index 2c3febe..9ebe2fc 100644 --- a/src/unshar-opts.h +++ b/src/unshar-opts.h @@ -192,7 +192,7 @@ extern "C" { extern size_t separator_str_len; =20 #include "local.h" -char const * const program_name; +extern char const * const program_name; =20 =20 /* * * * * * diff --git a/src/uudecode-opts.h b/src/uudecode-opts.h index 29b3b5c..5494289 100644 --- a/src/uudecode-opts.h +++ b/src/uudecode-opts.h @@ -170,7 +170,7 @@ extern "C" { * global exported definitions */ #include "local.h" -char const * const program_name; +extern char const * const program_name; =20 =20 /* * * * * * diff --git a/src/uuencode-opts.h b/src/uuencode-opts.h index e71c9b8..d6ec03e 100644 --- a/src/uuencode-opts.h +++ b/src/uuencode-opts.h @@ -166,7 +166,7 @@ extern "C" { * global exported definitions */ #include "local.h" -char const * const program_name; +extern char const * const program_name; =20 =20 /* * * * * * --=20 2.21.1 --J/dobhs11T7y2rNN Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="sharutils-4.15.2-Do-not-include-lib-md5.c-into-src-shar.c.patch" Content-Transfer-Encoding: quoted-printable >From 4c47a36fb6e2e4349995376cee063bb37d4e68e3 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Petr=3D20P=3DC3=3DADsa=3DC5=3D99?=3D Date: Thu, 23 Jan 2020 15:57:05 +0100 Subject: [PATCH 2/2] Do not include lib/md5.c into src/shar.c MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit lib/md5.o is part of libgnu.a that is linked to shar. There is no point in linking md5.o twice into shar executable. Moreover SuSE reports that this triggers a linking error with GCC 10: /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: ../lib/libgnu.a(md5.o): in function `md5_stream': [ 30s] md5.c:(.text+0x15d): multiple definition of `md5_stream'; shar.o:shar.c:(.text+0x28): first defined here Signed-off-by: Petr P=C3=ADsa=C5=99 --- src/shar.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/shar.c b/src/shar.c index 11cbada..6d7ed1d 100644 --- a/src/shar.c +++ b/src/shar.c @@ -53,7 +53,6 @@ static const char cright_years_z[] =3D =20 #include "inttostr.h" #include "liballoca.h" -#include "md5.c" #include "md5.h" #include "quotearg.h" #include "xalloc.h" --=20 2.21.1 --J/dobhs11T7y2rNN-- --eAbsdosE1cNLO4uF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABEIAB0WIQRLUoOT5qOw37LvOmQSycXHZ8b6ogUCXim5WwAKCRASycXHZ8b6 ojrtAP9nntlDBFcp9eLX3WraTqoqz/3TLbZIjw9oREK9SrrDzAD9GNZXhFXJWFY6 ZwkuwdTe5x/4GcVEG8BidzrSTBmK2EE= =0els -----END PGP SIGNATURE----- --eAbsdosE1cNLO4uF--