body
{
font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI",Tahoma,Helvetica,Sans-Serif,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLiU,serif;
font-size: 10.5pt;
line-height: 1.5;
}
html, body
{
}
h1 {
font-size:1.5em;
font-weight:bold;
}
h2 {
font-size:1.4em;
font-weight:bold;
}
h3 {
font-size:1.3em;
font-weight:bold;
}
h4 {
font-size:1.2em;
font-weight:bold;
}
h5 {
font-size:1.1em;
font-weight:bold;
}
h6 {
font-size:1.0em;
font-weight:bold;
}
img {
border:0;
max-width: 100%;
height: auto !important;
}
blockquote {
margin-top:0px;
margin-bottom:0px;
}
table {
border-collapse:collapse;
border:1px solid #bbbbbb;
}
td {
border-collapse:collapse;
border:1px solid #bbbbbb;
}
终于......成功了....
首先感谢http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
再加个参考网址保险点,以前看这个一直没能成功...现在懂了...:
http://wiki.osdev.org/GCC_Cross-Compiler
需要先下载下列包,换过其他版本,都失败过...我也是醉了...
wget http://ftpmirror.gnu.org/binutils/binutils-2.24.tar.gz
wget http://ftpmirror.gnu.org/gcc/gcc-4.9.2/gcc-4.9.2.tar.gz
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.4.79.tar.xz
?wgethttp://ftpmirror.gnu.org/glibc/glibc-2.20.tar.xz
wget http://ftpmirror.gnu.org/mpfr/mpfr-3.1.2.tar.xz
wget http://ftpmirror.gnu.org/gmp/gmp-6.0.0a.tar.xz
wget http://ftpmirror.gnu.org/mpc/mpc-1.0.2.tar.gz
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.12.2.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.1.tar.gz
Build Steps
先解压缩所有压缩包:
for f in *.tar*; do tar xf $f; done
(涨知识了...)
把 mpfr,gmp,mpc,isl,cloog放到gcc目录下:
cd gcc-4.9.2
ln -s ../mpfr-3.1.2 mpfr
ln -s ../mpc-1.0.2 mpc
ln -s ../isl-0.12.2 isl
ln -s ../cloog-0.18.1 cloog
cd ..
然后再创建一个交叉编译根目录:
sudo mkdir -p /opt/cross
sudo chown -R 777 /opt/cross
申明环境变量:
export PREFIX=/opt/cross
export PATH=/opt/cross/bin:$PATH
export TARGET=arm-linux-gnueabihf
ok,开始主要步奏
=========================================
Step 1:构建Binutils
mkdir build-binutils
cd build-binutils
../binutils-2.24/configure --prefix=$PREFIX --target=$TARGET --disable-multilib
make -j8
sudo make install
cd ..
Step 2:Linux Kernel Headers
cd linux-3.4.79
sudo make ARCH=arm INSTALL_HDR_PATH=/opt/cross/$TARGET headers_install
cd ..
Step 3:C/C++ Compilers
mkdir build-gcc
cd build-gcc
../gcc-4.9.2/configure --prefix=$PREFIX --target=$TARGET --enable-languages=c,c++ --disable-multilib
make -j8 all-gcc
sudo make install-gcc
cd ..
Step 4:Standard C Library Headers and Startup Files
mkdir -p build-glibc
cd build-glibc
../glibc-2.20/configure --prefix=/opt/cross/$TARGET --build=$MACHTYPE --host=$TARGET --target=$TARGET --with-headers=/opt/cross/$TARGET/include --disable-multilib libc_cv_forced_unwind=yes
sudo make install-bootstrap-headers=yes install-headers
sudo make -j8 csu/subdir_lib
sudo install csu/crt1.o csu/crti.o csu/crtn.o /opt/cross/$TARGET/lib
sudo $TARGET-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o /opt/cross/$TARGET/lib/libc.so
sudo touch /opt/cross/$TARGET/include/gnu/stubs.h
cd ..
Step 5:Compiler Support Library
cd build-gcc
sudo make -j8 all-target-libgcc
sudo make install-target-libgcc
cd ..
Step 6:Standard C Library
cd build-glibc
sudo make -j8
sudo make install
cd ..
Step 7:Standard C++ Library
cd build-gcc
sudo make -j8
sudo make install
cd ..