keropoの備忘録

しらべたことをメモるブログ

ARMクロスコンパラUpdate(gcc-5.4.0)

以前作成したクロスコンパイラがちょっと古くなったのでUpdate

ソース

  • gcc-5.4.0
  • binutils-2.26
  • gmp-6.1.1
  • mpfr-3.1.4
  • mpc-1.0.3
  • eglibc-2_18
  • linux-4.6.4

事前

  • BISON

バージョンが3.0以上だと、eglibcのビルドに失敗するので、2.7にバージョンダウン

  • MAKE

MAKEのバージョンが4.X台だと、eglibcのconfigureに失敗する。
configureを修正するか、makeのバージョンを3.XX台にダウングレード

ソース修正

eglibcのソースはちょっと修正が必要

  cd ${GLIBC_SRC}/libc/ports/sysdeps/unix/sysv/linux/arm/nptl
  mv unwind-forcedunwind.c unwind-forcedunwind.c.org
  mv unwind-resume.c unwind-resume.c.org
  sed -e "25s/;/ __attribute_used__;/" unwind-forcedunwind.c.org > unwind-forcedunwind.c
  sed -e "23s/;/ __attribute_used__;/" unwind-resume.c.org > unwind-resume.c

ビルド

gccのビルド以外は前回と同じ。
gcc1回目から3回目までのビルド手順は以下

gcc 1回目

  $../configure \
        --target=$TARGET \
        --prefix=$CROSS \
        --without-headers \
        --without-ppl \
        --with-newlib \
        --disable-shared \
        --disable-threads \
        --disable-libssp \
        --disable-libgomp \
        --disable-libmudflap \
        --disable-libquadmath \
        --disable-libatomic \
        --disable-nls \
        --with-gmp=$CROSS \
        --with-mpfr=$CROSS \
        --with-mpc=$CROSS \
        --enable-languages=c
  $make
  $make install

gcc 2回目

  $../configure \
        --target=$TARGET \
        --prefix=$CROSS \
        --with-sysroot=$ROOTDIR \
        --with-headers=$ROOTDIR/usr/include \
        --with-libs=$ROOTDIR/usr/lib \
        --disable-multilib \
        --disable-libstdcxx-pch \
        --disable-libssp \
        --disable-libgomp \
        --disable-libmudflap \
        --disable-libquadmath \
        --disable-libatomic \
        --with-gmp=$CROSS \
        --with-mpfr=$CROSS \
        --with-mpc=$CROSS \
        --enable-languages=c

   $make
   $make install

gcc 3回目

  $../configure \
        --target=$TARGET \
        --prefix=$CROSS \
        --with-headers=${ROOTDIR}/usr/include \
        --with-libs="${ROOTDIR}/usr/lib ${ROOTDIR}/lib" \
        --disable-multilib \
        --disable-libstdcxx-pch \
        --disable-libssp \
        --disable-libgomp \
        --disable-libmudflap \
        --disable-libquadmath \
        --disable-libatomic \
        --with-gmp=$CROSS \
        --with-mpfr=$CROSS \
        --with-mpc=$CROSS \
        --enable-languages=c,c++
  $make
  $make install

理由はちょっと不明だが、configureのoptionで、「--with-sysroot」を指定していると、libstdc++-v3のconfigureで

link tests are not allowed after GCC_NO_EXECUTABLES

となり、失敗する。libcが見えていないみたい。
"--with-sysroot"で、クロスコンパイラのルートパスを指定しているのに理由不明
結局、"--with-sysroot"の指定は削除し、以下を追加した。l

  --with-headers=${ROOTDIR}/usr/include \
  --with-libs="${ROOTDIR}/usr/lib ${ROOTDIR}/lib" \