1. 程式人生 > >arm-linux-gcc sqlite3 交叉編譯

arm-linux-gcc sqlite3 交叉編譯

http://www.blogjava.net/yxj1314520/archive/2012/04/18/375066.html

首先宣告 :這是我借鑑別人聯合自己的交叉編譯經驗做改動而來的

    1。# tar zxvf sqlite-3.3.7.tar.gz

#cd /usr/local/arm-linux/sqlite-3.3.7

新建一個sqlite-arm-linux目錄

    2.# mkdir /usr/local/arm-linux/sqlite-arm-linux

    3.# cd /usr/local/arm-linux/sqlite-arm-linux

    # export PATH=/usr/local/arm-linux/bin:$PATH


    4.#../sqlite-3.3.7/configure --host=arm-linux --prefix=/usr/local/arm-linux/sqlite-arm-linux

這部會出現下面的錯誤:


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


這個錯誤的解決方法是:


首先,我們進入目錄usr/local/arm-linux/sqlite-1.3.7,開啟其中的configure檔案,用查詢功能找到下列語句:

    (用 test "$cross_compiling" = yes &&進行搜尋)


# test "$cross_compiling" = yes &&

# { { echo "$as_me:13264: error: cannot check for file existence when cross compiling" >&5

#echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}

# { (exit 1); exit 1; }; }

把其中的{ (exit 1); exit 1; }; }改為 { (echo 1); echo 1; }; }

一共有兩處,都改過來。


然後,我們要設定config_TARGET_CC和config_BUILD_CC兩個環境變數。config_TARGET_CC是交叉編譯器,config_BUILD_CC是主機編譯器。重來:

#export config_BUILD_CC=gcc

#export config_TARGET_CC=arm-linux-gcc

下面重新編譯就可以了

#../sqlite-3.3.7/configure --host=arm-linux --prefix=/usr/local/arm-linux/sqlite-arm-linux

然後我們會發現在在/usr/local/arm-linux/sqlite-arm-linux目錄下生成一些相關檔案: config.log config.status libtool Makefile sqlite3.pc

 如果:還是出現如下同樣的錯誤checking for /usr/include/readline.h... configure: error: cannot check for file existence when cross compiling

  那麼 首先 : 你檢查你的交叉編譯環境 錯誤?? 如果真的沒有則安裝readline.h 在ubuntu的軟體中心查詢libncurses5-dev libreadline5-dev進行安裝

        如果安裝之後從新。/conigure還是有這個錯誤 那就不管了 我不知道了但是還是生成了makefile檔案!


下面在make之前我們修改一下Makefile檔案,把其中的BCC = arm-linux-gcc -g -O2 為 BCC = gcc -g -O2
#make

#make install

會出現這樣的話語:libsqlite3.so.0.8.6: ELF 32-bit LSB shared object, ARM, version 1 (ARM), not stripped

        over !!!