g ++ 4.7.1编译错误:'strsignal'的冲突类型
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了g ++ 4.7.1编译错误:'strsignal'的冲突类型相关的知识,希望对你有一定的参考价值。
我正在尝试在Ubuntu 12.04 32位上从源代码编译g ++ 4.7.1。目前我完全做到了这一点:https://askubuntu.com/questions/168947/how-to-upgrade-g-to-4-7-1除了在编译g ++ 4.7.1之前,它要求我“取消设置LIBRARY_PATH”(所以我已经这样做了)。所以编译开始了,过了一会儿我有以下错误信息:
In file included from ../.././gcc/c-lang.c:24:0:
../.././gcc/system.h:499:20: erreur: conflicting types for ‘strsignal’
/usr/include/string.h:566:14: note: previous declaration of ‘strsignal’ was here
In file included from ./tm.h:19:0,
from ../.././gcc/c-lang.c:26:
./options.h:3738:2: erreur: #error too many masks for ix86_isa_flags
In file included from ../.././gcc/input.h:25:0,
from ../.././gcc/tree.h:27,
from ../.././gcc/c-lang.c:27:
../.././gcc/../libcpp/include/line-map.h:208:38: erreur: ‘CHAR_BIT’ undeclared here (not in a function)
../.././gcc/../libcpp/include/line-map.h:208:3: erreur: bit-field ‘reason’ width not an integer constant
../.././gcc/../libcpp/include/line-map.h:208:3: attention : ‘reason’ is narrower than values of its type [enabled by default]
In file included from ../.././gcc/tree.h:32:0,
from ../.././gcc/c-lang.c:27:
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/hwint.h:17:39: erreur: division par zéro dans #if
../.././gcc/real.h:105:9: erreur: #error "REAL_WIDTH > 6 not supported"
In file included from ../.././gcc/c-family/c-common.h:26:0,
from ../.././gcc/c-tree.h:25,
from ../.././gcc/c-lang.c:28:
../.././gcc/../libcpp/include/cpplib.h:225:3: erreur: bit-field ‘type’ width not an integer constant
../.././gcc/../libcpp/include/cpplib.h:225:3: attention : ‘type’ is narrower than values of its type [enabled by default]
../.././gcc/../libcpp/include/cpplib.h:267:3: erreur: #error "Cannot find a least-32-bit signed integer type"
../.././gcc/../libcpp/include/cpplib.h:269:35: erreur: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cppchar_t’
../.././gcc/../libcpp/include/cpplib.h:270:1: erreur: unknown type name ‘CPPCHAR_SIGNED_T’
../.././gcc/../libcpp/include/cpplib.h:768:1: erreur: unknown type name ‘cppchar_t’
../.././gcc/../libcpp/include/cpplib.h:779:1: erreur: unknown type name ‘cppchar_t’
../.././gcc/../libcpp/include/cpplib.h:779:58: erreur: unknown type name ‘cppchar_t’
../.././gcc/../libcpp/include/cpplib.h:954:1: erreur: unknown type name ‘cppchar_t’
(对不起,一些错误信息是法语:erreur -> error
和division par zéro dans #if -> division by zero in #if
)。
有什么问题以及如何解决?
(另一个小问题:./configure
和./configure -v
有什么区别?)
编辑:system.h中的strsignal行
/* If the system doesn't provide strsignal, we get it defined in
libiberty but no declaration is supplied. */
#if !defined (HAVE_STRSIGNAL)
|| (defined (HAVE_DECL_STRSIGNAL) && !HAVE_DECL_STRSIGNAL)
# ifndef strsignal
extern const char *strsignal (int);
# endif
#endif
我有同样的问题。在我的例子中,我通过取消设置bash变量CPATH,LIBRARY_PATH和C_INCLUDE_PATH来解决它。之后,构建顺利。
我用了
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
由于我在这台机器上没有root访问权限,所以我附加了很多这些变量。
其他解决方案对我不起作用,因为我使用这些env变量将gcc指向其某些依赖项。另外unset
ting variit听起来不是一个非常精确的修复:)
原来问题是我的env vars声明中有一些尾随的:
,如下所示:
$ export LIBRARY_PATH=/foo/bar:$LIBRARY_PATH
$ echo $LIBRARY_PATH
/foo/bar:
结果是LIBRARY_PATH
也将始终包含当前目录。正确设置env变量,没有尾随的:
,解决了这个问题。
以上是关于g ++ 4.7.1编译错误:'strsignal'的冲突类型的主要内容,如果未能解决你的问题,请参考以下文章
g ++错误:重载'abs(unsigned int)'的调用是不明确的
android开发里跳过的坑——android studio 错误Error:Execution failed for task ':processDebugManifest'. &g