GCC编译收益率“真实。h:53:错误:“SIZEOF_LONG”未声明(不在函数中)”

时间:2022-02-14 09:44:30

I'm trying to compile GCC 4.7.2 on a Buffalo LinkStation Pro Duo (after unlocking it) which runs Linux 2.6.31.8 armv5tel.

我正在尝试在一个Buffalo LinkStation Pro Duo上编译GCC 4.7.2(在解锁之后),它运行Linux 2.6.31.8 armv5tel。

Unfortunately, make throws quite some errors, starting with

不幸的是,开始时就会犯一些错误。

gcc -c  -DIN_GCC_FRONTEND -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-formIn file included from ../../gcc-4.7.2/gcc/tree.h:32,
                 from ../../gcc-4.7.2/gcc/c-lang.c:27:
../../gcc-4.7.2/gcc/real.h:53: error: 'SIZEOF_LONG' undeclared here (not in a function)
In file included from ../../gcc-4.7.2/gcc/tree.h:32,
                 from ../../gcc-4.7.2/gcc/c-lang.c:27:
../../gcc-4.7.2/gcc/real.h:87:5: error: division by zero in #if
../../gcc-4.7.2/gcc/real.h:87:5: error: division by zero in #if
../../gcc-4.7.2/gcc/real.h:90:6: error: division by zero in #if

