2015-11-06 74 views
2

我嘗試編譯的Linux文件系統(uClinux的-根文件系統),用於嵌入式系統。我得到以下錯誤日誌並編譯失敗。衝突的類型「libintl_gettextparse」

我做了一些搜索,但無法理解它是什麼。 我該如何解決它?

我的gcc版本是4.8.4,我使用Ubuntu 14.04

問候

plural.c:185:5: error: conflicting types for 'libintl_gettextparse' 
plural-exp.h:106:12: note: previous declaration of 'libintl_gettextparse' was here 
plural.c:1106:1: error: conflicting types for 'libintl_gettextparse' 
plural-exp.h:106:12: note: previous declaration of 'libintl_gettextparse' was here 
plural.c: In function 'libintl_gettextparse': 
plural.c:1275:7: error: too few arguments to function '__gettextlex' 
plural.y:57:12: note: declared here 
plural.y:154:29: error: 'arg' undeclared (first use in this function) 
plural.y:154:29: note: each undeclared identifier is reported only once for each function it appears in 
make[7]: *** [plural.o] Error 1 
make[7]: Leaving directory `/home/mehmet/kernel/bcm_unified/trunk/uclinux-rootfs/user/e2fsprogs/intl' 
make[6]: *** [all-libs-recursive] Error 1 
make[6]: Leaving directory `/home/mehmet/kernel/bcm_unified/trunk/uclinux-rootfs/user/e2fsprogs' 
make[5]: *** [all] Error 2 
make[5]: Leaving directory `/home/mehmet/kernel/bcm_unified/trunk/uclinux-rootfs/user/e2fsprogs' 
make[4]: *** [all] Error 2 
make[4]: Leaving directory `/home/mehmet/kernel/bcm_unified/trunk/uclinux-rootfs/user' 
make[3]: *** [base_fs] Error 1 
make[3]: Leaving directory `/home/mehmet/kernel/bcm_unified/trunk/uclinux-rootfs' 
make[2]: *** [box-fs] Error 1 
make[2]: Leaving directory `/home/mehmet/kernel/bcm_unified/trunk/uclinux-rootfs' 
make[1]: *** [box-fs-7231b0] Error 2 
make[1]: Leaving directory `/home/mehmet/kernel/bcm_unified/trunk/uclinux-rootfs' 
development Linux image build failed. 
gnumake: *** [kernel] Error 1 
+0

我終於通過安裝野牛3.0版解決了這個問題選擇的。按照http://geeksww.com/tutorials/miscellaneous/bison_gnu_parser_generator/installation/installing_bison_gnu_parser_generator_ubuntu_linux.php中介紹的步驟進行3.0版(不適用於2.3版)。 –

回答

1

出現此錯誤是由於野牛版和x86 - 64衝突。

的可能的解決方案可以達到:https://github.com/zerovm/glibc/commit/9f3f5229848390ae921f77c92f666ca6f0bff

如果該修改被應用於相關LIB(eglibc,在我的情況),它解決了編譯問題。

在鏈接的情況下被破壞,補丁文件的重要部分如下所示(!!!這不是一個精確的差異文件;它由於字符限制最小化!!!):

From 9f3f5229848390ae921f77c92f666ca6f0bffc00 Mon Sep 17 00:00:00 2001 
From: pkit <[email protected]> 
Date: Sun, 17 Aug 2014 15:39:12 +0000 
Subject: [PATCH] fixed gettext compatibility with bison 3.0 

plural.y was incompatible with newer bison versions 
--- 
intl/Makefile  | 9 ++ 
intl/plural-exp.h | 126 ---------------- 
intl/plural-exp2.h | 126 ++++++++++++++++ 
intl/plural-exp3.h | 126 ++++++++++++++++ 
intl/plural.y  | 410 ----------------------------------------------------- 
intl/plural2.y  | 410 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 
intl/plural3.y  | 409 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 
7 files changed, 1080 insertions(+), 536 deletions(-) 
delete mode 100644 intl/plural-exp.h 
create mode 100644 intl/plural-exp2.h 
create mode 100644 intl/plural-exp3.h 
delete mode 100644 intl/plural.y 
create mode 100644 intl/plural2.y 
create mode 100644 intl/plural3.y 

diff --git a/intl/Makefile b/intl/Makefile 
index 1511edd..601fb57 100644 
--- a/intl/Makefile 
+++ b/intl/Makefile 
@@ -51,6 +51,15 @@ generated = msgs.h mtrace-tst-gettext tst-gettext.mtrace 
generated-dirs := domaindir localedir 

ifneq (no,$(BISON)) 
+BISONVERGT2 := $(shell expr `bison -V | grep ^bison | sed 's/^.* //' | cut -f1 -d.` \> 2) 
+plural.y: plural2.y plural3.y 
+ifeq (0,$(BISONVERGT2)) 
+ cp plural2.y plural.y 
+ cp plural-exp2.h plural-exp.h 
+else 
+ cp plural3.y plural.y 
+ cp plural-exp3.h plural-exp.h 
+endif 
plural.c: plural.y 
    $(BISON) $(BISONFLAGS) [email protected] $^ 
ifeq ($(with-cvs),yes) 
diff --git a/intl/plural-exp.h b/intl/plural-exp.h 
deleted file mode 100644 
index 4a7336e..0000000 
--- a/intl/plural-exp.h 
+++ /dev/null 
@@ -1,126 +0,0 @@ 

...... 

diff --git a/intl/plural-exp2.h b/intl/plural-exp2.h 
new file mode 100644 
index 0000000..4a7336e 
--- /dev/null 
+++ b/intl/plural-exp2.h 
@@ -0,0 +1,126 @@ 

...... 
diff --git a/intl/plural-exp3.h b/intl/plural-exp3.h 
new file mode 100644 
index 0000000..282c15d 
--- /dev/null 
+++ b/intl/plural-exp3.h 
@@ -0,0 +1,126 @@ 
+/* Expression parsing and evaluation for plural form selection. 
+ Copyright (C) 2000, 2001, 2002, 2005, 2007 Free Software Foundation, Inc. 
+ Written by Ulrich Drepper <[email protected]>, 2000. 
+ This file is part of the GNU C Library. 
+ 
+ The GNU C Library is free software; you can redistribute it and/or 
+ modify it under the terms of the GNU Lesser General Public 
+ License as published by the Free Software Foundation; either 
+ version 2.1 of the License, or (at your option) any later version. 
+ 
+ The GNU C Library is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+ Lesser General Public License for more details. 
+ 
+ You should have received a copy of the GNU Lesser General Public 
+ License along with the GNU C Library; if not, write to the Free 
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 
+ 02111-1307 USA. */ 
+ 
+#ifndef _PLURAL_EXP_H 
+#define _PLURAL_EXP_H 
+ 
+#ifndef PARAMS 
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES 
+# define PARAMS(args) args 
+# else 
+# define PARAMS(args)() 
+# endif 
+#endif 
+ 
+#ifndef internal_function 
+# define internal_function 
+#endif 
+ 
+#ifndef attribute_hidden 
+# define attribute_hidden 
+#endif 
+ 
+ 
+/* This is the representation of the expressions to determine the 
+ plural form. */ 
+struct expression 
+{ 
+ int nargs;   /* Number of arguments. */ 
+ enum operator 
+ { 
+ /* Without arguments: */ 
+ var,   /* The variable "n". */ 
+ num,   /* Decimal number. */ 
+ /* Unary operators: */ 
+ lnot,   /* Logical NOT. */ 
+ /* Binary operators: */ 
+ mult,   /* Multiplication. */ 
+ divide,   /* Division. */ 
+ module,   /* Modulo operation. */ 
+ plus,   /* Addition. */ 
+ minus,   /* Subtraction. */ 
+ less_than,   /* Comparison. */ 
+ greater_than,  /* Comparison. */ 
+ less_or_equal,  /* Comparison. */ 
+ greater_or_equal,  /* Comparison. */ 
+ equal,   /* Comparison for equality. */ 
+ not_equal,   /* Comparison for inequality. */ 
+ land,   /* Logical AND. */ 
+ lor,   /* Logical OR. */ 
+ /* Ternary operators: */ 
+ qmop   /* Question mark operator. */ 
+ } operation; 
+ union 
+ { 
+ unsigned long int num; /* Number value for `num'. */ 
+ struct expression *args[3]; /* Up to three arguments. */ 
+ } val; 
+}; 
+ 
+/* This is the data structure to pass information to the parser and get 
+ the result in a thread-safe way. */ 
+struct parse_args 
+{ 
+ const char *cp; 
+ struct expression *res; 
+}; 
+ 
+ 
+/* Names for the libintl functions are a problem. This source code is used 
+ 1. in the GNU C Library library, 
+ 2. in the GNU libintl library, 
+ 3. in the GNU gettext tools. 
+ The function names in each situation must be different, to allow for 
+ binary incompatible changes in 'struct expression'. Furthermore, 
+ 1. in the GNU C Library library, the names have a __ prefix, 
+ 2.+3. in the GNU libintl library and in the GNU gettext tools, the names 
+   must follow ANSI C and not start with __. 
+ So we have to distinguish the three cases. */ 
+#ifdef _LIBC 
+# define FREE_EXPRESSION __gettext_free_exp 
+# define PLURAL_PARSE __gettextparse 
+# define GERMANIC_PLURAL __gettext_germanic_plural 
+# define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural 
+#elif defined (IN_LIBINTL) 
+# define FREE_EXPRESSION libintl_gettext_free_exp 
+# define PLURAL_PARSE libintl_gettextparse 
+# define GERMANIC_PLURAL libintl_gettext_germanic_plural 
+# define EXTRACT_PLURAL_EXPRESSION libintl_gettext_extract_plural 
+#else 
+# define FREE_EXPRESSION free_plural_expression 
+# define PLURAL_PARSE parse_plural_expression 
+# define GERMANIC_PLURAL germanic_plural 
+# define EXTRACT_PLURAL_EXPRESSION extract_plural_expression 
+#endif 
+ 
+extern void FREE_EXPRESSION PARAMS ((struct expression *exp)) 
+  internal_function; 
+extern int PLURAL_PARSE PARAMS ((struct parse_args *arg)); 
+extern const struct expression GERMANIC_PLURAL attribute_hidden; 
+extern void EXTRACT_PLURAL_EXPRESSION PARAMS 
+ ((const char *nullentry, const struct expression **pluralp, 
+ unsigned long int *npluralsp)) internal_function; 
+ 
+#if !defined (_LIBC) && !defined (IN_LIBINTL) 
+extern unsigned long int plural_eval PARAMS ((const struct expression *pexp, 
+       unsigned long int n)); 
+#endif 
+ 
+#endif /* _PLURAL_EXP_H */ 
diff --git a/intl/plural.y b/intl/plural.y 
deleted file mode 100644 
index a1ffb9e..0000000 
--- a/intl/plural.y 
+++ /dev/null 
@@ -1,410 +0,0 @@ 

