public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* errors building gcc-10.2
@ 2020-08-10  1:01 Ron Zamir
  2020-08-10  6:44 ` Marc Glisse
  2020-08-10 23:53 ` Jim Wilson
  0 siblings, 2 replies; 4+ messages in thread
From: Ron Zamir @ 2020-08-10  1:01 UTC (permalink / raw)
  To: gcc-help

trying to build gcc-10.2
I've added the latest sources for the GMP, MPFR, MPC, ISL libraries
My system is CentOS 7.8 with gcc version 4.85

I'm running configure with the following parameters:
CC=/usr/bin/gcc CXX=/usr/bin/g++ ../gcc-10.2.0/configure
CFLAGS="-std=gnu99" CXXFLAGS="-std=c++11" --prefix=$HOME/.local/gcc-10
--disable-multilib

the additional CFLAGS and CXXFLAGS parameters where added to try to fix the
error (below)

when I run make, I get the error:
libtool: compile:  /usr/bin/gcc -DHAVE_CONFIG_H -I.
-I../../../gcc-10.2.0/gmp/mpn -I.. -D__GMP_WITHIN_GMP
-I../../../gcc-10.2.0/gmp -DOPERATION_compute_powtab -DNO_ASM -g -c
compute_powtab.c -o compute_powtab.o
compute_powtab.c: In function 'mpn_compute_powtab_mul':
compute_powtab.c:142:3: error: 'for' loop initial declarations are only
allowed in C99 mode
   for (long pi = start_idx; pi >= 0; pi--)
   ^
compute_powtab.c:142:3: note: use option -std=c99 or -std=gnu99 to compile
your code
compute_powtab.c: In function 'mpn_compute_powtab_div':
compute_powtab.c:226:3: error: 'for' loop initial declarations are only
allowed in C99 mode
   for (long pi = n_pows - 1; pi >= 0; pi--)
   ^
compute_powtab.c:274:13: error: redefinition of 'pi'
   for (long pi = n_pows; pi >= 0; pi--)
             ^
compute_powtab.c:226:13: note: previous definition of 'pi' was here
   for (long pi = n_pows - 1; pi >= 0; pi--)
             ^
compute_powtab.c:274:3: error: 'for' loop initial declarations are only
allowed in C99 mode
   for (long pi = n_pows; pi >= 0; pi--)
   ^
