Vagrant box: ubuntu/xenial64
provisioner: ansible_localによりgccをソースからコンパイルするのに必要なg++, bison, flex, texinfoを追加インストール済み
Vagrantfile
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
config.vm.synced_folder "C:\\(Vagrantfileの場所)\\synced_folder", "/vagrant_data"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
config.vm.provision "ansible_local" do |ansible|
ansible.playbook = "playbook.yml"
ansible.verbose = true
end
end
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
config.vm.synced_folder "C:\\(Vagrantfileの場所)\\synced_folder", "/vagrant_data"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
config.vm.provision "ansible_local" do |ansible|
ansible.playbook = "playbook.yml"
ansible.verbose = true
end
end
playbook.yml
- hosts: all
become: yes
user: ubuntu
tasks:
- name: Install packages
apt: pkg={{item}} force=yes update_cache=yes
with_items:
# to build compiler
- g++
- bison
- flex
- texinfo
- hosts: all
become: yes
user: ubuntu
tasks:
- name: Install packages
apt: pkg={{item}} force=yes update_cache=yes
with_items:
# to build compiler
- g++
- bison
- flex
- texinfo
#!/bin/bash
set -e
BINUTILS_VERSION=binutils-2.25
LINUX_KERNEL_VERSION=linux-3.16
GCC_VERSION=gcc-5.2.0
GLIBC_VERSION=glibc-2.22
wget -nc http://ftpmirror.gnu.org/binutils/$BINUTILS_VERSION.tar.gz
wget -nc https://www.kernel.org/pub/linux/kernel/v3.x/$LINUX_KERNEL_VERSION.tar.xz
wget -nc http://ftpmirror.gnu.org/gcc/$GCC_VERSION/$GCC_VERSION.tar.gz
wget -nc http://ftpmirror.gnu.org/glibc/$GLIBC_VERSION.tar.xz
for f in *.tar*; do
tar xfk $f
done
cd $GCC_VERSION
./contrib/download_prerequisites # windowsとの共有ディレクトリ/vagrant_dataで実行していると、この行でシンボリックリンクが張られるときに管理権限がなくて失敗するので、スクリプトはその以外の場所で実行する
cd ..
ubuntu@ubuntu-xenial:~/cross$ sudo mkdir -p /opt/cross
ubuntu@ubuntu-xenial:~/cross$ sudo chown ubuntu /opt/cross
ubuntu@ubuntu-xenial:~$ sudo ./build.sh
#!/bin/bash
set -e
BINUTILS_VERSION=binutils-2.25
LINUX_KERNEL_VERSION=linux-3.16
GCC_VERSION=gcc-5.2.0
GLIBC_VERSION=glibc-2.22
wget -nc http://ftpmirror.gnu.org/binutils/$BINUTILS_VERSION.tar.gz
wget -nc https://www.kernel.org/pub/linux/kernel/v3.x/$LINUX_KERNEL_VERSION.tar.xz
wget -nc http://ftpmirror.gnu.org/gcc/$GCC_VERSION/$GCC_VERSION.tar.gz
wget -nc http://ftpmirror.gnu.org/glibc/$GLIBC_VERSION.tar.xz
for f in *.tar*; do
tar xfk $f
done
cd $GCC_VERSION
./contrib/download_prerequisites # windowsとの共有ディレクトリ/vagrant_dataで実行していると、この行でシンボリックリンクが張られるときに管理権限がなくて失敗するので、スクリプトはその以外の場所で実行する
cd ..
ubuntu@ubuntu-xenial:~/cross$ sudo mkdir -p /opt/cross
ubuntu@ubuntu-xenial:~/cross$ sudo chown ubuntu /opt/cross
ubuntu@ubuntu-xenial:~$ sudo ./build.sh
#!/bin/bash
set -e
PREFIX=/opt/cross
PARALLEL_MAKE=-j4
CONFIGURATION_OPTIONS="--disable-multilib --disable-nls"
BINUTILS_VERSION=binutils-2.25
LINUX_KERNEL_VERSION=linux-3.16
GCC_VERSION=gcc-5.2.0
GLIBC_VERSION=glibc-2.22
TERMCAP_VERSION=termcap-1.3.1
GDB_VERSION=gdb-7.3.1
mkdir -p $PREFIX
chown ubuntu $PREFIX
build() {
local TARGET="$1"
local LINUX_ARCH="$2"
# Step 1. Binutils
mkdir -p build-binutils-$TARGET
cd build-binutils-$TARGET
../$BINUTILS_VERSION/configure --prefix=$PREFIX --target=$TARGET $CONFIGURATION_OPTIONS
make $PARALLEL_MAKE
make install
cd ..
# Step 2. Linux Kernel Headers
cd $LINUX_KERNEL_VERSION
make ARCH=$LINUX_ARCH INSTALL_HDR_PATH=$PREFIX/$TARGET headers_install
cd ..
# Step 3. C/C++ Compilers
mkdir -p build-gcc-$TARGET
cd build-gcc-$TARGET
../$GCC_VERSION/configure --prefix=$PREFIX --target=$TARGET --enable-languages=c,c++ $CONFIGURATION_OPTIONS
make $PARALLEL_MAKE gcc_cv_libc_provides_ssp=yes all-gcc
make install-gcc
cd ..
# Step 4. Standard C Library Headers and Startup Files
mkdir -p build-glibc-$TARGET
cd build-glibc-$TARGET
../$GLIBC_VERSION/configure --prefix=$PREFIX/$TARGET --build=$MACHTYPE --host=$TARGET --target=$TARGET --with-headers=$PREFIX/$TARGET/include $CONFIGURATION_OPTIONS libc_cv_forced_unwind=yes
make install-bootstrap-headers=yes install-headers
# 今回エラーが出るmake $PARALLEL_MAKE csu/subdir_lib
}
build aarch64-linux-gnu arm64
#!/bin/bash
set -e
PREFIX=/opt/cross
PARALLEL_MAKE=-j4
CONFIGURATION_OPTIONS="--disable-multilib --disable-nls"
BINUTILS_VERSION=binutils-2.25
LINUX_KERNEL_VERSION=linux-3.16
GCC_VERSION=gcc-5.2.0
GLIBC_VERSION=glibc-2.22
TERMCAP_VERSION=termcap-1.3.1
GDB_VERSION=gdb-7.3.1
mkdir -p $PREFIX
chown ubuntu $PREFIX
build() {
local TARGET="$1"
local LINUX_ARCH="$2"
# Step 1. Binutils
mkdir -p build-binutils-$TARGET
cd build-binutils-$TARGET
../$BINUTILS_VERSION/configure --prefix=$PREFIX --target=$TARGET $CONFIGURATION_OPTIONS
make $PARALLEL_MAKE
make install
cd ..
# Step 2. Linux Kernel Headers
cd $LINUX_KERNEL_VERSION
make ARCH=$LINUX_ARCH INSTALL_HDR_PATH=$PREFIX/$TARGET headers_install
cd ..
# Step 3. C/C++ Compilers
mkdir -p build-gcc-$TARGET
cd build-gcc-$TARGET
../$GCC_VERSION/configure --prefix=$PREFIX --target=$TARGET --enable-languages=c,c++ $CONFIGURATION_OPTIONS
make $PARALLEL_MAKE gcc_cv_libc_provides_ssp=yes all-gcc
make install-gcc
cd ..
# Step 4. Standard C Library Headers and Startup Files
mkdir -p build-glibc-$TARGET
cd build-glibc-$TARGET
../$GLIBC_VERSION/configure --prefix=$PREFIX/$TARGET --build=$MACHTYPE --host=$TARGET --target=$TARGET --with-headers=$PREFIX/$TARGET/include $CONFIGURATION_OPTIONS libc_cv_forced_unwind=yes
make install-bootstrap-headers=yes install-headers
# 今回エラーが出るmake $PARALLEL_MAKE csu/subdir_lib
}
build aarch64-linux-gnu arm64