Re: Failure to build GPC under Linux

John Ries <[email protected]> Sat, 16 May 2020 13:55:01 -0700
Newsgroups gmane.comp.compilers.gpc
Message-ID <CAKqWTQKVqDDVsw4FTR1_Y8n9ThrCpiUVaK9-bzjrFpQWwrcHfg@mail.gmail.com>
--===============4771000962025240330==
Content-Type: multipart/alternative; boundary="0000000000005da2b705a5ca25ae"

--0000000000005da2b705a5ca25ae
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Things have definitely improved.  After applying sum1.diff (I'm running
Fedora, which is not a Debian derivative), I was able to build gpc
configured as follows:

SRCDIR=3D../gcc-4.3.5
$SRCDIR/configure --program-suffix=3D-4.3.5 --disable-shared \
                  --enable-languages=3Dpascal --disable-multilib \
                  --disable-mapped-location

But when running "make check", I get the following:

cc -DHAVE_CONFIG_H -g -O2 -I..
-I../../../gcc-4.3.5/libiberty/testsuite/../../include  -o test-demangle \
../../../gcc-4.3.5/libiberty/testsuite/test-demangle.c ../libiberty.a
../../../gcc-4.3.5/libiberty/testsuite/test-demangle.c:49:1: error:
conflicting types for =E2=80=98getline=E2=80=99
   49 | getline(buf)
      | ^~~~~~~
In file included from
../../../gcc-4.3.5/libiberty/testsuite/test-demangle.c:26:
/usr/include/stdio.h:616:18: note: previous declaration of =E2=80=98getline=
=E2=80=99 was
here
  616 | extern __ssize_t getline (char **__restrict __lineptr,
      |                  ^~~~~~~
../../../gcc-4.3.5/libiberty/testsuite/test-demangle.c: In function
=E2=80=98protect_end=E2=80=99:
../../../gcc-4.3.5/libiberty/testsuite/test-demangle.c:105:21: warning:
implicit declaration of function =E2=80=98getpagesize=E2=80=99
[-Wimplicit-function-declaration]
  105 |   size_t pagesize =3D getpagesize();

Cause for concern?

I am going to go ahead and install and see if I can build SAV.

John L. Ries
26215 197th Ave. SE
Covington, WA  98042
(435) 867-8885


On Sat, May 16, 2020 at 6:34 AM Waldek Hebisch <[email protected]>
wrote:

> On Sun, May 10, 2020 at 07:18:01PM -0700, John Ries wrote:
> > The error messages are:
> >
> > ../../gcc-4.3.5/gcc/toplev.c:545:1: error: redefinition of
> ???floor_log2???
> >   545 | floor_log2 (unsigned HOST_WIDE_INT x)
> >       | ^~~~~~~~~~
> > In file included from ../../gcc-4.3.5/gcc/toplev.c:58:
> > ../../gcc-4.3.5/gcc/toplev.h:177:1: note: previous definition of
> > ???floor_log2??? wa
> > s here
> >   177 | floor_log2 (unsigned HOST_WIDE_INT x)
> >       | ^~~~~~~~~~
> > ../../gcc-4.3.5/gcc/toplev.c:580:1: error: redefinition of
> ???exact_log2???
> >   580 | exact_log2 (unsigned HOST_WIDE_INT x)
> >       | ^~~~~~~~~~
> > In file included from ../../gcc-4.3.5/gcc/toplev.c:58:
> > ../../gcc-4.3.5/gcc/toplev.h:183:1: note: previous definition of
> > ???exact_log2??? wa
> > s here
> >   183 | exact_log2 (unsigned HOST_WIDE_INT x)
> >       | ^~~~~~~~~~
> >
> > There is probably a GCC flag to allow such duplicate definitions, but I
> > haven't found it yet (apparently, it isn't -Wnoduplicate-decl-specifier=
).
> > I'm using the GCC 4.3.5 codebase and building with GCC 9.3.1 under Fedo=
ra
> > 31 (x86_64).
> >
> > I'm running configure as follows:
> >
> > SRCDIR=3D../gcc-4.3.5
> > export CFLAGS =3D"-fkeep-inline-functions -W -Wall -Wwrite-strings \
> >                 -Wstrict-prototypes -Wmissing-prototypes \
> >                 -Wold-style-definition -Wmissing-format-attribute \
> >                 -pedantic -Wno-long-long -Wno-variadic-macros \
> >                 -Wno-overlength-strings -fno-common \
> >                 -Wnoduplicate-decl-specifier"
> >
> > $SRCDIR/configure --program-suffix=3D-4.3.5 --disable-shared \
> >                   --enable-languages=3Dpascal
> >
> > The definition of CFLAGS was my attempt to allow the code to compile.  =
It
> > made no difference.
> >
> > Any ideas as to how to proceed would be greatly appreciated.
>
> To compile with gcc-4.3.6 on Debian 10 I need two attached patches.
> First one fixes to problem above and a few other problems.
>
> The second patch is a gross hack, to work around major breakage
> due to changes in Debian.  Namely, Debian moved several critical
> files to archtecture specific subdirectories.  For example,
> instead of
>
> /usr/lib/crti.o
>
> there is
>
> /usr/lib/x86_64-linux-gnu/crti.o
>
> (or analogous thing for different architecture).  Notably,
> compilation of GPC is affected by location of C include files.
> If most C include files are in
>
> /usr/include/x86_64-linux-gnu
>
> then your system is affected.  ATM I do not know which distributions
> use this scheme and which switched to Debian way.  The
> second patch somewhat handles this issue.  It is unstatisfactory,
> as it hardcodes 'x86_64-linux-gnu' and there is some (small ???)
> breakage when compiling C files (this affects mixed Pascal and C
> projects).  Anyway, with both patches applied I can compile
> GPC on top of gcc-4.3.6 in Debian 10 using configure line:
>
> ../gcc-4.3.6.nn2/configure --enable-languages=3Dc,pascal --disable-multil=
ib
> --disable-mapped-location
>
> Note that I always compile in directory separate from sources,
> that is reason for '../' at the start. '.nn2' suffix is to
> indicate that this is patched gcc (with two attached patches and
> gcc-4.3.5 patch).
>
>
> --
>                               Waldek Hebisch
>

