CentOS6.5安装apache遇到的错误

1、安装apr-1.6.3

[root@yao src]# wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gz
 之后解压, ./configure --prefix=/usrlocal/apr && make && makeinstall
2、安装apr-util-1.6.1

[root@yao src]# wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

 ./configure--prefix=/usr/local/apr-util --with-apr=/usr/local/apr&& make && make install

 但是make过程中,apr-util出现错误,原来是缺少expat包

[root@yao apr-util-1.6.1]# make
make[1]: Entering directory `/usr/local/src/apr-util-1.6.1'
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthre            ad   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/usr/local/src/apr-            util-1.6.1/include -I/usr/local/src/apr-util-1.6.1/include/private  -I/usr/local            /apr/include/apr-1    -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: error: expat.h: No such file or directory
xml/apr_xml.c:66: error: expected specifier-qualifier-list before ‘XML_Parser’
xml/apr_xml.c: In function ‘cleanup_parser’:
xml/apr_xml.c:364: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:365: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c: At top level:
xml/apr_xml.c:384: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
xml/apr_xml.c: In function ‘apr_xml_parser_create’:
xml/apr_xml.c:401: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:402: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:410: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:411: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:412: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:424: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:424: error: ‘default_handler’ undeclared (first use in this functi            on)
xml/apr_xml.c:424: error: (Each undeclared identifier is reported only once
xml/apr_xml.c:424: error: for each function it appears in.)
xml/apr_xml.c: In function ‘do_parse’:
xml/apr_xml.c:434: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:438: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c:442: error: ‘apr_xml_parser’ has no member named ‘xp_err’
xml/apr_xml.c:442: error: ‘apr_xml_parser’ has no member named ‘xp’
xml/apr_xml.c: In function ‘apr_xml_parser_geterror’:
xml/apr_xml.c:500: error: ‘apr_xml_parser’ has no member named ‘xp_err’
xml/apr_xml.c:500: error: ‘apr_xml_parser’ has no member named ‘xp_err’
make[1]: *** [xml/apr_xml.lo] Error 1
make[1]: Leaving directory `/usr/local/src/apr-util-1.6.1'
make: *** [all-recursive] Error 1
[root@yao apr-util-1.6.1]# yum install expat-devel
3、安装httpd2.4.29
[root@yao src]# wget http://mirrors.shu.edu.cn/apache//httpd/httpd-2.4.29.tar.gz

[[email protected]]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd--enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid--enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

checking for chosenlayout... Apache

checking for workingmkdir -p... yes

checking for grepthat handles long lines and -e... /bin/grep

checking foregrep... /bin/grep -E

checking buildsystem type... x86_64-pc-linux-gnu

checking host systemtype... x86_64-pc-linux-gnu

checking targetsystem type... x86_64-pc-linux-gnu

configure:

configure:Configuring Apache Portable Runtime library...

configure:

checking for APR...yes

  setting CC to "gcc"

  setting CPP to "gcc -E"

  setting CFLAGS to " -g -O2-pthread"

  setting CPPFLAGS to " -DLINUX-D_REENTRANT -D_GNU_SOURCE"

  setting LDFLAGS to " "

configure:

configure:Configuring Apache Portable Runtime Utility library...

configure:

checking forAPR-util... yes

checking for gcc...gcc

checking whether theC compiler works... yes

checking for Ccompiler default output file name... a.out

checking for suffixof executables...

checking whether weare cross compiling... no

checking for suffixof object files... o

checking whether weare using the GNU C compiler... yes

checking whether gccaccepts -g... yes

checking for gccoption to accept ISO C89... none needed

checking how to runthe C preprocessor... gcc -E

checking for gccoption to accept ISO C99... -std=gnu99

checking forpcre-config... false

configure: error:pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

[[email protected]]# echo $?

1

 ./configure错误,应该是缺少pcre包

[root@yao src]# wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
之后是解压, ./configure --prefix=/usr/local&& make && make install 的步骤,再次./configure
[root@yao httpd-2.4.29]#  ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to " -g -O2 -pthread"
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C99... -std=gnu99
checking for pcre-config... /usr/local/bin/pcre-config
configure: Using external PCRE library from /usr/local/bin/pcre-config
  setting PCRE_INCLUDES to "-I/usr/local/include"
  setting PCRE_LIBS to "-L/usr/local/lib -lpcre"
