无法在mac os X上为MIPS交叉编译器生成binutils

无法在mac os X上为MIPS交叉编译器生成binutils,mips,osx-yosemite,binutils,Mips,Osx Yosemite,Binutils,我正试图在MacOSXYosemite上构建MIPS交叉编译器 我参考了下面的网站,并一步一步地跟进 在[配置和构建“binutils”]的步骤中 当我在终端上键入“$sudo make all 2>&1 | tee make.log”时 我从终端收到错误消息,如下所示 M-PEC:binutils-build M-PEC$ sudo make all 2>&1 | tee make.log tee: make.log: Permission denied make[3]: No

我正试图在MacOSXYosemite上构建MIPS交叉编译器

我参考了下面的网站,并一步一步地跟进

[配置和构建“binutils”]的步骤中

当我在终端上键入“$sudo make all 2>&1 | tee make.log”时

我从终端收到错误消息,如下所示

M-PEC:binutils-build M-PEC$ sudo make all 2>&1 | tee make.log
tee: make.log: Permission denied
make[3]: Nothing to be done for `all'.
rm -f stamp-h1
/bin/sh ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
test -f config.h || (rm -f stamp-h1 && /Applications/Xcode.app/Contents/Developer/usr/bin/make stamp-h1)
Making info in doc
make[3]: Nothing to be done for `info'.
Making info in po
make[3]: Nothing to be done for `info'.
make[3]: Nothing to be done for `info-am'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in doc
make[4]: Nothing to be done for `all'.
Making all in po
make[4]: Nothing to be done for `all'.
/bin/sh ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.24/bfd -I. -I../../binutils-2.24/bfd -I../../binutils-2.24/bfd/../include  -DHAVE_bfd_elf32_bigmips_vec -DHAVE_bfd_elf32_littlemips_vec -DHAVE_bfd_elf64_bigmips_vec -DHAVE_bfd_elf64_littlemips_vec -DHAVE_bfd_elf64_little_generic_vec -DHAVE_bfd_elf64_big_generic_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -I./../intl -DBINDIR='"/opt/cross/gcc-mips/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT elfxx-mips.lo -MD -MP -MF .deps/elfxx-mips.Tpo -c -o elfxx-mips.lo ../../binutils-2.24/bfd/elfxx-mips.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.24/bfd -I. -I../../binutils-2.24/bfd -I../../binutils-2.24/bfd/../include -DHAVE_bfd_elf32_bigmips_vec -DHAVE_bfd_elf32_littlemips_vec -DHAVE_bfd_elf64_bigmips_vec -DHAVE_bfd_elf64_littlemips_vec -DHAVE_bfd_elf64_little_generic_vec -DHAVE_bfd_elf64_big_generic_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -I./../intl -DBINDIR=\"/opt/cross/gcc-mips/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT elfxx-mips.lo -MD -MP -MF .deps/elfxx-mips.Tpo -c ../../binutils-2.24/bfd/elfxx-mips.c -o elfxx-mips.o
../../binutils-2.24/bfd/elfxx-mips.c:2132:1: error: unused function 'got_ofst_reloc_p' [-Werror,-Wunused-function]
got_ofst_reloc_p (unsigned int r_type)
^
../../binutils-2.24/bfd/elfxx-mips.c:2138:1: error: unused function 'got_hi16_reloc_p' [-Werror,-Wunused-function]
got_hi16_reloc_p (unsigned int r_type)
^
2 errors generated.
make[4]: *** [elfxx-mips.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-bfd] Error 2
make: *** [all] Error 2

如果有人可以解决这个问题,请帮助我。

优胜美地默认使用CLANG/LLVM,而不是gcc。不确定这种组合是否比GCC更挑剔,但它似乎在抱怨一些无害的事情。总的来说,我觉得它比必要的更挑剔

因为makefiles中有-Werror选项,这会导致编译失败。我从ld/Makefile、binutils/Makefile、gas/Makefile和bfd/Makefile中删除了-Werror,因为还有其他警告被提升为错误

我最喜欢的是抱怨:来自readelf.c的fputc(“+n,…”);当然,这是一种糟糕的形式,但在技术上是正确的。然而,这个警告/错误:

../../../binutils-2013.11/binutils/readelf.c:9322:20:错误:将“int”添加到 字符串不附加到字符串[-Werror,-Wstring加int]


没有太大帮助。

您需要为CLANG添加更多编译器选项:
export CFLAGS=“-Wno error=deprecated declarations-Wno error=unused function-Wno error=unused const variable”

您还可以为编译器提供选项
--disable werror
。/binutils-2.24/configure--target=$target--prefix=“$prefix”--禁用nls--disable werror
,如中所示

即使在成功获取对象文件后,由于
ar
,链接也会出错。请参阅本帖: