g++ 4.7.1编译错误:“strsignal”的冲突类型

时间:2021-05-04 16:56:14

I'm trying to compile g++ 4.7.1 from source on Ubuntu 12.04 32 bits. For the moment I've exactly done that : https://askubuntu.com/questions/168947/how-to-upgrade-g-to-4-7-1 Except just before the compilation of g++ 4.7.1 it asks me to "unset LIBRARY_PATH" (so I've done that). So the compilation starts, and after a while I have the following error message :

我试着从ubuntu12.04 32位上编译g++ 4.7.1。现在,我已经完成了:https://askubuntu.com/questions/168947/ howto -upgrade-g- 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’

(sorry, some error messages are in french : erreur -> error and division par zéro dans #if -> division by zero in #if).

(抱歉,有些错误消息是用法语写的:erreur ->错误,如果->的划分为0,则为0)。

What is the problem and how to solve it ?

问题是什么,如何解决?

(an other little question : what is the difference between ./configure and ./configure -v ?)

(另一个小问题:./configure和./configure -v的区别是什么?)

EDIT : the lines of strsignal in system.h

编辑: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

4 个解决方案

#1


5  

I had the same problem. In my case, I solved it by unsetting the bash variables CPATH, LIBRARY_PATH and C_INCLUDE_PATH. After that, the build went fine.

我遇到了同样的问题。在我的例子中,我通过取消bash变量CPATH、LIBRARY_PATH和C_INCLUDE_PATH来解决它。在那之后,建造就顺利了。

#2


8  

I used

我使用

unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE

Since I don't have root access on this machine, and so I have appended to a lot of those variables.

因为我在这台机器上没有root权限,所以我已经添加了很多这些变量。

#3


0  

I used "unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE". That solved my problem.

我使用了“unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH”。这解决了我的问题。

#4


0  

Other solutions did not work for me, because I use those env variables to point gcc to some of its dependencies. Also unsetting variit does not sound like a very precise fix :)

其他的解决方案对我不起作用,因为我使用这些env变量来将gcc指向它的一些依赖项。同样,未设置变量听起来不像一个非常精确的修正:)

Turns out the problem is I had some trailing : in my env vars declarations, like so:

问题是,我有一些尾随:在我的env vars声明中,像这样:

$ export LIBRARY_PATH=/foo/bar:$LIBRARY_PATH
$ echo $LIBRARY_PATH
/foo/bar:

The result is that LIBRARY_PATH will always include the current directory too. Setting the env variables properly, with no trailing :, solved the problem.

结果是LIBRARY_PATH也总是包含当前目录。正确设置env变量,没有拖尾:,解决了问题。

#1


5  

I had the same problem. In my case, I solved it by unsetting the bash variables CPATH, LIBRARY_PATH and C_INCLUDE_PATH. After that, the build went fine.

我遇到了同样的问题。在我的例子中,我通过取消bash变量CPATH、LIBRARY_PATH和C_INCLUDE_PATH来解决它。在那之后,建造就顺利了。

#2


8  

I used

我使用

unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE

Since I don't have root access on this machine, and so I have appended to a lot of those variables.

因为我在这台机器上没有root权限,所以我已经添加了很多这些变量。

#3


0  

I used "unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE". That solved my problem.

我使用了“unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH”。这解决了我的问题。

#4


0  

Other solutions did not work for me, because I use those env variables to point gcc to some of its dependencies. Also unsetting variit does not sound like a very precise fix :)

其他的解决方案对我不起作用,因为我使用这些env变量来将gcc指向它的一些依赖项。同样,未设置变量听起来不像一个非常精确的修正:)

Turns out the problem is I had some trailing : in my env vars declarations, like so:

问题是,我有一些尾随:在我的env vars声明中,像这样:

$ export LIBRARY_PATH=/foo/bar:$LIBRARY_PATH
$ echo $LIBRARY_PATH
/foo/bar:

The result is that LIBRARY_PATH will always include the current directory too. Setting the env variables properly, with no trailing :, solved the problem.

结果是LIBRARY_PATH也总是包含当前目录。正确设置env变量,没有拖尾:,解决了问题。