中文字幕理论片,69视频免费在线观看,亚洲成人app,国产1级毛片,刘涛最大尺度戏视频,欧美亚洲美女视频,2021韩国美女仙女屋vip视频

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
交叉編譯PHP5、Nginx、Squid的詳細步驟
userphoto

2015.09.19

關注


交叉編譯php5

軟件版本:php-5.4.27

依賴庫:zlib,libxml2

交叉編譯器:arm-hisiv200-linux-gnueabi

  1. 將交叉編譯器路徑添加到PATH中, 我的交叉編譯器目錄為/usr/local/arm-hisiv200-linux/,而交叉編譯器在交叉編譯器目錄的/bin中,在控制臺輸入
    PATH=$PATH:/usr/local/arm-hisiv200-linux/bin/
  2. 首先先交叉編譯zlib,進入zlib源碼目錄。
  3. 執(zhí)行CC=arm-hisiv200-linux-gnueabi-gcc  ./configure  –shared  –prefix=ZLIB_PATH(編譯成功后的安裝路徑)
  4. make && make install
  5. 在ZLIB_PATH中會有編譯成功后的文件和配置。
  6. 然后交叉編譯libxml2,進入libxml2源碼目錄。
  7. 執(zhí)行CC=arm-hisiv200-linux-gnueabi-gcc  ./configure  –host=arm-hisiv200-linux-gnueabi  –prefix=LIBXML2_PATH(編譯成功后的安裝路徑)
  8. make && make install
  9. 在LIBXML2_PATH中會有編譯成功后的文件和配置。
  10. 開始交叉編譯php5,進入php5源碼目錄。
  11. 首先先執(zhí)行./buildconf  –force,為了防止出現(xiàn) cp:cannot stat ‘sapi/cli/php.1′: No such file or directory
  12. 執(zhí)行./configure  –host=arm-hisiv200-linux-gnueabi  –enable-shared  –with-zlib-dir=ZLIB_PATH  –with-libxml-dir=LIBXML2_PATH  –disable-phar  –with-sqlite  –with-pdo-sqlite  –without-iconv  –enable-fpm  –prefix=PHP5_PATH
  13. make && make install
  14. 編譯好的php程序及配置就在PHP5_PATH中。

交叉編譯nginx

軟件版本:nginx-1.6.2

依賴源碼:pcre,zlib(這里是需要用到它們的源碼)

交叉編譯器:arm-hisiv200-linux-gnueabi

linux版本:32位ubuntu(這個很重要,主要是使用32位x86系統(tǒng)才能進行編譯成功,因為字長不一樣)