compute_powtab.c: In function 'powtab_decide':
compute_powtab.c:296:3: error: 'for' loop initial declarations are only
allowed in C99 mode
   for (size_t pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
   ^
compute_powtab.c:304:10: error: redefinition of 'pn'
   size_t pn = un - 1;
          ^
compute_powtab.c:296:15: note: previous definition of 'pn' was here
   for (size_t pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
               ^
compute_powtab.c:308:3: error: 'for' loop initial declarations are only
allowed in C99 mode
   for (long i = n_pows - 2; i >= 0; i--)
   ^
make[5]: *** [compute_powtab.lo] Error 1

what flags should I specify to fix this error?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: errors building gcc-10.2
  2020-08-10  1:01 errors building gcc-10.2 Ron Zamir
@ 2020-08-10  6:44 ` Marc Glisse
  2020-08-10 23:53 ` Jim Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Glisse @ 2020-08-10  6:44 UTC (permalink / raw)
  To: Ron Zamir; +Cc: gcc-help

On Mon, 10 Aug 2020, Ron Zamir via Gcc-help wrote:

> trying to build gcc-10.2
> I've added the latest sources for the GMP, MPFR, MPC, ISL libraries
> My system is CentOS 7.8 with gcc version 4.85
>
> I'm running configure with the following parameters:
> CC=/usr/bin/gcc CXX=/usr/bin/g++ ../gcc-10.2.0/configure
> CFLAGS="-std=gnu99" CXXFLAGS="-std=c++11" --prefix=$HOME/.local/gcc-10
> --disable-multilib
>
> the additional CFLAGS and CXXFLAGS parameters where added to try to fix the
> error (below)
>
> when I run make, I get the error:
> libtool: compile:  /usr/bin/gcc -DHAVE_CONFIG_H -I.
> -I../../../gcc-10.2.0/gmp/mpn -I.. -D__GMP_WITHIN_GMP
> -I../../../gcc-10.2.0/gmp -DOPERATION_compute_powtab -DNO_ASM -g -c
> compute_powtab.c -o compute_powtab.o
> compute_powtab.c: In function 'mpn_compute_powtab_mul':
> compute_powtab.c:142:3: error: 'for' loop initial declarations are only
> allowed in C99 mode
>   for (long pi = start_idx; pi >= 0; pi--)
>   ^
> compute_powtab.c:142:3: note: use option -std=c99 or -std=gnu99 to compile
> your code
> compute_powtab.c: In function 'mpn_compute_powtab_div':
> compute_powtab.c:226:3: error: 'for' loop initial declarations are only
> allowed in C99 mode
>   for (long pi = n_pows - 1; pi >= 0; pi--)
>   ^
> compute_powtab.c:274:13: error: redefinition of 'pi'
>   for (long pi = n_pows; pi >= 0; pi--)
>             ^
> compute_powtab.c:226:13: note: previous definition of 'pi' was here
>   for (long pi = n_pows - 1; pi >= 0; pi--)
>             ^
> compute_powtab.c:274:3: error: 'for' loop initial declarations are only
> allowed in C99 mode
>   for (long pi = n_pows; pi >= 0; pi--)
>   ^
> compute_powtab.c: In function 'powtab_decide':
> compute_powtab.c:296:3: error: 'for' loop initial declarations are only
> allowed in C99 mode
>   for (size_t pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
>   ^
> compute_powtab.c:304:10: error: redefinition of 'pn'
>   size_t pn = un - 1;
>          ^
> compute_powtab.c:296:15: note: previous definition of 'pn' was here
>   for (size_t pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
>               ^
> compute_powtab.c:308:3: error: 'for' loop initial declarations are only
> allowed in C99 mode
>   for (long i = n_pows - 2; i >= 0; i--)
>   ^
> make[5]: *** [compute_powtab.lo] Error 1
>
> what flags should I specify to fix this error?

You could use even newer gmp sources from the gmp-6.2 branch (not the main 
gmp branch), which includes this patch 
https://gmplib.org/repo/gmp-6.2/annotate/adcd8c8de72c/mpn/generic/compute_powtab.c

CC='/usr/bin/gcc -std=gnu99' may also work.

GMP's configure would normally add -std=gnu99 for you, but gcc's build 
machinery passes it some CFLAGS, and GMP trusts the user to know what they 
are doing if they explicitly pass some CFLAGS. Maybe during stage1 if we 
detect that the compiler is an old version of gcc/clang we could add 
-std=gnu99 in the CFLAGS that gcc passes to gmp.

Another option would be to install mpc-devel from centos instead of adding 
the sources of gmp+mpfr+mpc, I think it has versions recent enough to be 
supported.

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: errors building gcc-10.2
  2020-08-10  1:01 errors building gcc-10.2 Ron Zamir
  2020-08-10  6:44 ` Marc Glisse
@ 2020-08-10 23:53 ` Jim Wilson
  2020-08-11  0:01   ` Ron Zamir
  1 sibling, 1 reply; 4+ messages in thread
From: Jim Wilson @ 2020-08-10 23:53 UTC (permalink / raw)
  To: Ron Zamir; +Cc: gcc-help

On Sun, Aug 9, 2020 at 6:01 PM Ron Zamir via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
> trying to build gcc-10.2
> I've added the latest sources for the GMP, MPFR, MPC, ISL libraries
> My system is CentOS 7.8 with gcc version 4.85

gcc-4.8.5 is rather old.  I'd suggest installing a more recent version
of gcc using the software collections web site.

https://wiki.centos.org/AdditionalResources/Repositories/SCL
https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/

Looks like gcc-8 is the most recent one that they have, but using
gcc-8 to build gcc-10 will likely work much better than using
gcc-4.8.5 to build gcc-10.  Adding the devtoolset-8 also gets you more
recent versions of gmp, mpfr, and mpc, which might be recent enough to
make the gcc-10 build happy.

Jim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: errors building gcc-10.2
  2020-08-10 23:53 ` Jim Wilson
@ 2020-08-11  0:01   ` Ron Zamir
  0 siblings, 0 replies; 4+ messages in thread
From: Ron Zamir @ 2020-08-11  0:01 UTC (permalink / raw)
  To: gcc-help

Problem solved
1. Instead of the latest and greatest versions of the libraries (mpc, gmp,
mpfr, isl) I used the download_prerequisites script in contrib
2. I used a gcc 8 binary

gcc 10.2 built successfully
Thanks

בתאריך יום ג׳, 11 באוג׳ 2020, 02:53, מאת Jim Wilson ‏<jimw@sifive.com>:

> On Sun, Aug 9, 2020 at 6:01 PM Ron Zamir via Gcc-help
> <gcc-help@gcc.gnu.org> wrote:
> > trying to build gcc-10.2
> > I've added the latest sources for the GMP, MPFR, MPC, ISL libraries
> > My system is CentOS 7.8 with gcc version 4.85
>
> gcc-4.8.5 is rather old.  I'd suggest installing a more recent version
> of gcc using the software collections web site.
>
> https://wiki.centos.org/AdditionalResources/Repositories/SCL
> https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
>
> Looks like gcc-8 is the most recent one that they have, but using
> gcc-8 to build gcc-10 will likely work much better than using
> gcc-4.8.5 to build gcc-10.  Adding the devtoolset-8 also gets you more
> recent versions of gmp, mpfr, and mpc, which might be recent enough to
> make the gcc-10 build happy.
>
> Jim
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-11  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10  1:01 errors building gcc-10.2 Ron Zamir
2020-08-10  6:44 ` Marc Glisse
2020-08-10 23:53 ` Jim Wilson
2020-08-11  0:01   ` Ron Zamir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).