Linux From Scratch 7.2:在第 6 章中制作 binutils-2.22 时出错

Linux From Scratch 7.2:在第 6 章中制作 binutils-2.22 时出错

执行时出现以下错误make tooldir=/usr

../../binutils-2.22/libiberty/regex.c:130:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
../../binutils-2.22/libiberty/regex.c:130:7: warning: conflicting types for built-in function 'malloc' [enabled by default]
../../binutils-2.22/libiberty/regex.c:131:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
../../binutils-2.22/libiberty/regex.c:131:7: warning: conflicting types for built-in function 'realloc' [enabled by default]
In file included from /usr/include/bits/string2.h:1296:0,
             from /usr/include/string.h:633,
             from ../../binutils-2.22/libiberty/regex.c:149:
/usr/include/stdlib.h:470:14: error: conflicting types for 'malloc'
../../binutils-2.22/libiberty/regex.c:130:7: note: previous declaration of 'malloc' was here
In file included from ../../binutils-2.22/libiberty/regex.c:638:0:
../../binutils-2.22/libiberty/regex.c: In function 'byte_regex_compile':
../../binutils-2.22/libiberty/regex.c:2439:7: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
../../binutils-2.22/libiberty/regex.c:2439:33: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.22/libiberty/regex.c:2500:17: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.22/libiberty/regex.c:2533:36: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.22/libiberty/regex.c:2640:28: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.22/libiberty/regex.c:3643:26: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.22/libiberty/regex.c:4150:5: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.22/libiberty/regex.c: In function 'byte_re_compile_fastmap':
../../binutils-2.22/libiberty/regex.c:4835:11: warning: implicit declaration of function 'abort' [-Wimplicit-function-declaration]
../../binutils-2.22/libiberty/regex.c:4835:11: warning: incompatible implicit declaration of built-in function 'abort' [enabled by default]
../../binutils-2.22/libiberty/regex.c: In function 'byte_re_match_2_internal':
../../binutils-2.22/libiberty/regex.c:7424:11: warning: incompatible implicit declaration of built-in function 'abort' [enabled by default]
../../binutils-2.22/libiberty/regex.c: In function 'xregcomp':
../../binutils-2.22/libiberty/regex.c:7978:4: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.22/libiberty/regex.c: In function 'xregexec':
../../binutils-2.22/libiberty/regex.c:8053:7: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
../../binutils-2.22/libiberty/regex.c: In function 'xregerror':
../../binutils-2.22/libiberty/regex.c:8081:5: warning: incompatible implicit declaration of built-in function 'abort' [enabled by default]
../../binutils-2.22/libiberty/regex.c: In function 'xregfree':
../../binutils-2.22/libiberty/regex.c:8114:3: warning: incompatible implicit declaration of built-in function 'free' [enabled by default]
make[2]: *** [regex.o] Error 1
make[2]: Leaving directory `/sources/binutils-build/libiberty'
make[1]: *** [all-libiberty] Error 2
make[1]: Leaving directory `/sources/binutils-build'
make: *** [all] Error 2

完整的输出是这里,我使用的页面是这里

谁能帮我?

编辑:

/usr/include/stdlib.h(第 470 行)

extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;

binutils-2.22/libiberty/regex.c(第 130 行)

char *malloc ();

答案1

问题是编译代码时未定义 STDC_HEADERS。参见第 47 行那个版本的 regex.c。发生这种情况可能是因为您没有跑步configure,或者您跑了但出了问题。

如果您尚未运行configure,请继续运行它:

./configure   

如果您运行它,它应该生成一个名为 的文件,config.h该文件应该用于#define将宏定义STDC_HEADERS为某个值。如果没有,您使用的编译器可能缺少它所依赖的东西(例如系统头文件)或者配置错误或安装不正确。

正如我在上面的评论中提到的,您使用的 binutils 版本是现在4岁多了我认为你应该使用更新的版本。

相关内容