unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* gcc-toolchain-4.8 build failure
@ 2022-12-26  9:07 phodina via
  2023-01-06 15:35 ` Simon Tournier
  0 siblings, 1 reply; 2+ messages in thread
From: phodina via @ 2022-12-26  9:07 UTC (permalink / raw)
  To: help-guix; +Cc: Ludovic Courtès, Marius Bakke

[-- Attachment #1: Type: text/plain, Size: 1657 bytes --]

Hello,

I'm attempting to build downstream version of u-boot and it requires old version of GCC toolchain.

So I grabbed the gcc-toolchain-4.8 and found out it's broken and doesn't build without errors. [1]

Based on the log the error is:
```
../../gcc-4.8.5/gcc/cp/pt.c: In function ?tree_node* most_specialized_class(tree, tsubst_flags_t)?:
17 ../../gcc-4.8.5/gcc/cp/pt.c:18086:25: warning: ?T? conversion used unquoted [-Wformat=]
18 18086 | error ("%s %+#T", spaces ? spaces : str, TREE_TYPE (t));
19 | ^
20 In file included from ../../gcc-4.8.5/gcc/cp/except.c:1008:
21 cfns.gperf: At global scope:
22 cfns.gperf:101:1: error: ?const char* libc_name_p(const char*, unsigned int)? redeclared inline with ?gnu_inline? attribute 23 cfns.gperf:26:14: note: ?const char* libc_name_p(const char*, unsigned int)? previously declared here
```
I've found this patch [2]. I removed the 'gcc/cp/ChangeLog' since it got rejected.
Nevertheless the patch didn't help as you can see in the attached log file.

The patch is applied in the list of patches for gcc-4.8.5.

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index bb154cac62..3183a356e6 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -391,6 +391,7 @@ (define-public gcc-4.8
"08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2"))
(patches (search-patches "gcc-arm-link-spec-fix.patch"
"gcc-4.8-libsanitizer-fix.patch"
+ "gcc-4.8-gperf.patch"
"gcc-asan-missing-include.patch"
"gcc-fix-texi2pod.patch")) (modules '((guix build utils)))

1 http://ci.guix.gnu.org/build/98529/details2 https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ec1cc0263f156f70693a62cf17b254a0029f4852----
Petr

[-- Attachment #2: gcc-4.8.5.drv.gz --]
[-- Type: application/gzip, Size: 622533 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: gcc-4.8-gperf.patch --]
[-- Type: text/x-patch; name=gcc-4.8-gperf.patch, Size: 4747 bytes --]

From ec1cc0263f156f70693a62cf17b254a0029f4852 Mon Sep 17 00:00:00 2001
From: edlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 19 Feb 2016 22:13:29 +0000
Subject: [PATCH] 2016-02-19  Jakub Jelinek  <jakub@redhat.com>            
 Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * Make-lang.in: Invoke gperf with -L C++.
        * cfns.gperf: Remove prototypes for hash and libc_name_p
        inlines.
        * cfns.h: Regenerated.
        * except.c (nothrow_libfn_p): Adjust.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233572 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/cp/Make-lang.in |  2 +-
 gcc/cp/cfns.gperf   | 10 ++--------
 gcc/cp/cfns.h       | 41 ++++++++++++++---------------------------
 gcc/cp/except.c     |  3 ++-
 5 files changed, 19 insertions(+), 37 deletions(-)

diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 671ce12f216..2286c64a8fb 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -112,7 +112,7 @@ else
 # deleting the $(srcdir)/cp/cfns.h file.
 $(srcdir)/cp/cfns.h:
 endif
-	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
+	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
 		$(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
 
 #\f
diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
index 2784edcafe9..8d7f015bf16 100644
--- a/gcc/cp/cfns.gperf
+++ b/gcc/cp/cfns.gperf
@@ -1,3 +1,5 @@
+%language=C++
+%define class-name libc_name
 %{
 /* Copyright (C) 2000-2016 Free Software Foundation, Inc.
 
@@ -16,14 +18,6 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
-#ifdef __GNUC__
-__inline
-#endif
-static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
-const char * libc_name_p (const char *, unsigned int);
 %}
 %%
 # The standard C library functions, for feeding to gperf; the result is used
diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
index d8e02c95ad6..9a372496ca5 100644
--- a/gcc/cp/cfns.h
+++ b/gcc/cp/cfns.h
@@ -1,5 +1,5 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf  */
+/* C++ code produced by gperf version 3.0.4 */
+/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf  */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
@@ -28,7 +28,7 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
 #endif
 
-#line 1 "cfns.gperf"
+#line 3 "cfns.gperf"
 
 /* Copyright (C) 2000-2016 Free Software Foundation, Inc.
 
@@ -47,25 +47,18 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
-#ifdef __GNUC__
-__inline
-#endif
-static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
-const char * libc_name_p (const char *, unsigned int);
 /* maximum key range = 391, duplicates = 0 */
 
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-hash (register const char *str, register unsigned int len)
+class libc_name
+{
+private:
+  static inline unsigned int hash (const char *str, unsigned int len);
+public:
+  static const char *libc_name_p (const char *str, unsigned int len);
+};
+
+inline unsigned int
+libc_name::hash (register const char *str, register unsigned int len)
 {
   static const unsigned short asso_values[] =
     {
@@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len)
   return hval + asso_values[(unsigned char)str[len - 1]];
 }
 
-#ifdef __GNUC__
-__inline
-#ifdef __GNUC_STDC_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
 const char *
-libc_name_p (register const char *str, register unsigned int len)
+libc_name::libc_name_p (register const char *str, register unsigned int len)
 {
   enum
     {
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index c73a16bd443..53367100de9 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1040,7 +1040,8 @@ nothrow_libfn_p (const_tree fn)
      unless the system headers are playing rename tricks, and if
      they are, we don't want to be confused by them.  */
   id = DECL_NAME (fn);
-  return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
+  return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
+				   IDENTIFIER_LENGTH (id));
 }
 
 /* Returns nonzero if an exception of type FROM will be caught by a
-- 
2.31.1



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

* Re: gcc-toolchain-4.8 build failure
  2022-12-26  9:07 gcc-toolchain-4.8 build failure phodina via
@ 2023-01-06 15:35 ` Simon Tournier
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Tournier @ 2023-01-06 15:35 UTC (permalink / raw)
  To: phodina, help-guix; +Cc: Ludovic Courtès, Marius Bakke

