GCC --disable-nls, --enable-languages, --without-headers Unrecognized
I'm trying to make a bash script that will install a gcc cross-compiler for i686-elf on a Debian computer, but I keep getting the same error:
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure: WARNING: unrecognized options: --disable-nls, --enable-languages, --without-headers
make: *** No rule to make target 'all-gcc'. Stop.
make: *** No rule to make target 'all-target-libgcc'. Stop.
make: *** No rule to make target 'install-gcc'. Stop.
make: *** No rule to make target 'install-target-libgcc'. Stop.Does anyone have any idea why these options aren't recognized? I've installed this version before without this problem.
In case it helps, here's my script:
####################################
echo Stage 1 - Building Dependencies
####################################
# make a working directory
cd $HOME/Documents
rm -rf Cross
mkdir Cross
cd Cross
# install or update all apt-get dependencies
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc # not cross
sudo apt-get install g++
sudo apt-get install make
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install gawk
sudo apt-get install libgmp3-dev
sudo apt-get install libmpfr-dev libmpfr-doc libmpfr4 libmpfr4-dbg
sudo apt-get install mpc
sudo apt-get install texinfo # optional
sudo apt-get install libcloog-isl-dev # optional
sudo apt-get install build-essential
sudo apt-get install glibc-devel
sudo apt-get -y install gcc-multilib libc6-i386
# download and unpack necessary files
wget
wget
wget
for f in *.tar*; do tar xf $f; done
mv mpc-1.0.3 gcc-5.2.0
# create installation directory
sudo mkdir -p /opt/cross
sudo chown user /opt/cross
export PREFIX=/opt/cross
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
################################
echo Stage 2 - Building Compiler
################################
# install binutils
mkdir build-binutils
cd build-binutils
../binutils-2.25.1/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make
make install
cd ..
# install gcc
mkdir build-gcc
cd build-gcc
../gcc-5.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc 5 1 Answer
Here is the finished file (setup-gcc.sh):
####################################
echo Stage 1 - Building Dependencies
####################################
# make a working directory
cd $HOME/Documents
rm -rf Cross
mkdir Cross
cd Cross
# install or update all apt-get dependencies
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc # not cross
sudo apt-get install g++
sudo apt-get install make
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install gawk
sudo apt-get install libgmp3-dev
sudo apt-get install libmpfr-dev libmpfr-doc libmpfr4 libmpfr4-dbg
sudo apt-get install mpc
sudo apt-get install texinfo # optional
sudo apt-get install libcloog-isl-dev # optional
sudo apt-get install build-essential
sudo apt-get install glibc-devel
sudo apt-get -y install gcc-multilib libc6-i386
# download and unpack necessary files
wget
wget
wget
for f in *.tar*; do tar zvxf $f; done
# create installation directory
mkdir Install
export PREFIX="$HOME/Documents/Cross/Install"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
################################
echo Stage 2 - Building Compiler
################################
# install mpc
mkdir build-mpc
cd build-mpc
../mpc-1.0.3/configure --prefix="$PREFIX"
make -j2
make -j2 check
make -j2 install
cd ..
# install binutils
mkdir build-binutils
cd build-binutils
../binutils-2.25.1/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make -j2
make -j2 install
cd ..
# install gcc
mkdir build-gcc
cd build-gcc
../gcc-5.3.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers --with-mpc="$PREFIX"
make -j2 all-gcc
make -j2 all-target-libgcc
make -j2 install-gcc
make -j2 install-target-libgccThanks to @Terrance for helping work out the problems. From there, I worked out the rest, did a few major performance improvements, and made it so it should work on all systems.
Once you have it installed, you can run it with:
export PREFIX="$HOME/Documents/Cross/Install"
export TARGET=i686-elf
$PREFIX/bin/$TARGET-gcc --versionUnfortunately, doing this inside of an alias or bash script doesn't seem to properly launch it, so, unless this gets fixed, you might have to just store the script in a text file and copy-paste it into terminal every time you reboot.
To uninstall your cross-compiler, simply delete the $HOME/Documents/Cross directory.
As a final note, changing the installation directory or target is as easy as changing the value of $PREFIX or $TARGET, but I wouldn't recommend it, because you may run into other unexpected problems.