最低限のクロスコンパイラの作り方
https://qiita.com/7shi/items/2d44e040bae930d11088
クロスコンパイラを一気に作る
https://gist.github.com/7shi/1048037
root@65152b9498f5:/usr/src/gcc# mkdir build
root@65152b9498f5:/usr/src/gcc# cd build
root@65152b9498f5:/usr/src/gcc/build# git clone https://gist.github.com/7shi/1048037
Cloning into '1048037'...
remote: Enumerating objects: 13, done.
remote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 13
Unpacking objects: 100% (13/13), done.
root@65152b9498f5:/usr/src/gcc/build# ls
1048037
root@65152b9498f5:/usr/src/gcc/build# mv 1048037/* .
root@65152b9498f5:/usr/src/gcc/build# ls
1048037 cross1.mk cross2.mk cross3.mk
root@65152b9498f5:/usr/src/gcc/build# make cross1.mk
make: Nothing to be done for 'cross1.mk'.
root@65152b9498f5:/usr/src/gcc/build# cp cross1.mk Makefile
root@65152b9498f5:/usr/src/gcc/build# make all
if [ ! -f /usr/local/bin/alpha-elf-as ]; then \
mkdir -p /build/alpha-elf/binutils && \
cd /build/alpha-elf/binutils && \
(if [ ! -f Makefile ]; then ../../binutils-2.21.1/configure --target=alpha-elf; fi) && \
make && make install; \
fi
/bin/sh: 4: ../../binutils-2.21.1/configure: not found
Makefile:19: recipe for target 'alpha-elf' failed
make: *** [alpha-elf] Error 127
root@65152b9498f5:/usr/src# wget https://ftp.gnu.org/gnu/binutils/binutils-2.21.1.tar.bz2
--2018-10-31 22:18:11-- https://ftp.gnu.org/gnu/binutils/binutils-2.21.1.tar.bz2
Resolving ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b
Connecting to ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18997755 (18M) [application/x-bzip2]
Saving to: 'binutils-2.21.1.tar.bz2'
binutils-2.21.1.tar.bz2 100%[==========================================================================================>] 18.12M 1.23MB/s in 22s
2018-10-31 22:18:34 (838 KB/s) - 'binutils-2.21.1.tar.bz2' saved [18997755/18997755]
root@65152b9498f5:/usr/src# ls
binutils-2.21.1.tar.bz2 gcc
root@65152b9498f5:/usr/src# tar jxf binutils-2.21.1.tar.bz2
root@65152b9498f5:/usr/src# ls
binutils-2.21.1 binutils-2.21.1.tar.bz2 gcc
root@65152b9498f5:/usr/src# cd gcc
root@65152b9498f5:/usr/src/gcc# cd build
root@65152b9498f5:/usr/src/gcc/build# ls
1048037 Makefile cross1.mk cross2.mk cross3.mk
root@65152b9498f5:/usr/src/gcc/build# make all
if [ ! -f /usr/local/bin/alpha-elf-as ]; then \
mkdir -p /build/alpha-elf/binutils && \
cd /build/alpha-elf/binutils && \
(if [ ! -f Makefile ]; then ../../binutils-2.21.1/configure --target=alpha-elf; fi) && \
make && make install; \
fi
/bin/sh: 4: ../../binutils-2.21.1/configure: not found
Makefile:19: recipe for target 'alpha-elf' failed
make: *** [alpha-elf] Error 127
root@65152b9498f5:/usr/src/gcc/build# cd /build
root@65152b9498f5:/build# ls
alpha-elf
root@65152b9498f5:/build# cp /usr/src/gcc/build/Makefile .
root@65152b9498f5:/build# ls
Makefile alpha-elf
root@65152b9498f5:/build# make all
cd ../../binutils-2.21.1 && autogen Makefile.def
/bin/bash: line 0: cd: ../../binutils-2.21.1: No such file or directory
Makefile:14800: recipe for target '../../binutils-2.21.1/Makefile.in' failed
make: *** [../../binutils-2.21.1/Makefile.in] Error 1
root@65152b9498f5:/build# pwd
/build
root@65152b9498f5:/build# ls
Makefile alpha-elf
root@65152b9498f5:/build# cd ..
root@65152b9498f5:/# ls /usr/local/src
root@65152b9498f5:/# ls /usr/src
binutils-2.21.1 binutils-2.21.1.tar.bz2 gcc
root@65152b9498f5:/# cp -r /usr/src/binutils-2.21.1 .
root@65152b9498f5:/# cd build
root@65152b9498f5:/build# ls
Makefile alpha-elf
root@65152b9498f5:/build# make all
CONFIG_SHELL="/bin/bash" /bin/bash ./config.status --recheck
/bin/bash: ./config.status: No such file or directory
Makefile:14807: recipe for target 'config.status' failed
make: *** [config.status] Error 127
mv -f .deps/cache.Tpo .deps/cache.Plo
/bin/bash ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../binutils-2.21.1/bfd -I. -I../../../binutils-2.21.1/bfd -I../../../binutils-2.21.1/bfd/../include -DHAVE_bfd_elf64_alpha_vec -DHAVE_ecoffalpha_little_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 -DBINDIR='"/usr/local/bin"' -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT coffgen.lo -MD -MP -MF .deps/coffgen.Tpo -c -o coffgen.lo ../../../binutils-2.21.1/bfd/coffgen.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../../binutils-2.21.1/bfd -I. -I../../../binutils-2.21.1/bfd -I../../../binutils-2.21.1/bfd/../include -DHAVE_bfd_elf64_alpha_vec -DHAVE_ecoffalpha_little_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 -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT coffgen.lo -MD -MP -MF .deps/coffgen.Tpo -c ../../../binutils-2.21.1/bfd/coffgen.c -o coffgen.o
../../../binutils-2.21.1/bfd/coffgen.c: In function 'coff_print_symbol':
../../../binutils-2.21.1/bfd/coffgen.c:1996:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (combined->u.syment.n_type == T_NULL)
^
../../../binutils-2.21.1/bfd/coffgen.c:2013:3: note: here
case C_EXT:
^~~~
../../../binutils-2.21.1/bfd/coffgen.c:2015:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (ISFCN (combined->u.syment.n_type))
^
../../../binutils-2.21.1/bfd/coffgen.c:2033:3: note: here
default:
^~~~~~~
cc1: all warnings being treated as errors
Makefile:1513: recipe for target 'coffgen.lo' failed
make[4]: *** [coffgen.lo] Error 1
make[4]: Leaving directory '/build/bfd'
Makefile:1555: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/build/bfd'
Makefile:1066: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/build/bfd'
Makefile:3333: recipe for target 'all-bfd' failed
make[1]: *** [all-bfd] Error 2
make[1]: Leaving directory '/build'
Makefile:851: recipe for target 'all' failed
make: *** [all] Error 2
/bin/sh: 4: ../../gcc-4.6.1/configure: not found
Makefile:19: recipe for target 'arc-elf' failed
make: *** [arc-elf] Error 127
root@65152b9498f5:/build#