在Centos 6.2(64位)上编译Apache 2.4.3

时间:2012-12-11 04:52:50

标签: apache2 centos

我尝试在Centos 6.2(64位)上使用apr-1.4.6和apr-util-1.5.1编译Apache 2.4.3。

  

./ configure --build = x86_64-unknown-linux-gnu   --host = x86_64-unknown-linux-gnu --target = x86_64-redhat-linux-gnu --program-prefix = --prefix = / usr --exec-prefix = / usr --bindir = / usr / bin --sbindir = / usr / sbin --sysconfdir = / etc --dadadir = / usr / share --includedir = / usr / include --libdir = / usr / lib64 --libexecdir = / usr / libexec --localstatedir = / var --sharedstatedir = / var / lib --mandir = / usr / share / man --infodir = / usr / share / info --cache-file = .. / config.cache --with-libdir = lib64 - -with-config-file-path = / etc --with-config-file-scan-dir = / etc / php.d --disable-debug --with-pic --disable-rpath --without-pear - -with-bz2 --with-exec-dir = / usr / bin --with-freetype-dir = / usr --with-png-dir = / usr --with-xpm-dir = / usr --enable- gd-native-ttf --with-t1lib = / usr --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir = / usr --with-openssl - with-zlib --with-layout = GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --with-kerberos --enable-ucd-snmp-hack --enable- shmop --enable-calendar --with-libxml-dir = / usr --enable-xml --with-system-tzdata --with -mhash --with-apxs2 = / usr / sbin / apxs --libdir = / usr / lib64 / php --enable-pdo = shared --with-mysql = shared,/ usr --with-mysqli = shared,/ usr / lib64 / mysql / mysql_config --with-pdo-mysql = shared,/ usr / lib64 / mysql / mysql_config --without-pdo-sqlite --without-gd --disable-dom --disable-dba --without -unixODBC --disable-xmlreader --disable-xmlwriter --without-sqlite3 --disable-phar --disable-fileinfo --disable-json --without-pspell --disable-wddx --without-curl --disable -posix --disable-sysvmsg --disable-sysvshm --disable-sysvsem ./configure --with-included-apr --with-included-apr-util

当我发布时会发生这种情况:

/root/httpd-2.4.3/srclib/apr/libtool:line 5989:cd:yes / lib:没有这样的文件或目录 libtool:link:无法确定yes/lib' make[3]: *** [libaprutil-1.la] Error 1 make[3]: Leaving directory / root / httpd-2.4.3 / srclib / apr-util'的绝对目录名 make [2]: * [all-recursive]错误1 make [2]:离开目录/root/httpd-2.4.3/srclib/apr-util' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory / root / httpd-2.4.3 / srclib' make:* [all-recursive]错误1

我错过了什么?

2 个答案:

答案 0 :(得分:2)

请执行以下操作:

# Build and install apr 1.2
 cd srclib/apr
 ./configure --prefix=/usr/local/apr-httpd/
 make
 make install

 # Build and install apr-util 1.2
 cd ../apr-util
 ./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/
 make
 make install

 # Configure httpd
 cd ../../
 ./configure --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/ 

答案 1 :(得分:0)

以上让我能够安装apache 2.4.3。不幸的是,对我来说,也许你也是,我在做apachectl -k start时看到了这个:

httpd:/home/netman1/sp/usr/local/apache/conf/httpd.conf第141行的语法错误:   无法将modules / mod_dir.so加载到服务器中:   家用/ netman1 / SP在/ usr /本地/ Apache /模块/ mod_dir.so:      未定义的符号:apr_array_clear

我这样做了,发现一个过时的链接指向旧版本的libapr-1.so。

ldd httpd | grep apr         libaprutil-1.so.0 => /home/netman1/usr/local/apache/apr/lib/libaprutil-1.so.0(0x00002aba9dccb000)         libapr-1.so.0 => /usr/lib64/libapr-1.so.0(0x00002aba9defd000)

为了解决这个问题,我保存了旧链接,然后创建了一个指向正确版本的新链接:

fixed: libapr-1.so.0 -> /opt/app/p3smk1c1/usr/local/apache/apr/lib/libapr-1.so.0.4.6
broken: libapr-1.so.0 -> libapr-1.so.0.2.7

现在,我可以启动apache了,至少它不会抱怨'未定义的符号:apr_array_clear'...希望这会对你有所帮助。