MIPS交叉编译器 包含组件GCC/GDB/BINUTILS

#!/bin/bash
#tested under CentOS 7 x86_64
#

# env setting
export WDIR=/dev/shm/
export TARGET=mipsel-unknown-linux-gnu
export PREFIX=/usr/local/share/cross-compiler
export PATH="${PATH}":${PREFIX}/bin
cd $WDIR
mkdir ${TARGET}-toolchain  && cd ${TARGET}-toolchain
sudo mkdir -p $PREFIX


# get binutils-2.24.tar.bz2/gcc-4.8.2.tar.bz2/gdb-7.7.tar.bz2
cd $WDIR/${TARGET}-toolchain
#wget http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2
#wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 
#wget http://ftp.gnu.org/gnu/gdb/gdb-6.3a.tar.bz2


# compile binutils-2.24
cd $WDIR/${TARGET}-toolchain
tar xjf binutils-2.24.tar.bz2 
mkdir build-binutils && cd build-binutils
../binutils-2.24/configure --target=$TARGET --prefix=$PREFIX
make
sudo make install


# get gmp/mpc/mpfr
cd $WDIR/${TARGET}-toolchain
#wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
#wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
#wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2

# compile gmp-4.3.2.tar.bz2
cd $WDIR/${TARGET}-toolchain
tar xvf gmp-4.3.2.tar.bz2
cd gmp-4.3.2/
./configure --prefix=$PREFIX
make
sudo make install

# compile mpfr-2.4.2.tar.bz2
cd $WDIR/${TARGET}-toolchain
tar xvf mpfr-2.4.2.tar.bz2
cd mpfr-2.4.2/
./configure --prefix=$PREFIX --with-gmp=$PREFIX
make
sudo make install

# compile mpc-0.8.1.tar.gz
cd $WDIR/${TARGET}-toolchain
tar xvf mpc-0.8.1.tar.gz 
cd mpc-0.8.1/
./configure  --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX
make
sudo make install

# update LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PREFIX/lib/

# compile gcc-4.8.2.tar.bz2 
cd $WDIR/${TARGET}-toolchain
tar xvf gcc-4.8.2.tar.bz2 
mkdir build-gcc-bootstrap && cd build-gcc-bootstrap
../gcc-4.8.2/configure --target=$TARGET --prefix=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --with-gmp=$PREFIX --enable-languages=c --without-headers   --with-gnu-ld --with-gnu-as --disable-shared --disable-threads --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libatomic
make -j4
sudo make install


# compile gdb-7.7.tar.bz2
cd $WDIR/${TARGET}-toolchain
tar xjf gdb-6.3a.tar.bz2
mkdir build-gdb && cd build-gdb
../gdb-6.3/configure --target=$TARGET --prefix=$PREFIX
make -j4
sudo make install

# create soft link for libgmp.so.3/libmpfr.so.1/libmpc.so.2/
# 如果能使用静态库链接就不需要创建软链接了, 还不知道怎么做?
sudo ln -s $PREFIX/lib/libgmp.so.3.5.2 /lib64/libgmp.so.3
sudo ln -s $PREFIX/lib/mpfr.so.1.2.2 /lib64/libmpfr.so.1
sudo ln -s $PREFIX/lib/libmpc.so.2.0.0 /lib64/libmpc.so.2

MIPS交叉编译器 包含组件GCC/GDB/BINUTILS
CrossCompile gcc for MIPS32

[问题] 
[解答] 


[问题] configure: error: cannot compute suffix of object files: cannot compile

[解答]export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PREFIX/lib/

首先安装好 binutils, 然后执行 configure 命令

CC=clang ../gcc-4.8.2/configure

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值