Octave and separate toolchain

From Octave
Revision as of 17:03, 30 October 2016 by Ederag (talk | contribs) (gcc toolchain)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Building of octave together with a separate toolchain (custom built gcc/binutils/...).

This is required mainly when the base linux distribution ships too old a version of gcc. Unexperienced users should upgrade their distribution, though.

The main build directory will be called /usr/local/build. It was first created by root, and then changed to be owned by the user who will perform compilations. You might want change this to another directory in your $HOME for instance.

export buildroot=/usr/local/build

We will need a directory to hold downloaded files

export downloads=$buildroot/downloads
mkdir -p $buildroot/downloads


gcc toolchain

This part is largely inspired by this answer

cd $buildroot
# work in a subshell, to isolate mistakes
bash
# check that PATH and LD_RUN_PATH are normal
echo $PATH
echo $LD_RUN_PATH
cd $downloads
wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.bz2
wget ftp://ftp.gnu.org/gnu/gcc/gcc-6.2.0/gcc-6.2.0.tar.bz2
wget ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.5.tar.xz
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
wget ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.1.tar.xz
wget http://isl.gforge.inria.fr/isl-0.17.tar.xz
cd $buildroot
tar --no-same-owner -xvf $downloads/binutils-2.27.tar.bz2
tar --no-same-owner -xvf $downloads/gcc-6.2.0.tar.bz2
tar --no-same-owner -xvf $downloads/mpfr-3.1.5.tar.xz
tar --no-same-owner -xvf $downloads/mpc-1.0.3.tar.gz
tar --no-same-owner -xvf $downloads/gmp-6.1.1.tar.xz
tar --no-same-owner -xvf $downloads/isl-0.17.tar.xz
cd $buildroot/gcc-6.2.0
ln -s ../mpfr-3.1.5 mpfr
ln -s ../mpc-1.0.3 mpc
ln -s ../gmp-6.1.1 gmp
ln -s ../isl-0.17/ isl
# Now symlink everything from the binutils dir which doesn't exist in the gcc dir,
# so anything which already exists will take priority but the
# binutils tools will look be visible to the build:
for file in ../binutils-2.27/* ; do ln -s "${file}" ; done
# errors ending with "File exists" are normal

Now we are ready to build the toolchain

cd $buildroot
mkdir gcc-6.2.0_isl_build; cd $_
../gcc-6.2.0/configure --prefix=/usr/local/gcc-6.2.0_binutils-2.27_isl --disable-nls --enable-languages=c,c++,fortran,java --disable-multilib
make -j 6 bootstrap


To be continued...