1.make: *** [configure-target-libgcc] Error 1
2.å¦ä½ä¸ºåµå
¥å¼å¼å建ç«äº¤åç¼è¯ç¯å¢
3.rtems开发环境搭建
4.充分理解Linux GCC 链接生成的源码mybatis源码阅读指南Map文件
5.newlib简介
6.平头哥玄铁e902仿真环境搭建
make: *** [configure-target-libgcc] Error 1
GCCæºç çæ¬: GCC 4.6.2,
æ¬å°GCCç¼è¯å¨çæ¬ï¼gcc (GCC) 4.6.3 (Fedora)
ç¼è¯é ç½®ï¼ ../gcc-4.6.1/configure --target=$TARGET--prefix=$PREFIX --without-headers --enable-languages=c --disable-threads --disable-decimal-float --with-newlib --disable-shared--disable-libmudflap --disable-libssp
#-----------------------------------#
ä½ æ³å®è£ çæ¯ 4.6.2 è¿æ¯4.6.1ï¼
å¦ä½ä¸ºåµå ¥å¼å¼å建ç«äº¤åç¼è¯ç¯å¢
ããä¸é¢æ们å°ä»¥å»ºç«é对armç交åç¼è¯å¼åç¯å¢ä¸ºä¾æ¥è§£è¯´æ´ä¸ªè¿ç¨ï¼å ¶ä»çä½ç³»ç»æä¸è¿ä¸ªç¸ç±»ä¼¼ï¼åªè¦ä½ä¸äºå¯¹åºçæ¹å¨ãæçå¼åç¯å¢æ¯ï¼å®¿ä¸»æº i-redhat-7.2ï¼ç®æ æº armã
ããè¿ä¸ªè¿ç¨å¦ä¸
ãã1. ä¸è½½æºæ件ãè¡¥ä¸å建ç«ç¼è¯çç®å½
ãã2. 建ç«å æ ¸å¤´æ件
ãã3. 建ç«äºè¿å¶å·¥å ·ï¼binutilsï¼
ãã4. 建ç«åå§ç¼è¯å¨ï¼bootstrap gccï¼
ãã5. 建ç«cåº(glibc)
ãã6. 建ç«å ¨å¥ç¼è¯å¨ï¼full gccï¼
ããä¸è½½æºæ件ãè¡¥ä¸å建ç«ç¼è¯çç®å½
ãã1. éå®è½¯ä»¶çæ¬å·
ããéæ©è½¯ä»¶çæ¬å·æ¶ï¼å ççglibcæºä»£ç ä¸çINSTALLæ件ãé£éå举äºè¯¥çæ¬çglibcç¼è¯æ¶æéçbinutils ågccççæ¬å·ãä¾å¦å¨ glibc-2.2.3/INSTALL æ件ä¸æ¨è gcc ç¨ 2.以ä¸ï¼binutils ç¨ 2..1 以ä¸çæ¬ã
ããæéçå个软件ççæ¬æ¯ï¼
ããlinux-2.4.+rmk2
ããbinutils-2..1
ããgcc-2..3
ããglibc-2.2.3
ããglibc-linuxthreads-2.2.3
ããå¦æä½ éçglibcççæ¬å·ä½äº2.2ï¼ä½ è¿è¦ä¸è½½ä¸ä¸ªå«glibc-cryptçæ件ï¼ä¾å¦glibc-crypt-2.1.tar.gzã Linux å æ ¸ä½ å¯ä»¥ä»www.kernel.org æå®çéåä¸è½½ã
ããBinutilsãgccåglibcä½ å¯ä»¥ä»FSFçFTPç«ç¹ftp://ftp.gun.org/gnu/ æå®çéåå»ä¸è½½ã å¨ç¼è¯glibcæ¶ï¼è¦ç¨å° Linux å æ ¸ä¸ç include ç®å½çå æ ¸å¤´æ件ãå¦æä½ åç°æåé没æå®ä¹è导è´ç¼è¯å¤±è´¥ï¼ä½ å°±æ¹åä½ çå æ ¸çæ¬å·ãä¾å¦æå¼å§ç¨linux-2.4.+vrs2ï¼ç¼è¯glibc-2.2.3 æ¶æ¥ BUS_ISA 没å®ä¹ï¼åæ¥åç°å¨ 2.4. å¼å§å®çåå被æ¹ä¸º CTL_BUS_ISAãå¦æä½ æ²¡æå®å ¨çææ¡ä¿è¯ä½ æ¹çå æ ¸æ¹å®å ¨äºï¼å°±ä¸è¦å¨å æ ¸ï¼èæ¯æä½ ç Linux å æ ¸ççæ¬å·éä½æåé«ï¼æ¥éåº glibcã
ããGcc ççæ¬å·ï¼æ¨èç¨ gcc-2. 以ä¸çã太èççæ¬ç¼è¯å¯è½ä¼åºé®é¢ãGcc-2..3 æ¯ä¸ä¸ªæ¯è¾ç¨³å®ççæ¬ï¼ä¹æ¯å æ ¸å¼å人åæ¨èç¨çä¸ä¸ª gcc çæ¬ã
ããå¦æä½ åç°æ æ³ç¼è¯è¿å»ï¼æå¯è½æ¯ä½ éç¨ç软件ä¸æçå å ¥äºä¸äºæ°çç¹æ§èå ¶ä»æé软件ä¸æ¯æçåå ï¼å°±ç¸åºéä½è¯¥è½¯ä»¶ççæ¬å·ãä¾å¦æå¼å§ç¨ gcc-3.3.2ï¼åç°ç¼è¯ä¸è¿ï¼æ¥ asãld ççæ¬å¤ªèï¼æå°±æ gcc é为 2..3ã 太æ°ççæ¬å¤§å¤æ²¡ç»è¿å¤§éçæµè¯ï¼å»ºè®®ä¸è¦éç¨ã
ããå页é¦
ãã2. 建ç«å·¥ä½ç®å½
ããé¦å ï¼æ们建ç«å 个ç¨æ¥å·¥ä½çç®å½ï¼
ããå¨ä½ çç¨æ·ç®å½ï¼æç¨çæ¯ç¨æ·liangï¼å æ¤ç¨æ·ç®å½ä¸º /home/liangï¼å 建ç«ä¸ä¸ªé¡¹ç®ç®å½embeddedã
ãã$pwd
ãã/home/liang
ãã$mkdir embedded
ããåå¨è¿ä¸ªé¡¹ç®ç®å½ embedded ä¸å»ºç«ä¸ä¸ªç®å½ build-toolsãkernel å toolsã
ããbuild-tools-ç¨æ¥åæ¾ä½ ä¸è½½ç binutilsãgcc å glibc çæºä»£ç åç¨æ¥ç¼è¯è¿äºæºä»£ç çç®å½ã
ããkernel-ç¨æ¥åæ¾ä½ çå æ ¸æºä»£ç åå æ ¸è¡¥ä¸ã
ããtools-ç¨æ¥åæ¾ç¼è¯å¥½ç交åç¼è¯å·¥å ·ååºæ件ã
ãã$cd embedded
ãã$mkdir build-tools kernel tools
ããæ§è¡å®åç®å½ç»æå¦ä¸ï¼
ãã$ls embedded
ããbuild-tools kernel tools
ãã3. è¾åºåç¯å¢åé
ããæ们è¾åºå¦ä¸çç¯å¢åéæ¹ä¾¿æ们ç¼è¯ã
ãã$export PRJROOT=/home/liang/embedded
ãã$export TARGET=arm-linux
ãã$export PREFIX=$PRJROOT/tools
ãã$export TARGET_PREFIX=$PREFIX/$TARGET
ãã$export PATH=$PREFIX/bin:$PATH
ããå¦æä½ ä¸æ¯ç¨ç¯å¢åéçï¼ä½ å¯ä»¥ç´æ¥ç¨ç»å¯¹æç¸å¯¹è·¯å¾ãæå¦æä¸ç¨ç¯å¢åéï¼ä¸è¬é½ç¨ç»å¯¹è·¯å¾ï¼ç¸å¯¹è·¯å¾ææ¶ä¼å¤±è´¥ãç¯å¢åéä¹å¯ä»¥å®ä¹å¨.bashrcæ件ä¸ï¼è¿æ ·å½ä½ logoutææ¢äºæ§å¶å°æ¶ï¼å°±ä¸ç¨èæ¯exportè¿äºåéäºã
ããä½ç³»ç»æåä½ çTAEGETåéç对åºå¦ä¸è¡¨
ããä½ å¯ä»¥å¨éè¿glibcä¸çconfig.subèæ¬æ¥ç¥éï¼ä½ çTARGETåéæ¯å¦è¢«æ¯æï¼ä¾å¦ï¼
ãã$./config.sub arm-linux
ããarm-unknown-linux-gnu
ããå¨æçç¯å¢ä¸ï¼config.sub å¨ glibc-2.2.3/scripts ç®å½ä¸ã
ããç½ä¸è¿æä¸äº HOWTO å¯ä»¥åèï¼ARM ä½ç³»ç»æçãThe GNU Toolchain for ARM Target HOWTOãï¼PowerPC ä½ç³»ç»æçãLinux for PowerPC Embedded Systems HOWTOãçã对TARGETçéåå¯è½æ帮å©ã
ãã4. 建ç«ç¼è¯ç®å½
ãã为äºææºç åç¼è¯æ¶çæçæ件åå¼ï¼ä¸è¬çç¼è¯å·¥ä½ä¸å¨çæºç ç®å½ä¸ï¼è¦å¦å»ºä¸ä¸ªç®å½æ¥ä¸é¨ç¨äºç¼è¯ãç¨ä»¥ä¸çå½ä»¤æ¥å»ºç«ç¼è¯ä½ ä¸è½½çbinutilsãgccåglibcçæºä»£ç çç®å½ã
ãã$cd $PRJROOT/build-tools
ãã$mkdir build-binutils build-boot-gcc build-gcc build-glibc gcc-patch
ããbuild-binutils-ç¼è¯binutilsçç®å½
ããbuild-boot-gcc-ç¼è¯gcc å¯å¨é¨åçç®å½
ããbuild-glibc-ç¼è¯glibcçç®å½
ããbuild-gcc-ç¼è¯gcc å ¨é¨çç®å½
ããgcc-patch-æ¾gccçè¡¥ä¸çç®å½
ããgcc-2..3 çè¡¥ä¸æ gcc-2..3-2.patchãgcc-2..3-no-fixinc.patch ågcc-2..3-returntype-fix.patchï¼å¯ä»¥ä» monly used with uClinux. uC-libc and
uClibc. They are quite different despite their similar names. Here is a
quick overview of how they are different.
ããuC-libc is the original library for uClinux. It was based on sources
from the Linux- C library which was part of the ELKs project with m
support added by Jeff Dionne and Kenneth Albanowski. It is a fairly complete
libc implementation, however, some of the API's are a little non-standard
and quite a few common libc routines are not present. Currently it has
stable support for m, ColdFire and ARM (Non-MMU) architectures. It was
primary design goal is to be small and light weight. It does try to conform
to any standards, although its API tries to be compatible with most libcs,
it is not always exactly the same.
ããThe uClinux distribution provides an environment that can compile using
either uC-libc or uClibc depending on your needs. For m and Coldfire
platforms it is generally better to chose uC-libc as it supports shared
libraries and is the most commonly used libc for these CPUs. uClibc also
works quite well with almost all platforms supported by the distribution.
Which libc you choose to use will be decided by your requirements
uClinuxæ两个ç»å¸¸ä½¿ç¨çlibcåºï¼uC-libcåuClibcãè½ç¶ä¸¤è ååå¾ç¸ä¼¼ï¼å ¶å®æå·®
å«ï¼ä¸é¢å°±ç®åçä»ç»ä¸ä¸äºè çä¸åä¹å¤ãuC -libcæ¯ææ©ä¸ºuClinuxå¼åçåºï¼æ¯
Jeff DionneåKenneth Albanowski为å¨EKLs项ç®ä¸æ¯æmå¨Linux- Cåºæºç
ä¸ç§»æ¤çãuC-libcæ¯ä¸ä¸ªå®å ¨çlibcå®ç°ï¼ä½å ¶ä¸æä¸äºapiæ¯éæ åçï¼æäºlibcç
æ åä¹æ²¡æå®ç°ãuC-libc稳å®å°æ¯æ mï¼ColdFireå没æMMUçARMãå ¶ä¸»è¦è®¾è®¡
ç®æ æ¯âå°âã"è½»"ï¼å¹¶å°½éä¸æ åä¸è´ï¼è½ç¶å®çAPIåå¾å¤libcå ¼å®¹ï¼ä½æ¯ä¼¼ä¹å¹¶
ä¸åå®ææçé£æ ·åæææ åä¸è´ã
uClibcå°±æ¯ä¸ºäºè§£å³è¿ä¸ªé®é¢ä»uC-libcä¸åå±åºæ¥çãå®çææAPIé½æ¯æ åç(æ£ç¡®
çè¿åç±»åï¼åæ°çç)ï¼å®å¼¥è¡¥äºuC-libcä¸æ²¡æå®ç°çlibcæ åï¼ç°å¨å·²ç»è¢«ç§»æ¤å°
å¤ç§æ¶æä¸ãä¸è¬æ¥è®²ï¼å®å°½éå ¼å®¹glibc以便使åºç¨ç¨åºç¨uClibcæ¹ååç容æã
uClibcè½å¤å¨æ åç VM linuxåuClinuxä¸é¢ä½¿ç¨ã为äºåºç¨ç¨åºçç®æ´ï¼å®çè³å¯ä»¥
å¨è®¸å¤æ¯æMMUçå¹³å°ä¸è¢«ç¼è¯æå ±äº«åºãErik Andersonå¨uClibcèååäºå¾å¤çå·¥
ä½ãuClibcæ¯æ许å¤ç³»åçå¤çå¨ï¼mï¼Coldfireï¼ARMï¼MIPSï¼vï¼ xï¼
iï¼Sparcï¼SuperHï¼Alphaï¼PowerPCåHitachi 8ãä¸æå¢å çå¹³å°æ¯ææ¾ç¤ºuClibc
è½å¤å¾å®¹æçéåºæ°çæ¶æãuClinuxåè¡çæä¾äºç¯å¢è½å¤è®©ä½ éæ©ä½¿ç¨uC-libcææ¯
uClibcç¼è¯ã对äºmåColdfireå¹³å°æ¥è¯´ï¼éæ©uC-libcè¿æ¯ç¨å¾®å¥½ä¸ç¹ï¼å 为å®
æ¯æå ±äº«åºï¼èå ±äº«åºæ¯è¿äºcpuç»å¸¸ä½¿ç¨ç libc.uClibcä¹å ä¹åææçå¹³å°é½è½å¾
好çå·¥ä½ãéæ©åªç§libcåå³äºä½ çéæ±ã
newlib æ¯ä¸ä¸ªç¨äºåµå ¥å¼ç³»ç»çå¼æ¾æºä»£ç çCè¯è¨ç¨åºåºï¼ç±libcålibm两个åºç»
æï¼ç¹ç¹æ¯è½»é级ï¼é度快ï¼å¯ç§»æ¤å°å¾å¤CPUç»æä¸ãnewlibå®ç°äºè®¸å¤å¤æçå
è½ï¼å æ¬å符串æ¯æï¼æµ®ç¹è¿ç®ï¼å ååé (å¦malloc)åI/Oæµå½æ°(printfï¼fprinf()
çç)ãå ¶ä¸libcæä¾äºc è¯è¨åºçå®ç°ï¼èlibmæä¾äºæµ®ç¹è¿ç®æ¯æã
å¨ä¸ºARM交åç¼è¯gccç¼è¯å¨æ¶ï¼å¯¹gccæå®ä¸åçé ç½®é项æ¶ï¼ä½¿ç¨çCè¯è¨åºå°±ä¸åï¼
gccç¼è¯å¨é»è®¤ä½¿ç¨Glibcï¼ä¹å¯ä»¥ä½¿ç¨ uClibc/uC-libc(åºæ¬å ¼å®¹Glibc API)ï¼å½ä½¿ç¨
--with-newlibæ¶ï¼gccç¼è¯å¨ä¸ä½¿ç¨Glibcãå½æ²¡æ交åç¼è¯Glibcæ¶ï¼å¯ä»¥ä½¿ç¨
--with-newlibç¦æ¢è¿æ¥Glibcèç¼è¯bootstrap gccç¼è¯å¨ãä»gccæºç®å½ä¸ç
config/armä¸çt-linuxåt-arm-elfä¸å¯ä»¥çåºï¼ä¸åç--targetä¹å½±ågccè¿æ¥Cè¯è¨
åºï¼t-linux(--target=arm-linux)é»è®¤ä½¿ç¨Glibcï¼-arm-elf(--target=arm-elf)使ç¨
- Dinhibit_libcç¦æ¢è¿æ¥Glibcï¼è¿æ¶æ们就å¯ä»¥ä½¿ç¨newlibçå ¶ä»Cè¯è¨åºç¼è¯GCCå·¥
å ·é¾ã
è½ç¶GCCå·¥å ·é¾é ç½®äºä¸åççCè¯è¨åºï¼ä½ç±äºè¿äºCè¯è¨åºé½å¯ä»¥ç¨æ¥æ¯æGCCï¼å®ä»¬
å¯¹æ ¸å¿æ°æ®çå¤çä¸ä¸åå¨è¾å¤§åºå ¥ãå èarm-linux-* å arm-elf-*åºå«ä¸»è¦è¡¨ç°å¨
Cè¯è¨åºçå®ç°ä¸ï¼ä¾å¦ä¸åç³»ç»è°ç¨ï¼ä¸åçå½æ°éå®ç°ï¼ä¸åçABI\å¯å¨ä»£ç 以å
ä¸åç³»ç»ç¹æ§çå¾®å°çå·®å«ã
arm-linux-*å arm-elf-*ç使ç¨æ²¡æä¸ä¸ªç»å¯¹çæ åï¼æé¤ä¸ååºå®ç°çå·®å¼ï¼gccå¯
以ç¼è¯ä»»ä½ç³»ç»ãarm-linux-*å arm-elf-*é½å¯ä»¥ç¨æ¥ç¼è¯è£¸æºç¨åºåæä½ç³»ç»ï¼åª
æ¯å¨éµå¾ªä¸é¢çæè¿°æ¶ç³»ç»ç¨åºæ¾å¾æ´å åè°ï¼
arm-linux-*é对è¿è¡linuxçARMæºå¨ï¼å ¶ä¾èµäºæå®çCè¯è¨åºGlibcï¼å 为åæ ·ä½¿ç¨
Glibcçlinuxè使å¾arm-linux-*å¨è¿è¡linuxçARMæºå¨ä¸ç¼è¯æ¾å¾æ´å åè°ã
arm-elf-*åæ¯ä¸ä¸ªç¬ç«çç¼è¯ä½ç³»ï¼ä¸ä¾èµäºæå®çCè¯è¨åºGlibcï¼å¯ä»¥ä½¿ç¨newlib
çå ¶ä»Cè¯è¨åºï¼ä¸è¦æ±æä½ç³»ç»æ¯æï¼å½å ¶ä½¿ç¨ä¸ºåµå ¥å¼ç³»ç»è设计çä¸äºè½»å·§çCè¯
è¨åºæ¶ç¼è¯è£¸æºç¨åº(没ælinuxç大åæä½ç³»ç»çç¨åº)ï¼å¦çæ§ç¨åºï¼bootloaderç
è½ä½¿å¾ç³»ç»ç¨åºæ´å å°å·§å¿«æ·ã
Linaro prebuilt toolchain does support both hard and soft floating
point. You can get it from /linaro-toolchain-binaries/+milestone/. try: ./arm-linux-gnueabihf-gcc -print-multi-lib
The default configure is --with-arch=armv7-a --with-tune=cortex-a9
--with-fpu=vfpv3-d --with-float=hard --with-mode=thumb
To use soft floating, you need options: -marm -march=armv4t -mfloat-abi=soft.
In your case, please try to change -march=armv5 to "-march=armv4t"
If you want to change to configure to cortex-a8 and armv5. You need
* Change cortex-a9 to cortex-a8 in
samples/linaro-arm-linux-gnueabihf/crosstool.config
* Change armv4t to armv5 in
contrib/linaro/patches/gcc/linaro-4.7-./multilib.patch,
Then follow the instructions to rebuild the toolchain
(contrib/linaro/doc/README.txt)
BTW: crosstool-ng-linaro does not support multilib for eglibc. It uses
the prebuilt sysroot from Ubuntu Precise. If it does not work for you,
please use the latest crosstool-ng from http://crosstool-ng.org/.