configure:
configure: Configuring Apache httpd...
configure:
  setting INCLUDES to "-I."
  adding "-I$(top_srcdir)/os/$(OS_DIR)" to INCLUDES
  adding "-I$(top_srcdir)/include" to INCLUDES
  adding "-I/usr/local/apr/include/apr-1" to INCLUDES
  adding "-I/usr/local/apr-util/include/apr-1" to INCLUDES
  adding "-I/usr/local/include" to INCLUDES
configure:
configure: Applying OS-specific hints for httpd...
configure:
……
……
checking for OpenSSL... checking for user-provided OpenSSL base directory... none
    Server Version: 2.4.29
    Install prefix: /usr/local/apache
    C compiler:     gcc -std=gnu99
    CFLAGS:          -g -O2 -pthread
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE
    LDFLAGS:
    LIBS:
    C preprocessor: gcc -E

[root@yao httpd-2.4.29]# echo $?
0
[root@yao httpd-2.4.29]# make install
……
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserCreate'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetUserData'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ErrorString'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserFree'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetElementHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_StopParser'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_Parse'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler'
collect2: ld returned 1 exit status
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.4.29/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.4.29/support'
make: *** [all-recursive] Error 1
应该是 apr-util 版本过高,重新下载一个 apr-util-1.5.4.tar.gz

[root@yao httpd-2.4.29]# wget http://download.openpkg.org/components/cache/apr/apr-util-1.5.4.tar.gz
还是出现问题

……
server/.libs/libmain.a(exports.o):(.data+0x1588): undefined reference to `apr_redis_server_create'
server/.libs/libmain.a(exports.o):(.data+0x1590): undefined reference to `apr_redis_create'
server/.libs/libmain.a(exports.o):(.data+0x1598): undefined reference to `apr_redis_getp'
server/.libs/libmain.a(exports.o):(.data+0x15a0): undefined reference to `apr_redis_set'
server/.libs/libmain.a(exports.o):(.data+0x15a8): undefined reference to `apr_redis_setex'
server/.libs/libmain.a(exports.o):(.data+0x15b0): undefined reference to `apr_redis_delete'
server/.libs/libmain.a(exports.o):(.data+0x15b8): undefined reference to `apr_redis_version'
server/.libs/libmain.a(exports.o):(.data+0x15c0): undefined reference to `apr_redis_info'
server/.libs/libmain.a(exports.o):(.data+0x15c8): undefined reference to `apr_redis_incr'
server/.libs/libmain.a(exports.o):(.data+0x15d0): undefined reference to `apr_redis_decr'
server/.libs/libmain.a(exports.o):(.data+0x15d8): undefined reference to `apr_redis_ping'
server/.libs/libmain.a(exports.o):(.data+0x15e0): undefined reference to `apr_redis_multgetp'
server/.libs/libmain.a(exports.o):(.data+0x15e8): undefined reference to `apr_redis_stats'
server/.libs/libmain.a(exports.o):(.data+0x1708): undefined reference to `apr_siphash'
server/.libs/libmain.a(exports.o):(.data+0x1710): undefined reference to `apr_siphash_auth'
server/.libs/libmain.a(exports.o):(.data+0x1718): undefined reference to `apr_siphash24'
server/.libs/libmain.a(exports.o):(.data+0x1720): undefined reference to `apr_siphash24_auth'
server/.libs/libmain.a(exports.o):(.data+0x1728): undefined reference to `apr_siphash48'
server/.libs/libmain.a(exports.o):(.data+0x1730): undefined reference to `apr_siphash48_auth'
collect2: ld returned 1 exit status
make[1]: *** [httpd] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.4.29'
make: *** [all-recursive] Error 1
尝试修改 apr-util 路径
[root@yao httpd-2.4.29]# ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/bin
还是出现上一个问题;

 

yum installlibtools-ltdl-devel 并重新编译安装apr-util,依旧没办法解决

选择下载openssl

[root@yao httpd-2.4.29]# wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz
[root@yao httpd-2.4.29]# ./config --prefix=/usr/local/openssl shared
……
[root@yao httpd-2.4.29]# 2~./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --with-ssl=/usr/local/openssl
依旧失败

重新编译安装了apr1.5 apr-util1.5版本,再次编译,依旧出现原来的错误。

https://www.jianshu.com/p/ba5d5622e9d8这个网站的博主整理了很多错误。


你可能感兴趣的:(Linux)