新聞中心

        EEPW首頁 > 嵌入式系統 > 交叉編譯場景分析(arm-linux)(七)

        交叉編譯場景分析(arm-linux)(七)

        ——
        作者: 時間:2007-04-18 來源:http://blog.csdn.net/absurd 收藏
        編譯sqlite
        1. 基本信息:

        軟件名稱
         sqlite
         
        功能簡述
         sqlite是一個針對設計的數據庫管理系統(DBMS),實現了SQL92的基本功能,ARM版的可執行文件約300K.
         
        下載地址
         http://www.sqlite.org/
         
        軟件版本
         sqlite-3.3.4.tar.gz
         
        依賴關系
         默認

        readline
         
        前置條件
         源文件位置:$(WORK_DIR)/ sqlite-3.3.4
         

         

        2.         過程分析

        下載的穩定版本,configure已經存在,直接進行配置:

        [root@linux sqlite-3.3.4]# ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr

                         

        出現了如下錯誤:

        configure: error: unable to find a compiler for building build tools

         

        前面檢查arm-linux-gcc都通過了,怎么還說沒有找到呢?花了點時間看configure的腳本,太復雜了,又結合configure.ac看了一下。原來是要設置config_TARGET_CC和config_BUILD_CC兩個環境變量。config_TARGET_CC是交叉,config_BUILD_CC是主機。重來:

        [root@linux sqlite-3.3.4]# export config_BUILD_CC=gcc

        [root@linux sqlite-3.3.4]# export config_TARGET_CC=arm-linux-gcc

        [root@linux sqlite-3.3.4]# ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr

         

        出現了如下錯誤:

        checking for /usr/include/readline.h... configure: error: cannot check for file existence when cross compiling

         

        readline我們已經編譯過了,readline.h是肯定存在,沒有必要檢查。還是施展我們欺騙大法吧,在cache文件里設置ac_cv_header_readline_h=yes,騙過configure腳本:

        [root@linux sqlite-3.3.4]# echo ac_cv_header_readline_h=yes >$ARCH-linux.cache

        [root@linux sqlite-3.3.4]#./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr --cache-file=$ARCH-linux.cache

         

        這回配置成功了,編譯:

        [root@linux sqlite-3.3.4]# make && make install

         

        有的機器上會出現下列錯誤:

        libtool: compile: unable to infer tagged configuration

        libtool: compile: specify a tag with `--tag'

         

        這時檢查一下libtool里的CC變量是否設置為arm-linux-gcc,如果不是,可以手工改過來,或者設置環境變量lt_compiler=arm-linux-gcc,重新配置一下。

         

        OK,經過幾番周折,終于編譯過去了。

         

        3.         構建處方

        l         sqlite.mk

        SQLITE_DIR="sqlite-3.3.4"

         

        all: clean config build

         

        config:

            @cd $(SQLITE_DIR) && 

            export config_BUILD_CC=gcc && 

            export config_TARGET_CC=arm-linux-gcc && 

            echo ac_cv_header_readline_h=yes >$$ARCH-linux.cache && 

            ./configure --host=$$ARCH-linux --prefix=$$ROOTFS_DIR/usr --cache-file=$$ARCH-linux.cache && 

            echo "config done"

            

        build:

            @cd $(SQLITE_DIR) && 

            make && make install && 

            echo "build done"

            

        clean:

            @cd $(SQLITE_DIR) && 

            if [ -e Makefile ]; then make distclean; fi && 

        echo "clean done" 

         

        linux相關文章:linux教程




        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 湟源县| 洪湖市| 固始县| 鹰潭市| 定远县| 普宁市| 黄浦区| 布尔津县| 江都市| 高安市| 广汉市| 盐津县| 田东县| 蒙山县| 南阳市| 鸡西市| 永宁县| 贵定县| 庆云县| 新巴尔虎右旗| 恭城| 鲁甸县| 杭州市| 革吉县| 湖口县| 西吉县| 鹤壁市| 澜沧| 桐乡市| 红河县| 鄂尔多斯市| 泽库县| 左权县| 焦作市| 佛坪县| 道真| 甘肃省| 宜兰县| 东乡族自治县| 准格尔旗| 晋江市|