交叉編譯nginx與交叉編譯php5不同就是nginx用的是依賴的庫的源碼,而php5用的是庫文件。

  1. 進入nginx-1.6.2源碼目錄。
  2. 在配置和編譯nginx會出現(xiàn)很多錯誤,我們一個一個解決,首先我使用的configure配置如下:
    #!/bin/bashCC_PATH=/home/shanlink/Cross_compile/arm-hisiv200-linux/bin/arm-hisiv200-linux-gnueabi-gccCPP_PATH=/home/shanlink/Cross_compile/arm-hisiv200-linux/bin/arm-hisiv200-linux-gnueabi-g++INSTALL_PATH=/home/shanlink/Cross_compile/nginx_ccs/PCRE_PATH=/home/shanlink/Cross_compile/pcre-8.11/ZLIB_PATH=/home/shanlink/Cross_compile/zlib-1.2.3/CC_OPTS="-I /home/shanlink/Cross_compile/arm-hisiv200-linux/target/include/"./configure --prefix=$INSTALL_PATH --with-zlib=$ZLIB_PATH --with-pcre=$PCRE_PATH --with-cc=$CC_PATH --with-cpp=$CPP_PATH --with-cc-opt=$CC_POTS --with-ld-opt="-L /home/shanlink/Cross_compile/arm-hisiv200-linux/target/lib/"
  3. 好的,把以上內(nèi)容做成一個運行腳本,運行,出現(xiàn)一個錯誤:
    checking for OS + Linux 3.13.0-43-generic x86_64checking for C compiler ... found but is not working./configure: error: C compiler /home/shanlink/Cross_compile/arm-hisiv200-linux/bin/arm-hisiv200-linux-gnueabi-gcc is not found

    解決辦法就是:編輯auto/cc/name文件,在文件開頭有如下一段,注釋掉exit 1

    if [ "$NGX_PLATFORM" != win32 ]; then    ngx_feature="C compiler"    ngx_feature_name=    ngx_feature_run=yes    ngx_feature_incs=    ngx_feature_path=    ngx_feature_libs=    ngx_feature_test=    . auto/feature    if [ $ngx_found = no ]; then        echo        echo $0: error: C compiler $CC is not found        echo        #exit 1        注釋掉這一行         fifi
  4. 再次運行我們的配置腳本,這時候出現(xiàn)
    checking for TCP_INFO ... foundchecking for accept4() ... foundchecking for int size ...objs/autotest: 1: objs/autotest: Syntax error: word unexpected (expecting ")")  bytes./configure: error: can not detect int sizecat: objs/autotest.c: No such file or directory

    解決方法:編輯auto/types/sizeof文件,找到

    ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS           -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"將的$CC改為x86上使用的gccngx_test="gcc $CC_TEST_FLAGS $CC_AUX_FLAGS           -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
  5. 再次運行我們的配置腳本,這時應該可以順利配置完成。
  6. 執(zhí)行make,這時候會出現(xiàn)一個錯誤
    checking for C compiler default output file name... a.outchecking for suffix of executables... checking whether we are cross compiling... configure: error: in `/home/shanlink/Cross_compile/pcre-8.11':configure: error: cannot run C compiled programs.If you meant to cross compile, use `--host'.See `config.log' for more details.make[1]: *** [/home/shanlink/Cross_compile/pcre-8.11//Makefile] Error 1make[1]: Leaving directory `/home/shanlink/Cross_compile/nginx-1.6.2'make: *** [build] Error 2

    這個是由于nginx在編譯時會同時配置pcre并且進行編譯,而由于是交叉編譯,pcre的配置時需要添加–host=arm-hisiv200-linux-gnueabi,因為是由nginx自動配置的,所以我們需要手動添加此選項于pcre,然后再make,此選項添加在

    文件:objs/Makefile找到如下一段:/home/shanlink/Cross_compile/pcre-8.11//Makefile:    objs/Makefile    cd /home/shanlink/Cross_compile/pcre-8.11/     && if [ -f Makefile ]; then $(MAKE) distclean; fi     && CC="$(CC)" CFLAGS="-O2 -fomit-frame-pointer -pipe "     ./configure --disable-shared 將    ./configure --disable-shared 改為    ./configure --disable-shared --host=arm-hisiv200-linux-gnueabi(這個交叉編譯器前綴填你們電腦上自己的)
  7. 如果遇到一下錯誤,原因是你們的linux系統(tǒng)是64位的,而arm上一般都是32位的,所以會有這個錯誤,解決辦法就是重新裝一個32位的linux系統(tǒng)。
    src/core/ngx_slab.c: In function 'ngx_slab_alloc_locked':src/core/ngx_slab.c:209: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:209: error: comparison is always true due to limited range of data typesrc/core/ngx_slab.c:221: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:221: error: comparison is always false due to limited range of data typesrc/core/ngx_slab.c:223: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:223: error: comparison is always true due to limited range of data typesrc/core/ngx_slab.c:253: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:253: error: comparison is always true due to limited range of data typesrc/core/ngx_slab.c:262: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:262: error: comparison is always false due to limited range of data typesrc/core/ngx_slab.c:289: error: left shift count >= width of typesrc/core/ngx_slab.c:292: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:294: error: left shift count >= width of typesrc/core/ngx_slab.c:304: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:376: error: left shift count >= width of typesrc/core/ngx_slab.c: In function 'ngx_slab_free_locked':src/core/ngx_slab.c:499: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:499: error: comparison is always false due to limited range of data typesrc/core/ngx_slab.c:552: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:575: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:575: error: comparison is always false due to limited range of data typesrc/core/ngx_slab.c:582: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c: In function 'ngx_slab_alloc_pages':src/core/ngx_slab.c:643: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:652: error: integer constant is too large for 'long' typesrc/core/ngx_slab.c:652: error: large integer implicitly truncated to unsigned typemake[1]: *** [objs/src/core/ngx_slab.o] Error 1make[1]: Leaving directory `/home/shanlink/Cross_compile/nginx-1.6.2'make: *** [build] Error 2
  8. 這時候繼續(xù)make,還會出現(xiàn)兩個錯誤,一個是
    src/os/unix/ngx_errno.c: In function 'ngx_strerror':src/os/unix/ngx_errno.c:37: error: 'NGX_SYS_NERR' undeclared (first use in this function)src/os/unix/ngx_errno.c:37: error: (Each undeclared identifier is reported only oncesrc/os/unix/ngx_errno.c:37: error: for each function it appears in.)src/os/unix/ngx_errno.c: In function 'ngx_strerror_init':src/os/unix/ngx_errno.c:58: error: 'NGX_SYS_NERR' undeclared (first use in this function)make[1]: *** [objs/src/os/unix/ngx_errno.o] Error 1make[1]: Leaving directory `/home/shanlink/Cross_compile/nginx-1.6.2'make: *** [build] Error 2

    解決方法就是打開objs/ngx_auto_config.h,添加

    #ifndef NGX_SYS_NERR#define NGX_SYS_NERR    132#endif

    另一個錯誤

    objs/src/event/ngx_event_accept.o: In function `ngx_event_accept':/home/shanlink/Cross_compile/nginx-1.6.2/src/event/ngx_event_accept.c:64: warning: warning: accept4 is not implemented and will always failobjs/src/core/ngx_cycle.o: In function `ngx_init_cycle':/home/shanlink/Cross_compile/nginx-1.6.2/src/core/ngx_cycle.c:457: undefined reference to `ngx_shm_free'/home/shanlink/Cross_compile/nginx-1.6.2/src/core/ngx_cycle.c:462: undefined reference to `ngx_shm_alloc'/home/shanlink/Cross_compile/nginx-1.6.2/src/core/ngx_cycle.c:648: undefined reference to `ngx_shm_free'objs/src/event/ngx_event.o: In function `ngx_event_module_init':/home/shanlink/Cross_compile/nginx-1.6.2/src/event/ngx_event.c:525: undefined reference to `ngx_shm_alloc'collect2: ld returned 1 exit statusmake[1]: *** [objs/nginx] Error 1make[1]: Leaving directory `/home/shanlink/Cross_compile/nginx-1.6.2'make: *** [build] Error 2shanlink@ubuntu:~/Cross_compile

    同樣的,我們需要修改objs/ngx_auto_config.h文件,在文件中加入

    #ifndef NGX_HAVE_SYSVSHM#define NGX_HAVE_SYSVSHM 1#endif
  9. 好了,這時候make && make install就應該能編譯過去了。
  10. 如果遇到其他編譯問題,請參考:http://blog.csdn.net/fish43237/article/details/40515897

交叉編譯squid

軟件版本:squid-2.7-STABLE9

交叉編譯器:arm-hisiv200-linux-gnueabi

系統(tǒng):32位ubuntu

在對squid進行交叉編譯時,需要用到x86版本的squid,所以我們要進行兩個版本的編譯。

  1. 首先編譯x86版本的使用配置為
    ./configure --prefix=X86_SQUID_PATH
  2. make && make install
  3. 進入到squid源碼目錄下的src/文件夾,有個cf_gen程序,備份起來,交叉編譯時會用到。
  4. 建立一個arm-linux.cache文件,寫入
    ac_cv_epoll_works=ac_cv_af_unix_large_dgram=ac_cv_func_setresuid=ac_cv_func_va_copy=ac_cv_func___va_copy=
  5. 執(zhí)行
    #!/bin/bash./configure --host=arm-hisiv200-linux-gnueabi --prefix=/home/shanlink/Cross_compile/squid_ccs/ --cache-file=arm-linux.cache

    這時應該是能夠順利通過的

  6. 執(zhí)行make,會出現(xiàn)一個錯誤
    ./cf_gen: cannot execute binary file
  7. 將之前備份的x86的cf_gen復制到src/目錄下替換arm的
  8. 再次執(zhí)行make,應該可以順利通過編譯
  9. make install
  10. 完成
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
nginx ssi解析include路徑問題解決方法
linux下lua開發(fā)環(huán)境安裝
一篇文章帶你搞懂Linux下編譯安裝軟件
常用的Nginx重要模塊有什么?linux網(wǎng)絡管理學習
centos編譯安裝nginx,及其編譯參數(shù)解析
nginx1.0.0配ngx_cache_purge實現(xiàn)高效的反向代理
更多類似文章 >>
生活服務
熱點新聞
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服