如何在i.MX6平臺上編譯Nginx

本文主要介紹如何在IMX6平臺上編譯Nginx。

1、主機開發環境

Ubuntu12.04 32位  arm-fsl-linux-gnueabi-gcc 4.6.2  即arm-none

可以應用在imx6平臺。

啓揚i.MX6開發板

編譯pcre-8.30.tar

cheng@cheng-virtual-machine:~/samba/IAC-IMX6-KIT/ngix-php/install-pcre$ ./configure -host=arm-fsl-linux-gnueabi prefix=/home/cheng/samba/IAC-IMX6-KIT/ngix-php/install-pcre

Make make install

下載地址:https://sourceforge.net/projects/pcre/ 

2、編譯zlib

tar zxvf zlib-1.2.3.tar.gz -C .

cd zlib-1.2.3/

export CC=arm-none-linux-gnueabi-gcc

export CXX=arm-none-linux-gnueabi-g++

export LD=arm-none-linux-gnueabi-ld

export AR=arm-none-linux-gnueabi-ar

export NGX_SYSTEM=linux

 ./configure --prefix=/home/cheng/samba/QY-imx6s/1.2.4.5-zlib-install

make&&make install

3、編譯nginx-1.9.1.tar.gz,具體的修改查看補丁文件

vim src/os/unix/ngx_errno.h  重複定義問題NGX_SYS_NERR (可能出現)

vim auto/lib/pcre/make

交叉編譯器配置arm-fsl  就是arm-none

export CC=arm-none-linux-gnueabi-gcc

export CXX=arm-none-linux-gnueabi-g++

export LD=arm-none-linux-gnueabi-ld

export AR=arm-none-linux-gnueabi-ar

export NGX_SYSTEM=linux

export NGX_RELEASE=3.2-XT6

export NGX_MACHINE=arm

我的配置信息

cheng@cheng-virtual-machine:~/samba/IAC-IMX6-KIT/ngix-php/nginx-1.9.1$ ./configure --with-http_stub_status_module --prefix=/home/cheng/samba/IAC-IMX6-KIT/install-ngix --without-http_gzip_module --with-pcre=/home/cheng/samba/IAC-IMX6-KIT/ngix-php/install-pcre --with-cc-opt=" -O2 -Wall -I/home/cheng/samba/IAC-IMX6-KIT/ngix-php/install-pcre/include -L/home/cheng/samba/IAC-IMX6-KIT/ngix-php/install-pcre/lib" --with-zlib=/home/cheng/QY-IMX6S/fsl-linaro-toolchain

備註:zlib的安裝包已經被我移動到編譯器路徑下了

4、錯誤信息

解決方法:

cheng@cheng-virtual-machine:~/samba/IAC-IMX6-KIT/ngix-php/install-pcre$ cp lib/libpcre.a libpcre.a

cheng@cheng-virtual-machine:~/samba/IAC-IMX6-KIT/ngix-php/install-pcre$ cp lib/libpcre.a libpcre.la

cheng@cheng-virtual-machine:~/samba/IAC-IMX6-KIT/ngix-php/install-pcre$ mkdir -p .libs

cheng@cheng-virtual-machine:~/samba/IAC-IMX6-KIT/ngix-php/install-pcre/.libs$ cp ../lib/libpcre.a libpcre.a

cheng@cheng-virtual-machine:~/samba/IAC-IMX6-KIT/ngix-php/install-pcre/.libs$ cp ../lib/libpcre.a libpcre.la

 

5、經過上面的修改編譯成功

6、運行nginx過程

root@qiyang ~/nginx$ mount -t nfs -o nolock 192.168.1.166:/home/cheng/ /mnt/  掛載虛擬機到開發板

root@qiyang /mnt/samba/IAC-IMX6-KIT/install-ngix$ cp -r * /root/nginx/ 將安裝包拷貝到開發板中

在開發板中創建目錄,路徑和虛擬機中的安裝路徑一樣

root@qiyang ~/nginx$ cp -r * /home/cheng/samba/IAC-IMX6-KIT/install-ngix/

輸入命令運行nginx

root@qiyang /home/cheng/samba/IAC-IMX6-KIT/install-ngix/sbin$ ./nginx

 

瀏覽器中輸入http://192.168.1.168:80 出現下面的提示表明運行成功。

7、參考鏈接

https://blog.csdn.net/lili72/article/details/43346655

https://blog.csdn.net/lz_obj/article/details/65447321

http://blog.chinaunix.net/uid-31408117-id-5754560.html

https://blog.csdn.net/zbc415766331/article/details/77987095 最後的配置

 

8、編譯PHP

下載http://www.php.net/downloads.php  

export CC=arm-none-linux-gnueabi-gcc

export CXX=arm-none-linux-gnueabi-g++

export LD=arm-none-linux-gnueabi-ld

export AR=arm-none-linux-gnueabi-ar

 

sudo apt-get install xml2

sudo apt-get install libxml2-dev

sudo apt-get install xml2rfc

配置1

./configure --host=arm-none-linux-gnueabi --prefix=/home/cheng/samba/IAC-IMX6-KIT/ppp/install-php --build=arm-linux --enable-sockets --enable-pdo --disable-all

 

配置2

./configure --host=arm-none-linux-gnueabi --prefix=/home/cheng/samba/IAC-IMX6-KIT/install-php5.6.4 --build=arm-linux --enable-sockets --enable-pdo --disable-all

 

編譯成功

9、拷貝到開發板。 路徑要和你的安裝路徑保持一樣

root@qiyang /mnt/samba/IAC-IMX6-KIT/ppp/php-5.6.40$ cp php.ini-development /home

/cheng/samba/IAC-IMX6-KIT/install-php5.6.4/lib/php.ini

cp php.ini-development /home

/cheng/samba/IAC-IMX6-KIT/install-php5.6.4/lib/php.ini

 如有錯漏 歡迎指正!!!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章