apache arm 交叉编译_arm apache php交叉编译
設置交叉編譯路徑
CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-gcc
CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-g++
1、zlib http://www.zlib.net/zlib-1.2.11.tar.gz
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc ./configure --prefix=/usr/local/zlib
2、php 的依賴 iconv
sudo wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ ./configure --prefix=/usr/local/libiconv --host=arm-linux
則需要對./srclib/getprogname.c做如下修改:
將原來的:
getprogname (void)
{
# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* glibc, BeOS */
...
}
改為:
getprogname (void)
{
# if ARM
char strProcessPath[1024] = {0};
if(readlink("/proc/self/exe", strProcessPath,1024) <=0)
{
return NULL;
}
char *strProcessName = strrchr(strProcessPath, '/');
if(strProcessName)
{
size_t nameLen = strlen(strProcessName);
char* namecopy = malloc(nameLen + 1);
if (namecopy)
{
namecopy[nameLen] = 0;
return memcpy(namecopy, strProcessName, nameLen);
}
}
return NULL;
# elif HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* glibc, BeOS */
...
}
另在該文件中添加:
#define ARM 1
3、php 的依賴 libxml2
sudo wget ftp://xmlsoft.org/libxml2/libxml2-git-snapshot.tar.gz
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ LD=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-ld ./configure --prefix=/usr/local/libxml2 --host=arm-linux --with-zlib=/usr/local/zlib --without-python
sudo make
sudo make install
#將configure文件中的RM"RM "RM"cfgfile"這行代碼注釋掉就可以了
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ ./configure --prefix=/usr/local/apr --host=arm-linux ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_process_shared_works=yes apr_cv_mutex_robust_shared=yes apr_cv_tcp_nodelay_with_cork=yes ap_void_ptr_lt_long=no ac_cv_sizeof_struct_iovec=8
sudo make
sudo make install
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ ./configure --prefix=/usr/local/apr-util --host=arm-linux --with-apr=/usr/local/apr
sudo make
sudo make install
6、apache 的依賴 pcre
sudo ./configure --prefix=/usr/local/build-source/pce
sudo wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.43.tar.gz
sudo tar -xvf pcre-8.43.tar.gz
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ ./configure --prefix=/usr/local/pcre --host=arm-linux
本機編譯
./configure --with-included-apr --with-included-apr-util --with-pcre=/usr/local/build-source/pce
在執行過./configure指令后,在為開發板編譯httpd執行make命令前,需要先對宿主機上編譯過一次httpd(即至少執行到make,make install可不執行,宿主機上不最終安裝apache2也是可以的),然后到為開發板編譯httpd的httpd-2.4.3目錄下的server目錄中,修改一下其中的Makefile文件,找到如下行:
./gen_test_char > test_char.h 修改為 /usr/local/httpd-2.4.39-pc/server/gen_test_char > test_char.h
sudo CC_FOR_BUILD=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ LD=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-ld LDFLAGS=-lpthread ./configure --prefix=/usr/local/apache --host=arm-linux --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util ap_cv_void_ptr_lt_long=no
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ LD=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-ld ./configure --prefix=/usr/local/php --host=arm-linux --disable-ipv6 --disable-cli --disable-cgi --disable-all --enable-sockets --with-libxml-dir=/usr/local/libxml2 --with-zlib-dir=/usr/local/zlib --with-iconv-dir=/usr/local/libiconv --with-apxs2=/usr/local/apache/bin/apxs
低版本
zlib http://www.zlib.net/zlib-1.2.11.tar.gz
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc ./configure --prefix=/usr/local/zlib
http://archive.apache.org/dist/httpd/httpd-2.2.21.tar.gz
編譯PC版本apache
./configure --prefix=/usr/local/build-source/httpd-2.2.21-pc ap_cv_void_ptr_lt_long=no
編譯apache 參考https://www.cnblogs.com/tanghuimin0713/p/3749817.html
修改/usr/local/build-source/httpd-2.2.21/server/Makefile.in
./gen_test_char > test_char.h 為 /usr/local/build-source/httpd-2.2.21-pc/server/gen_test_char > test_char.h
configure錯誤
vi srclib/apr/configure
注釋
# { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
#$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
#as_fn_error $? "cannot run test program while cross compiling
#See \`config.log' for more details" "$LINENO" 5; }
#else
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ LD=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-ld ./configure --prefix=/usr/local/apache --host=arm-linux --disable-cgi --enable-rewrite --enable-so --enable-modules=all --enable-mods-shared=all --with-z=/usr/local/zlib ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8 ap_cv_void_ptr_lt_long=no ac_cv_struct_rlimit=yes LDFLAGS=-lpthread
httpd 2.xx可能出現的make錯誤
Makefile:141: recipe for target ‘include/private/apr_escape_test_char.h’ failed
cd srclib/apr/include/private
sudo cp /usr/local/build-source/httpd-2.2.21-pc/srclib/apr/include/private/apr_escape_test_char.h .
注釋/usr/local/build-source/httpd-2.2.21/srclib/apr/Makefile
#include/private/apr_escape_test_char.h: tools/gen_test_char
# $(APR_MKDIR) include/private
# tools/gen_test_char > $@
Makefile:23: recipe for target ‘/usr/local/build-source/httpd-2.2.21/srclib/pcre/chartables.c’ failed
cd srclib/pcre/
sudo gcc -Wall -O2 -DCROSS_COMPILE dftables.c -s -o dftables
libxml2
ftp://xmlsoft.org/libxml2/libxml2-git-snapshot.tar.gz
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ LD=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-ld ./configure --prefix=/usr/local/libxml2 --host=arm-linux --with-zlib=/usr/local/zlib --without-python
sudo CC=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-gcc CXX=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-g++ LD=/usr/local/arm_linux_4.3/usr/bin/arm-linux-uclibcgnueabi-ld ./configure --prefix=/usr/local/php --host=arm-linux --disable-ipv6 --disable-cli --disable-cgi --disable-all --enable-sockets --with-libxml-dir=/usr/local/libxml2 --with-zlib-dir=/usr/local/zlib --with-iconv-dir=/usr/local/libiconv --with-apxs2=/usr/local/apache/bin/apxs --cache-file=arm-linux.cache
標簽:bin,4.3,usr,linux,apache,php,local,arm
來源: https://blog.csdn.net/luckywur/article/details/89397535
總結
以上是生活随笔為你收集整理的apache arm 交叉编译_arm apache php交叉编译的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ogr 缓冲区_GDAL的几何操作
- 下一篇: mysql存储过程时间_mysql时间操