From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sourceware.org (Postfix) with ESMTPS id A09B83951848 for ; Mon, 10 Aug 2020 06:45:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A09B83951848 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=marc.glisse@inria.fr X-IronPort-AV: E=Sophos;i="5.75,456,1589234400"; d="scan'208";a="356245482" Received: from 85-171-191-139.rev.numericable.fr (HELO stedding) ([85.171.191.139]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Aug 2020 08:45:00 +0200 Date: Mon, 10 Aug 2020 08:44:56 +0200 (CEST) From: Marc Glisse X-X-Sender: glisse@stedding.saclay.inria.fr Reply-To: gcc-help@gcc.gnu.org To: Ron Zamir cc: gcc-help@gcc.gnu.org Subject: Re: errors building gcc-10.2 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.23 (DEB 453 2020-06-18) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2020 06:45:03 -0000 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