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 Fedora
> 31 (x86_64).
>
> I'm running configure as follows:
>
> SRCDIR=../gcc-4.3.5
> export CFLAGS ="-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=-4.3.5 --disable-shared \
> --enable-languages=pascal
>
> 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=c,pascal --disable-multilib --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