--host=x86_64-linux-gnu --build=x86_64-linux-gnu \
--prefix=$PREFIX \
--enable-languages=c,c++ --enable-shared
make -j2
sudo make install
cd ..
tar -xf gmp-5.0.5.tar.xz cd gmp-5.0.5 ./configure --prefix=/usr make -j2 sudo make install cd .. tar -xf mpfr-3.1.1.tar.xz cd mpfr-3.1.1 ./configure --prefix=/usr make -j2 sudo make install cd .. tar -xf mpc-1.0.1.tar.gz cd mpc-1.0.1 ./configure --prefix=/usr make -j2 sudo make install cd .. # 若系统中安装gmp,mpfr,mpc且版本满足要求,可不用编译安装。 # 构建期间,将三者安装到其他位置,并添加了链接搜索路径,试了几次都没有成功。 # 有时间再做尝试,估计是哪里配置不正确。 ../gcc-4.7.2/configure --target=$TARGET \ --host=x86_64-linux-gnu --build=x86_64-linux-gnu \ --prefix=$PREFIX \ --enable-languages=c,c++ --enable-shared make -j2 sudo make install cd ..7. 测试
(1) 动态编译
arm-linux-gnueabi-gcc -o hello hello.c
arm-linux-gnu-eabi-strip hello
file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped
arm-linux-gnueabi-gcc -o hello hello.c arm-linux-gnu-eabi-strip hello file hello hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped (2) 静态编译
arm-linux-gnueabi-gcc -o hello hello.c -static
arm-linux-gnu-eabi-strip hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, stripped
arm-linux-gnueabi-gcc -o hello hello.c -static arm-linux-gnu-eabi-strip hello hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, stripped 实际还未放入开发板中进行测试,待开发板环境搭好,测试过再做更新。