Hi Petr,

On Mon, 26 Dec 2022 at 09:07, phodina via <help-guix@gnu.org> wrote:

> So I grabbed the gcc-toolchain-4.8 and found out it's broken and
> doesn't build without errors. [1]

Note gcc-4.7 is also failing,

    http://ci.guix.gnu.org/build/98496/details

but gcc-4.9 builds fine,

    http://ci.guix.gnu.org/build/98527/details


Well, I guess gcc-toolchain@4.8 is built using gcc-toolchain@10 and
probably some incompatibilities.  Well, my attempt is failing…
similarly.

--8<---------------cut here---------------start------------->8---
$ guix build -e '(@@ (gnu packages gcc) gcc-4.8)'   \
       --with-c-toolchain=gcc-4.8=gcc-toolchain@4.9 \
       --no-grafts

[...]

cfns.gperf: At global scope:
cfns.gperf:101:1: error: ‘const char* libc_name_p(const char*, unsigned int)’ redeclared inline with ‘gnu_inline’ attribute
cfns.gperf:26:14: note: ‘const char* libc_name_p(const char*, unsigned int)’ previously declared here
--8<---------------cut here---------------end--------------->8---

Bah, I do not know. :-)


Cheers,
simon


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

end of thread, other threads:[~2023-01-06 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26  9:07 gcc-toolchain-4.8 build failure phodina via
2023-01-06 15:35 ` Simon Tournier

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).