【问题标题】:GCC compilation yields "real.h:53: error: 'SIZEOF_LONG' undeclared here (not in a function)"GCC 编译产生“real.h:53: error: 'SIZEOF_LONG' undeclared here (not in a function)”
【发布时间】:2012-12-13 09:57:34
【问题描述】:

我正在尝试在运行 Linux 2.6.31.8 armv5tel 的 Buffalo LinkStation Pro Duo(在 unlocking 之后)上编译 GCC 4.7.2。

不幸的是,make 抛出了一些错误,从

开始
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

real.h 的第 53 行读取为unsigned long sig[SIGSZ];,其中SIGSZ 在第 40 行定义为
#define SIGSZ (SIGNIFICAND_BITS / HOST_BITS_PER_LONG)
而第 87 行是 #if REAL_WIDTH == 1REAL_WIDTH 从第 72 行开始定义为
#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 */

这似乎归结为HOST_BITS_PER_* 为零。我是否必须使用一些configure 参数手动定义这些,或者如何解决这个问题?


更新

config.log 包含以下错误:

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

跟着@​​987654323@我好像忘记安装ppl了,我现在试试

【问题讨论】:

    标签: gcc compiler-errors arm gcc4.7


    【解决方案1】:

    SIZEOF_LONG 应该是文件auto-host.h 中的configure#defined。您的 auto-host.h 应包含以下内容:

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

    如果上述内容不存在(在您的情况下看起来确实如此),请检查 config.log 是否有错误。搜索字符串 checking size of long 周围的错误。

    【讨论】:

    • 那个条目在那里,虽然这里是#define SIZEOF_LONG 4。不过 config.log 中还有其他错误,我将它们附加到我的问题中
    • 我接受您的回答,因为检查config.log 指出我缺少ppl。实际的解决方案确实是involve some more trouble - 如果是解决方案,编译仍在运行......
    【解决方案2】:
    • 感谢chill's answer 我检查了config.log 发现
      conftest.c:10:19: error: ppl_c.h: No such file or directory
      (奇怪的是,这并没有阻止 configure 创建 Makefile 并返回成功错误代码)。谷歌第一个点击是this post,表明我没有提供ppl dependency
    • ppl-1.0 编译欢迎我
      checked_float.inlines.hh:1012: error: 'frexpl' was not declared in this scope
      这导致我找到this post,建议我改用the 1.1 snapshot,这很有效
    • 现在,gcc 的 make 给了我另一个“有用”的错误:
      gcc/../libcpp/include/line-map.h:66: error: 'CHAR_BIT'
      其中turned out 是由于C_INCLUDE_PATH ending with a colon 造成的(我已经经历了该帖子中提到的checking LIBRARY_PATH variable... contains current directory 错误,但也没有考虑检查其他变量)

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

    【讨论】:

      猜你喜欢
      • 2021-01-17
      • 1970-01-01
      • 1970-01-01
      • 2020-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-13
      • 1970-01-01
      相关资源
      最近更新 更多