...... 

diff --git a/intl/plural2.y b/intl/plural2.y 
new file mode 100644 
index 0000000..a1ffb9e 
--- /dev/null 
+++ b/intl/plural2.y 
@@ -0,0 +1,410 @@ 

....... 

diff --git a/intl/plural3.y b/intl/plural3.y 
new file mode 100644 
index 0000000..f3ae954 
--- /dev/null 
+++ b/intl/plural3.y 
@@ -0,0 +1,409 @@ 
+%{ 
+/* Expression parsing for plural form selection. 
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc. 
+ This file is part of the GNU C Library. 
+ Written by Ulrich Drepper <[email protected]>, 2000. 
+ 
+ The GNU C Library is free software; you can redistribute it and/or 
+ modify it under the terms of the GNU Lesser General Public 
+ License as published by the Free Software Foundation; either 
+ version 2.1 of the License, or (at your option) any later version. 
+ 
+ The GNU C Library is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
+ Lesser General Public License for more details. 
+ 
+ You should have received a copy of the GNU Lesser General Public 
+ License along with the GNU C Library; if not, write to the Free 
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 
+ 02111-1307 USA. */ 
+ 
+/* The bison generated parser uses alloca. AIX 3 forces us to put this 
+ declaration at the beginning of the file. The declaration in bison's 
+ skeleton file comes too late. This must come before <config.h> 
+ because <config.h> may include arbitrary system headers. */ 
+#if defined _AIX && !defined __GNUC__ 
+ #pragma alloca 
+#endif 
+#ifdef HAVE_CONFIG_H 
+# include <config.h> 
+#endif 
+ 
+#include <stddef.h> 
+#include <stdlib.h> 
+#include <string.h> 
+#include "plural-exp.h" 
+ 
+/* The main function generated by the parser is called __gettextparse, 
+ but we want it to be called PLURAL_PARSE. */ 
+#ifndef _LIBC 
+# define __gettextparse PLURAL_PARSE 
+#endif 
+%} 
+%param {struct parse_args *arg} 
+%define api.pure full 
+%expect 7 
+ 
+%union { 
+ unsigned long int num; 
+ enum operator op; 
+ struct expression *exp; 
+} 
+ 
+%{ 
+/* Prototypes for local functions. */ 
+static struct expression *new_exp PARAMS ((int nargs, enum operator op, 
+      struct expression * const *args)); 
+static inline struct expression *new_exp_0 PARAMS ((enum operator op)); 
+static inline struct expression *new_exp_1 PARAMS ((enum operator op, 
+       struct expression *right)); 
+static struct expression *new_exp_2 PARAMS ((enum operator op, 
+      struct expression *left, 
+      struct expression *right)); 
+static inline struct expression *new_exp_3 PARAMS ((enum operator op, 
+       struct expression *bexp, 
+       struct expression *tbranch, 
+       struct expression *fbranch)); 
+static int yylex PARAMS ((YYSTYPE *lval, struct parse_args *arg)); 
+static void yyerror PARAMS ((struct parse_args *arg, const char *str)); 
+ 
+/* Allocation of expressions. */ 
+ 
+static struct expression * 
+new_exp (nargs, op, args) 
+  int nargs; 
+  enum operator op; 
+  struct expression * const *args; 
+{ 
+ int i; 
+ struct expression *newp; 
+ 
+ /* If any of the argument could not be malloc'ed, just return NULL. */ 
+ for (i = nargs - 1; i >= 0; i--) 
+ if (args[i] == NULL) 
+  goto fail; 
+ 
+ /* Allocate a new expression. */ 
+ newp = (struct expression *) malloc (sizeof (*newp)); 
+ if (newp != NULL) 
+ { 
+  newp->nargs = nargs; 
+  newp->operation = op; 
+  for (i = nargs - 1; i >= 0; i--) 
+ newp->val.args[i] = args[i]; 
+  return newp; 
+ } 
+ 
+ fail: 
+ for (i = nargs - 1; i >= 0; i--) 
+ FREE_EXPRESSION (args[i]); 
+ 
+ return NULL; 
+} 
+ 
+static inline struct expression * 
+new_exp_0 (op) 
+  enum operator op; 
+{ 
+ return new_exp (0, op, NULL); 
+} 
+ 
+static inline struct expression * 
+new_exp_1 (op, right) 
+  enum operator op; 
+  struct expression *right; 
+{ 
+ struct expression *args[1]; 
+ 
+ args[0] = right; 
+ return new_exp (1, op, args); 
+} 
+ 
+static struct expression * 
+new_exp_2 (op, left, right) 
+  enum operator op; 
+  struct expression *left; 
+  struct expression *right; 
+{ 
+ struct expression *args[2]; 
+ 
+ args[0] = left; 
+ args[1] = right; 
+ return new_exp (2, op, args); 
+} 
+ 
+static inline struct expression * 
+new_exp_3 (op, bexp, tbranch, fbranch) 
+  enum operator op; 
+  struct expression *bexp; 
+  struct expression *tbranch; 
+  struct expression *fbranch; 
+{ 
+ struct expression *args[3]; 
+ 
+ args[0] = bexp; 
+ args[1] = tbranch; 
+ args[2] = fbranch; 
+ return new_exp (3, op, args); 
+} 
+ 
+%} 
+ 
+/* This declares that all operators have the same associativity and the 
+ precedence order as in C. See [Harbison, Steele: C, A Reference Manual]. 
+ There is no unary minus and no bitwise operators. 
+ Operators with the same syntactic behaviour have been merged into a single 
+ token, to save space in the array generated by bison. */ 
+%right '?'  /* ?  */ 
+%left '|'  /* ||  */ 
+%left '&'  /* &&  */ 
+%left EQUOP2  /* == != */ 
+%left CMPOP2  /* < > <= >= */ 
+%left ADDOP2  /* + - */ 
+%left MULOP2  /* */% */ 
+%right '!'  /* !  */ 
+ 
+%token <op> EQUOP2 CMPOP2 ADDOP2 MULOP2 
+%token <num> NUMBER 
+%type <exp> exp 
+ 
+%% 
+ 
+start: exp 
+  { 
+  if ($1 == NULL) 
+   YYABORT; 
+  arg->res = $1; 
+  } 
+ ; 
+ 
+exp:  exp '?' exp ':' exp 
+  { 
+  $$ = new_exp_3 (qmop, $1, $3, $5); 
+  } 
+ | exp '|' exp 
+  { 
+  $$ = new_exp_2 (lor, $1, $3); 
+  } 
+ | exp '&' exp 
+  { 
+  $$ = new_exp_2 (land, $1, $3); 
+  } 
+ | exp EQUOP2 exp 
+  { 
+  $$ = new_exp_2 ($2, $1, $3); 
+  } 
+ | exp CMPOP2 exp 
+  { 
+  $$ = new_exp_2 ($2, $1, $3); 
+  } 
+ | exp ADDOP2 exp 
+  { 
+  $$ = new_exp_2 ($2, $1, $3); 
+  } 
+ | exp MULOP2 exp 
+  { 
+  $$ = new_exp_2 ($2, $1, $3); 
+  } 
+ | '!' exp 
+  { 
+  $$ = new_exp_1 (lnot, $2); 
+  } 
+ | 'n' 
+  { 
+  $$ = new_exp_0 (var); 
+  } 
+ | NUMBER 
+  { 
+  if (($$ = new_exp_0 (num)) != NULL) 
+   $$->val.num = $1; 
+  } 
+ | '(' exp ')' 
+  { 
+  $$ = $2; 
+  } 
+ ; 
+ 
+%% 
+ 
+void 
+internal_function 
+FREE_EXPRESSION (exp) 
+  struct expression *exp; 
+{ 
+ if (exp == NULL) 
+ return; 
+ 
+ /* Handle the recursive case. */ 
+ switch (exp->nargs) 
+ { 
+ case 3: 
+  FREE_EXPRESSION (exp->val.args[2]); 
+  /* FALLTHROUGH */ 
+ case 2: 
+  FREE_EXPRESSION (exp->val.args[1]); 
+  /* FALLTHROUGH */ 
+ case 1: 
+  FREE_EXPRESSION (exp->val.args[0]); 
+  /* FALLTHROUGH */ 
+ default: 
+  break; 
+ } 
+ 
+ free (exp); 
+} 
+ 
+ 
+static int 
+yylex (lval, arg) 
+  YYSTYPE *lval; 
+  struct parse_args *arg; 
+{ 
+ const char *exp = arg->cp; 
+ int result; 
+ 
+ while (1) 
+ { 
+  if (exp[0] == '\0') 
+ { 
+  arg->cp = exp; 
+  return YYEOF; 
+ } 
+ 
+  if (exp[0] != ' ' && exp[0] != '\t') 
+ break; 
+ 
+  ++exp; 
+ } 
+ 
+ result = *exp++; 
+ switch (result) 
+ { 
+ case '0': case '1': case '2': case '3': case '4': 
+ case '5': case '6': case '7': case '8': case '9': 
+  { 
+ unsigned long int n = result - '0'; 
+ while (exp[0] >= '0' && exp[0] <= '9') 
+  { 
+  n *= 10; 
+  n += exp[0] - '0'; 
+  ++exp; 
+  } 
+ lval->num = n; 
+ result = NUMBER; 
+  } 
+  break; 
+ 
+ case '=': 
+  if (exp[0] == '=') 
+ { 
+  ++exp; 
+  lval->op = equal; 
+  result = EQUOP2; 
+ } 
+  else 
+ result = YYERRCODE; 
+  break; 
+ 
+ case '!': 
+  if (exp[0] == '=') 
+ { 
+  ++exp; 
+  lval->op = not_equal; 
+  result = EQUOP2; 
+ } 
+  break; 
+ 
+ case '&': 
+ case '|': 
+  if (exp[0] == result) 
+ ++exp; 
+  else 
+ result = YYERRCODE; 
+  break; 
+ 
+ case '<': 
+  if (exp[0] == '=') 
+ { 
+  ++exp; 
+  lval->op = less_or_equal; 
+ } 
+  else 
+ lval->op = less_than; 
+  result = CMPOP2; 
+  break; 
+ 
+ case '>': 
+  if (exp[0] == '=') 
+ { 
+  ++exp; 
+  lval->op = greater_or_equal; 
+ } 
+  else 
+ lval->op = greater_than; 
+  result = CMPOP2; 
+  break; 
+ 
+ case '*': 
+  lval->op = mult; 
+  result = MULOP2; 
+  break; 
+ 
+ case '/': 
+  lval->op = divide; 
+  result = MULOP2; 
+  break; 
+ 
+ case '%': 
+  lval->op = module; 
+  result = MULOP2; 
+  break; 
+ 
+ case '+': 
+  lval->op = plus; 
+  result = ADDOP2; 
+  break; 
+ 
+ case '-': 
+  lval->op = minus; 
+  result = ADDOP2; 
+  break; 
+ 
+ case 'n': 
+ case '?': 
+ case ':': 
+ case '(': 
+ case ')': 
+  /* Nothing, just return the character. */ 
+  break; 
+ 
+ case ';': 
+ case '\n': 
+ case '\0': 
+  /* Be safe and let the user call this function again. */ 
+  --exp; 
+  result = YYEOF; 
+  break; 
+ 
+ default: 
+  result = YYERRCODE; 
+#if YYDEBUG != 0 
+  --exp; 
+#endif 
+  break; 
+ } 
+ 
+ arg->cp = exp; 
+ 
+ return result; 
+} 
+ 
+ 
+static void 
+yyerror (arg, str) 
+  struct parse_args *arg; 
+  const char *str; 
+{ 
+ /* Do nothing. We don't print error messages here. */ 
+} 

簡而言之:

  • 複數-exp.h被移動到多個-exp2.h
  • plural.y移動到plural2.y
  • 多個-exp3.h和plural3.y被創建
  • 相關的頭和y文件根據野牛版本