target branch: studio-1.3-release

Recreate matching build environment

The prebuilt compilers are meant to be used on any distro, including old ones.

In this case they are meant to be compiled with Ubuntu 10.04.

 prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6

Prepare the source tree

git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6 -b studio-1.3-release
mkdir wd/
(cd x86_64-linux-glibc2.11-4.6 && cp -a build-lucid-multilib-toolchain.sh toolchain-patches ../wd/)
cd wd/
# 60MB .git/

Determining precise source commits

Checkout date:

cat TOOLCHAIN_SOURCES | while read repo hash ignored; do repo=${repo#toolchain/}; repo=${repo%%.git:}; GIT_DIR=toolchain-src/$repo/.git git rev-list -n1 --format=medium $hash | grep Date; done

=> 2014-03-05T13:04:07+0000

EXCEPT for build.git : the previous commit (wasn't pushed/gerrit'd at time of release?)

Build dependencies

apt-get install gcc g++ patch
apt-get install texinfo  # makeinfo for binutils

Download and build GCC

time ./build-lucid-multilib-toolchain.sh --git-date=2014-03-05T13:04:07+0000 --work-dir=$(pwd)
# TODO: apparently you can --only-sysroot to download & create sysroot/
#       then add '$(pwd)/toolchain-src/' as a parameter to avoid re-downloading
# 15mn compile time with 6 cores
# 8.1GB

Build log in build/build.log

Result in /tmp/x86_64-linux-glibc2.11-4.6.tar.bz2

TODO

There are several manual, post-compilation fixes,

Cf. https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/+/studio-1.3-release (and parents commits)

prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8

Prepare the source tree

git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8 -b studio-1.3-release
mkdir wd/
(cd x86_64-linux-glibc2.11-4.8 && cp -a build-lucid-multilib-toolchain.sh toolchain-patches ../wd/)
cd wd/
# 60MB .git/

Determining precise source commits

Checkout date: cf. TOOLCHAIN_SOURCES as above for 4.6

Download and build GCC

time ./build-lucid-multilib-toolchain.sh --git-date=2014-03-05T13:04:07+0000 --work-dir=$(pwd) --gcc-version=4.8
# 15mn compile time with 6 cores
# 8.3GB

Note: https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/+/22bcfb60ead97d2f8542c5fb5d42e03342644d6b mentions:

#   CC=${AOSP}/prebuilts/tools/gcc-sdk/gcc \
#   CXX=${AOSP}/prebuilts/tools/gcc-sdk/g++ \
#       ./build-lucid-multilib-toolchain.sh --gcc-version=4.8

Build log in build/build.log

Result in /tmp/x86_64-linux-glibc2.11-4.8.tar.bz2

Check the build

Compare versions with original prebuilt:

  • x86_64-linux-glibc2.11-4.8/bin/cloog --version # => 0.18.0
  • x86_64-linux-glibc2.11-4.8/x86_64-linux/bin/ld.gold --version # => 1.11/2.23.2
  • x86_64-linux-glibc2.11-4.8/x86_64-linux/include/c++/4.8/

TODO

All the manual fixes, cf. https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/+/studio-1.3-release and all parents.

prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8

Preparing the source tree

apt-get install subversion
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8 -b studio-1.3-release
mkdir wd/
(cd x86_64-w64-mingw32-4.8 && cp -a ./build-mingw64-toolchain.sh ../wd/)
cd wd/

Download and build GCC

time ./build-mingw64-toolchain.sh --work-dir=$(pwd) --gcc-version=4.8.3
# 10mn compile time with 6 cores
# 2.3GB

Post-compilation fixes:

# https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/+/studio-1.3-release
ln -s ../../../../../../../bionic/libc/include/stdatomic.h install-x86_64-linux-gnu/x86_64-w64-mingw32/include/stdatomic.h

tar -cjf /tmp/x86_64-w64-mingw32.tar.bz2 -C install-x86_64-linux-gnu/ x86_64-w64-mingw32/

Common errors

<Texinfo errors>

14.04 => issues with texinfo when compiling binutils, need to downgrade base system to 10.04 or 12.04

configure: error: C++ preprocessor "/lib/cpp" fails sanity check

=> apt-get install g++

In file included from /home/android/x86_64-linux-glibc2.11-4.6/toolchain-src/binutils/binutils-2.23/gold/expression.cc:33:
/home/android/x86_64-linux-glibc2.11-4.6/toolchain-src/binutils/binutils-2.23/gold/script-c.h:221: error: ‘yylex’ initialized and declared ‘extern’
/home/android/x86_64-linux-glibc2.11-4.6/toolchain-src/binutils/binutils-2.23/gold/script-c.h:221: error: ‘YYSTYPE’ was not declared in this scope
/home/android/x86_64-linux-glibc2.11-4.6/toolchain-src/binutils/binutils-2.23/gold/script-c.h:221: error: expected primary-expression before ‘,’ token
/home/android/x86_64-linux-glibc2.11-4.6/toolchain-src/binutils/binutils-2.23/gold/script-c.h:221: error: expected primary-expression before ‘void’
/home/android/x86_64-linux-glibc2.11-4.6/toolchain-src/binutils/binutils-2.23/gold/script-c.h:221: error: initializer expression list treated as compound expression

=> apt-get install flex bison, and restart the build (erase everything)

mingw-w64-tools: Configuring
Error: Can't configure mingw-64-tools
COMMAND: >>>> /tmp/build-mingw64-toolchain-android/src/mingw-w64-svn-r5861/mingw-w64-tools/widl/configure --prefix=/tmp/build-mingw64-toolchain-android/install-x86_64-linux-gnu/x86_64-w64-mingw32 --target=x86_64-w64-mingw32

=> apt-get install subversion