Line 53 of real.h reads unsigned long sig[SIGSZ];, where SIGSZ is defined at line 40 as
#define SIGSZ (SIGNIFICAND_BITS / HOST_BITS_PER_LONG)
while line 87 is #if REAL_WIDTH == 1 with REAL_WIDTH defined starting at line 72 as
#define REAL_WIDTH \
(REAL_VALUE_TYPE_SIZE/HOST_BITS_PER_WIDE_INT \
+ (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */

53岁的。h读取未签名的long sig[SIGSZ];在第40行定义SIGSZ时,定义SIGSZ(含义和位/ HOST_BITS_PER_LONG),而第87行是#if REAL_WIDTH == 1,从第72行定义的REAL_WIDTH定义为REAL_WIDTH \ (REAL_VALUE_TYPE_SIZE/HOST_BITS_PER_WIDE_INT \ + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ?1:0)/* * * *。

This seems to boil down to the HOST_BITS_PER_* being zero. Do I have to define these manually with some configure parameter or how can this issue be resolved?

这似乎归结为HOST_BITS_PER_*为零。我是否需要手动定义这些配置参数,或者如何解决这个问题?


update

更新

config.log contains the following errors:

配置。日志包含以下错误:

conftest.c:10:19: error: ppl_c.h: No such file or directory
conftest.c: In function 'main':
conftest.c:16: error: 'choke' undeclared (first use in this function)
conftest.c:16: error: (Each undeclared identifier is reported only once
conftest.c:16: error: for each function it appears in.)
conftest.c:16: error: expected ';' before 'me'
configure:5708: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define LT_OBJDIR ".libs/"
| /* end confdefs.h.  */
| #include "ppl_c.h"
| int
| main ()
| {
|.
|     #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
|     choke me
|     #endif
|.
|   ;
|   r

Following this post I seem to have forgotten to install ppl, which I'll try now

在这篇文章之后,我似乎忘记了安装ppl,我现在就试试。

2 个解决方案

#1


1  

SIZEOF_LONG should be #defined by configure in the file auto-host.h. Your auto-host.h should contain something like:

SIZEOF_LONG应该通过在文件自动主机中配置来定义。你的auto-host。h应该包含如下内容:

/* The size of `long', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#define SIZEOF_LONG 8
#endif

If the above is not present (and it looks like in your case it's indeed so), check config.log for errors. Search for errors around the string checking size of long.

如果上面没有出现(在您的例子中确实是这样),检查config。错误日志。搜索字符串检查长度的错误。

#2


1  

  • Thanks to chill's answer I checked config.log to discover
    conftest.c:10:19: error: ppl_c.h: No such file or directory
    (which, curiously, did not prevent configure from creating a Makefile and returning a success error code). The first google hit on that was this post, showing I didn't provide the ppl dependency.
  • 多亏了chill的答案,我检查了config。日志发现conftest。c:19:错误:ppl_c。h:没有这样的文件或目录(奇怪的是,它没有阻止配置创建Makefile并返回成功的错误代码)。第一个谷歌是这个帖子,显示我没有提供ppl依赖。
  • The ppl-1.0 compilation greeted me with
    checked_float.inlines.hh:1012: error: 'frexpl' was not declared in this scope
    which led me to this post suggesting I'd use the 1.1 snapshot instead, which worked
  • ppl-1.0编译用checked_float.inlines向我问候。hh:1012:错误:“frexpl”没有在这个范围内声明,导致我在这篇文章中建议使用1.1快照来代替,这是有效的。
  • Now, gcc's make offered me another "helpful" error:
    gcc/../libcpp/include/line-map.h:66: error: 'CHAR_BIT'
    which turned out to be due to C_INCLUDE_PATH ending with a colon (I already experienced the checking LIBRARY_PATH variable... contains current directory error mentioned in that post, but didn't think about checking other variables for that as well)
  • 现在,gcc的make为我提供了另一个“有用的”错误:gcc/. /libcpp/包含/行映射。h:66:错误:'CHAR_BIT',结果是由于C_INCLUDE_PATH以冒号结尾(我已经经历了检查LIBRARY_PATH变量…包含该post中提到的当前目录错误,但也没有考虑检查其他变量。

Compilation is still running, so far no more errors...

编译仍然在运行,到目前为止没有更多的错误……

#1


1  

SIZEOF_LONG should be #defined by configure in the file auto-host.h. Your auto-host.h should contain something like:

SIZEOF_LONG应该通过在文件自动主机中配置来定义。你的auto-host。h应该包含如下内容:

/* The size of `long', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#define SIZEOF_LONG 8
#endif

If the above is not present (and it looks like in your case it's indeed so), check config.log for errors. Search for errors around the string checking size of long.

如果上面没有出现(在您的例子中确实是这样),检查config。错误日志。搜索字符串检查长度的错误。

#2


1  

  • Thanks to chill's answer I checked config.log to discover
    conftest.c:10:19: error: ppl_c.h: No such file or directory
    (which, curiously, did not prevent configure from creating a Makefile and returning a success error code). The first google hit on that was this post, showing I didn't provide the ppl dependency.
  • 多亏了chill的答案,我检查了config。日志发现conftest。c:19:错误:ppl_c。h:没有这样的文件或目录(奇怪的是,它没有阻止配置创建Makefile并返回成功的错误代码)。第一个谷歌是这个帖子,显示我没有提供ppl依赖。
  • The ppl-1.0 compilation greeted me with
    checked_float.inlines.hh:1012: error: 'frexpl' was not declared in this scope
    which led me to this post suggesting I'd use the 1.1 snapshot instead, which worked
  • ppl-1.0编译用checked_float.inlines向我问候。hh:1012:错误:“frexpl”没有在这个范围内声明,导致我在这篇文章中建议使用1.1快照来代替,这是有效的。
  • Now, gcc's make offered me another "helpful" error:
    gcc/../libcpp/include/line-map.h:66: error: 'CHAR_BIT'
    which turned out to be due to C_INCLUDE_PATH ending with a colon (I already experienced the checking LIBRARY_PATH variable... contains current directory error mentioned in that post, but didn't think about checking other variables for that as well)
  • 现在,gcc的make为我提供了另一个“有用的”错误:gcc/. /libcpp/包含/行映射。h:66:错误:'CHAR_BIT',结果是由于C_INCLUDE_PATH以冒号结尾(我已经经历了检查LIBRARY_PATH变量…包含该post中提到的当前目录错误,但也没有考虑检查其他变量。

Compilation is still running, so far no more errors...

编译仍然在运行,到目前为止没有更多的错误……