当我尝试从源代码编译tomcat连接器时,一切都显示正常,除了没有创buildmod_jk.so文件。
软件版本:RHEL6 x86_64
的httpd-2.4.3
tomcat连接器1.2.37
命令: 唯一的警告信息是:
cd native
./configure --with-apxs=/usr/local/apache2/bin/apxs
make
cd apache-2.0
ls
警告! 在/usr/local/tomcat-connectors-1.2.37-src/native/apache-2.0/mod_jk.la中找不到dlname。
有没有人有任何build议,如何获得mod_jk.so文件生成?
我最终得到这个工作。 事实certificate,我的问题不仅仅是tomcat连接器。
首先,我需要用64位Linux编译apache。 我得到了构build错误,如:
relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
要解决这个问题,OpenSSL必须有一个特殊的configuration选项:
./configure -fPIC
所以我重新编译了OpenSSL,它允许Apache正确地编译ssl模块。 然后,我在Apache make install期间又遇到了一个错误:
libtool: install: error: relink `libaprutil-1.la' with the above command before installing it
为了解决这个问题,APR类在编译时需要一个特殊的configuration选项:
CC="gcc -m64" ./configure --prefix=/usr/local/apr CC="gcc -m64" ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
分别编译这些意味着我需要在Apache构build中使用–with-apr选项而不是–with-included-apr:
./configure ... --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
在Apacheconfiguration期间,我也一直使用奇怪的configuration选项:
--with-apxs2=...
应该是:
--with-apxs=...
得到所有这些东西理顺和重新编译Apache,我再次尝试与tomcat连接器构build。 然后mod_jk.so文件正确生成。
系统信息
# uname -r 2.6.32-358.14.1.el6.x86_64 # cat /etc/redhat-release CentOS release 6.4 (Final) # rpm -qa | grep httpd httpd-devel-2.2.15-28.el6.centos.x86_64 httpd-2.2.15-28.el6.centos.x86_64 httpd-tools-2.2.15-28.el6.centos.x86_64
我会build议自己从源头上构build模块
# cd /root/ # wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz # tar -xzf tomcat-connectors-1.2.37-src.tar.gz # cd tomcat-connectors-1.2.37-src/native/ # ./configure --prefix=/opt/ --with-apxs=/usr/sbin/apxs # make # file apache-2.0/mod_jk.so apache-2.0/mod_jk.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped # cp apache-2.0/mod_jk.so /usr/lib64/httpd/modules/ # echo "LoadModule jk_module modules/mod_jk.so" > /etc/httpd/conf.d/mod_jk.conf # service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] # apachectl -t -D DUMP_MODULES | grep jk Syntax OK jk_module (shared)
所以不需要从源代码安装apache / openssl / apr / apr-util。 如果你想升级包 – 这将是地狱