errors when building gcc-9.1.0 under cygwin

0

I received this error:

>/usr/local/contrib/gcc-9.1.0/libbacktrace/pecoff.c: In function ‘coff_add’:
/usr/local/contrib/gcc-9.1.0/libbacktrace/pecoff.c:656:37: error: pointer of type ‘void *’ used in arithmetic [-Werror=pointer-arith]
  656 |       memcpy (&fhdr, fhdr_view.data + 4, sizeof fhdr);
      |                                     ^
/usr/local/contrib/gcc-9.1.0/libbacktrace/pecoff.c:690:22: error: pointer of type ‘void *’ used in arithmetic [-Werror=pointer-arith]
  690 |     (sects_view.data + fhdr.size_of_optional_header);
      |                      ^
/usr/local/contrib/gcc-9.1.0/libbacktrace/pecoff.c:730:45: error: pointer of type ‘void *’ used in arithmetic [-Werror=pointer-arith]
  730 |       str_size = coff_read4 (syms_view.data + syms_size);
      |                                             ^
cc1: all warnings being treated as errors
make[3]: *** [Makefile:1190: pecoff.lo] Error 1
make[3]: Leaving directory '/usr/local/contrib/gcc_build/x86_64-pc-cygwin/libbacktrace'
make[2]: *** [Makefile:973: all] Error 2
make[2]: Leaving directory '/usr/local/contrib/gcc_build/x86_64-pc-cygwin/libbacktrace'
make[1]: *** [Makefile:19155: all-target-libbacktrace] Error 2
make[1]: Leaving directory '/usr/local/contrib/gcc_build'
make: *** [Makefile:996: all] Error 2

when make was executing the following:

libtool: compile:  /usr/local/contrib/gcc_build/./gcc/xgcc -B/usr/local/contrib/gcc_build/./gcc/ -B/usr/local/x86_64-pc-cygwin/bin/ -B/usr/local/x86_64-pc-cygwin/lib/ -isystem /usr/local/x86_64-pc-cygwin/include -isystem /usr/local/x86_64-pc-cygwin/sys-include -DHAVE_CONFIG_H -I. -I/usr/local/contrib/gcc-9.1.0/libbacktrace -I /usr/local/contrib/gcc-9.1.0/libbacktrace/../include -I /usr/local/contrib/gcc-9.1.0/libbacktrace/../libgcc -I ../libgcc -funwind-tables -frandom-seed=pecoff.lo -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual -Werror -g -O2 -pedantic -fomit-frame-pointer -m64 -mtune=sandybridge -march=sandybridge -c /usr/local/contrib/gcc-9.1.0/libbacktrace/pecoff.c -o pecoff.o

my make version is GNU Make 4.2.1 for x86_64-unknown-cygwin and my current GCC is 7.4.0

I typed the configure program inside the source as the following,

bash
/usr/local/contrib/gcc-9.1.0/configure --enable-static --disable-shared --with-mpfr-include=/usr/local/include/ --with-mpfr-lib=/usr/local/lib/ --with-mpc-include=/usr/local/include/ --with-mpc-lib=/usr/local/lib/ --with-gmp-include=/usr/local/include/ --with-gmp-lib=/usr/local/lib/ CC=gcc CFLAGS="-O2 -pedantic -fomit-frame-pointer -m64 -mtune=sandybridge -march=sandybridge"

for matter of compatibility with the other configurations I made for the dependencies mpfr, mpc and gmp all of which shared the same compiling options. --enable-static and --disable-shared is for the configuration to not look for shared libraries, choosing static ones instead, otherwise I run into errors building the dependencies, because gmp is built on static libraries

project on fossies website: gcc-9.1.0 source and the configure file: configuration step

After testing somethings I came to realize I need some more deffinitive ways to disable the pointer-arith error of the compiler. I am having issues with it because there are lots of rewrites of macros and variables on the Makefile and many candidates for change, which by the way I yet dont understand precisely the logic of their deffinitions. I tested changes at the lines it says it is giving errors, at the Makefile and on some variables like:

RECURSE_FLAGS_TO_PASS TFLAGS TARGET_FLAGS_TO_PASS RECURSE_FLAGS_TO_PASS

and on terminal with BUILD_CONFIG and EXTRA_BUILD_FLAGS

trying to disable the warning, also I sometimes passed with CXX_FLAGS or CFLAGS, usually with CFLAGS, since the install documentation makes many refferences to it

I could get the make command to print:

[ -f stage_final ] || echo stage3 > stage_final
RECURSE_FLAGS_TO_PASS+=CFLAGS+=-W
TFLAGS+=CFLAGS+=-W
TARGET_FLAGS_TO_PASS+=CFLAGS+=-W
RECURSE_FLAGS_TO_PASS+=CFLAGS=-W

which I think may be some progress

jeferson lemos

Posted 2019-07-13T13:47:51.497

Reputation: 1

Answers

0

using

AM_MAKEFLAGS+=CFLAGS+=-Wno-error=pointer-arith

solved the problem, AM_MAKEFLAGS macro is appended after the make command and Wno-error is used to tell that a particular error should be ignored, on my case since I should already use only GCC for my compilation the error presented is useless as its function is to avoid code that cant run on other compilers and that is pretty much all

jeferson lemos

Posted 2019-07-13T13:47:51.497

Reputation: 1