0

I'm trying to build MIPS cross compiler on mac os X Yosemite.

I referred to below site and followed step by step.

http://www.theairportwiki.com/index.php/Building_a_cross_compile_of_GCC_for_MIPS_on_OS_X

In the step on [configuring and building 'binutils'],

when I typed '$sudo make all 2>&1 | tee make.log' on terminal

I got error message from the terminal like below.

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

If there is anyone who can troubleshoot this problem, please help me.

sepp2k
  • 363,768
  • 54
  • 674
  • 675
MPEC
  • 3
  • 4

2 Answers2

0

Yosemite uses CLANG/LLVM by default, not gcc. Not sure if this combination is more picky than GCC but it seems to complain about a few things that are harmless. In general it feels more picky to me than necessary.

Because the makefiles have the option -Werror in them, this causes the compile to fail. I removed -Werror from ld/Makefile, binutils/Makefile, gas/Makefile and bfd/Makefile as there were other warnings that were promoted to errors.

My favourite was complaining about: fputc(" " + n, ... ) from readelf.c; this is bad form, for sure, but technically correct. Yet this warning/error:

../../../binutils-2013.11/binutils/readelf.c:9322:20: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]

is not very helpful.

Calum
  • 1
  • 2
0

You need to add more compiler options for CLANG: export CFLAGS="-Wno-error=deprecated-declarations -Wno-error=unused-function -Wno-error=unused-const-variable".

You also can give compiler option --disable-werror: ../binutils-2.24/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-werror as in http://wiki.osdev.org/User:Max/Building_a_GCC_4.9_cross_compiler_on_OS_X_Mavericks

Even after you succeed in getting object files, you'll have an error in linking because of ar. Refer to this post: Building a cross compile of binutils on OS X Yosemite

Community
  • 1
  • 1
prosseek
  • 182,215
  • 215
  • 566
  • 871