--0000000000005da2b705a5ca25ae
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Things have definitely improved.=C2=A0 After applying=
 sum1.diff (I&#39;m running Fedora, which is not a Debian derivative), I wa=
s able to build gpc configured as follows:</div><div><br></div><div>SRCDIR=
=3D../gcc-4.3.5<br>$SRCDIR/configure --program-suffix=3D-4.3.5 --disable-sh=
ared \<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 --=
enable-languages=3Dpascal --disable-multilib \<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 --disable-mapped-location</div><div>=
<br></div><div>But when running &quot;make check&quot;, I get the following=
:</div><div><br></div><div>cc -DHAVE_CONFIG_H -g -O2 -I.. -I../../../gcc-4.=
3.5/libiberty/testsuite/../../include =C2=A0-o test-demangle \<br>	../../..=
/gcc-4.3.5/libiberty/testsuite/test-demangle.c ../libiberty.a<br>../../../g=
cc-4.3.5/libiberty/testsuite/test-demangle.c:49:1: error: conflicting types=
 for =E2=80=98getline=E2=80=99<br>=C2=A0 =C2=A049 | getline(buf)<br>=C2=A0 =
=C2=A0 =C2=A0 | ^~~~~~~<br>In file included from ../../../gcc-4.3.5/libiber=
ty/testsuite/test-demangle.c:26:<br>/usr/include/stdio.h:616:18: note: prev=
ious declaration of =E2=80=98getline=E2=80=99 was here<br>=C2=A0 616 | exte=
rn __ssize_t getline (char **__restrict __lineptr,<br>=C2=A0 =C2=A0 =C2=A0 =
| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^~~~~~~<br>=
../../../gcc-4.3.5/libiberty/testsuite/test-demangle.c: In function =E2=80=
=98protect_end=E2=80=99:<br>../../../gcc-4.3.5/libiberty/testsuite/test-dem=
angle.c:105:21: warning: implicit declaration of function =E2=80=98getpages=
ize=E2=80=99 [-Wimplicit-function-declaration]<br>=C2=A0 105 | =C2=A0 size_=
t pagesize =3D getpagesize();<br>=C2=A0</div><div>Cause for concern?<br><br=
></div><div>I am going to go ahead and install and see if I can build SAV.<=
br></div><div><br> </div><div><div><div dir=3D"ltr" class=3D"gmail_signatur=
e" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr=
"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><d=
iv dir=3D"ltr"><div><div><div>John L. Ries</div><div>26215 197th Ave. SE<br=
></div><div>Covington, WA=C2=A0 98042<br></div>(435) 867-8885<br></div></di=
v></div></div></div></div></div></div></div></div></div></div></div></div><=
/div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Sat, May 16, 2020 at 6:34 AM Waldek Hebisch &lt;<a href=
=3D"mailto:[email protected]">[email protected]</a>&gt; wrote=
:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, May 10=
, 2020 at 07:18:01PM -0700, John Ries wrote:<br>
&gt; The error messages are:<br>
&gt; <br>
&gt; ../../gcc-4.3.5/gcc/toplev.c:545:1: error: redefinition of ???floor_lo=
g2???<br>
&gt;=C2=A0 =C2=A0545 | floor_log2 (unsigned HOST_WIDE_INT x)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0| ^~~~~~~~~~<br>
&gt; In file included from ../../gcc-4.3.5/gcc/toplev.c:58:<br>
&gt; ../../gcc-4.3.5/gcc/toplev.h:177:1: note: previous definition of<br>
&gt; ???floor_log2??? wa<br>
&gt; s here<br>
&gt;=C2=A0 =C2=A0177 | floor_log2 (unsigned HOST_WIDE_INT x)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0| ^~~~~~~~~~<br>
&gt; ../../gcc-4.3.5/gcc/toplev.c:580:1: error: redefinition of ???exact_lo=
g2???<br>
&gt;=C2=A0 =C2=A0580 | exact_log2 (unsigned HOST_WIDE_INT x)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0| ^~~~~~~~~~<br>
&gt; In file included from ../../gcc-4.3.5/gcc/toplev.c:58:<br>
&gt; ../../gcc-4.3.5/gcc/toplev.h:183:1: note: previous definition of<br>
&gt; ???exact_log2??? wa<br>
&gt; s here<br>
&gt;=C2=A0 =C2=A0183 | exact_log2 (unsigned HOST_WIDE_INT x)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0| ^~~~~~~~~~<br>
&gt; <br>
&gt; There is probably a GCC flag to allow such duplicate definitions, but =
I<br>
&gt; haven&#39;t found it yet (apparently, it isn&#39;t -Wnoduplicate-decl-=
specifier).<br>
&gt; I&#39;m using the GCC 4.3.5 codebase and building with GCC 9.3.1 under=
 Fedora<br>
&gt; 31 (x86_64).<br>
&gt; <br>
&gt; I&#39;m running configure as follows:<br>
&gt; <br>
&gt; SRCDIR=3D../gcc-4.3.5<br>
&gt; export CFLAGS =3D&quot;-fkeep-inline-functions -W -Wall -Wwrite-string=
s \<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-Wstrict-=
prototypes -Wmissing-prototypes \<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-Wold-sty=
le-definition -Wmissing-format-attribute \<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-pedantic=
 -Wno-long-long -Wno-variadic-macros \<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-Wno-over=
length-strings -fno-common \<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-Wnodupli=
cate-decl-specifier&quot;<br>
&gt; <br>
&gt; $SRCDIR/configure --program-suffix=3D-4.3.5 --disable-shared \<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--=
enable-languages=3Dpascal<br>
&gt; <br>
&gt; The definition of CFLAGS was my attempt to allow the code to compile.=
=C2=A0 It<br>
&gt; made no difference.<br>
&gt; <br>
&gt; Any ideas as to how to proceed would be greatly appreciated.<br>
<br>
To compile with gcc-4.3.6 on Debian 10 I need two attached patches.<br>
First one fixes to problem above and a few other problems.<br>
<br>
The second patch is a gross hack, to work around major breakage<br>
due to changes in Debian.=C2=A0 Namely, Debian moved several critical<br>
files to archtecture specific subdirectories.=C2=A0 For example,<br>
instead of<br>
<br>
/usr/lib/crti.o<br>
<br>
there is<br>
<br>
/usr/lib/x86_64-linux-gnu/crti.o<br>
<br>
(or analogous thing for different architecture).=C2=A0 Notably,<br>
compilation of GPC is affected by location of C include files.<br>
If most C include files are in<br>
<br>
/usr/include/x86_64-linux-gnu<br>
<br>
then your system is affected.=C2=A0 ATM I do not know which distributions<b=
r>
use this scheme and which switched to Debian way.=C2=A0 The<br>
second patch somewhat handles this issue.=C2=A0 It is unstatisfactory,<br>
as it hardcodes &#39;x86_64-linux-gnu&#39; and there is some (small ???)<br=
>
breakage when compiling C files (this affects mixed Pascal and C<br>
projects).=C2=A0 Anyway, with both patches applied I can compile<br>
GPC on top of gcc-4.3.6 in Debian 10 using configure line:<br>
<br>
../gcc-4.3.6.nn2/configure --enable-languages=3Dc,pascal --disable-multilib=
 --disable-mapped-location<br>
<br>
Note that I always compile in directory separate from sources,<br>
that is reason for &#39;../&#39; at the start. &#39;.nn2&#39; suffix is to<=
br>
indicate that this is patched gcc (with two attached patches and<br>
gcc-4.3.5 patch).<br>
<br>
<br>
-- <br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Waldek Hebisch<br>
</blockquote></div>

--0000000000005da2b705a5ca25ae--


--===============4771000962025240330==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc

--===============4771000962025240330==--