2

When I try to compile the tomcat connector from source, everything appears fine except that no mod_jk.so file gets created.

Software versions: RHEL6 x86_64
httpd-2.4.3
tomcat-connector 1.2.37

Commands:
cd native
./configure --with-apxs=/usr/local/apache2/bin/apxs
make
cd apache-2.0
ls
The only warning message during the make is:
Warning! dlname not found in /usr/local/tomcat-connectors-1.2.37-src/native/apache-2.0/mod_jk.la.

Does anyone have any suggestions on how to get the mod_jk.so file to be generated?

user1171848
  • 21
  • 1
  • 4

2 Answers2

0

I eventually got this to work. It turns out that I had bigger problems than just the tomcat connector.

First, there are several things I needed to do to compile apache with 64 bit Linux. I was getting build errors such as:

relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC 

To fix that, OpenSSL had to have a special configure option:

./configure -fPIC

So I recompiled OpenSSL, which allowed Apache to compile the ssl module correctly. Then I got another error during the apache make install:

libtool: install: error: relink `libaprutil-1.la' with the above command before installing it

To fix this, the APR classes needed a special configuration option during their compilation:

CC="gcc -m64" ./configure --prefix=/usr/local/apr
CC="gcc -m64" ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

Compiling these separately meant that I needed to use the --with-apr option instead of --with-included-apr in the Apache build:

./configure ... --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

I also had been using a strange config option during the Apache configuration:

--with-apxs2=...

which should have been:

--with-apxs=...

After getting all of those things straightened out and recompiling apache, I tried again with the tomcat connector build. The mod_jk.so file then generated correctly.

user1171848
  • 21
  • 1
  • 4
  • It's a terrible solution. And why do you need to use apache-2.4.3? tomcat-connector 1.2.37 build without any problem with httpd-2.2.15. Or do you need some specific features from 2.4.x? – ALex_hha Aug 06 '13 at 19:39
  • My 'terrible' solution is what got mod_jk to compile. I posted it here in hopes that it might help someone having the same problems. The solution has nothing to do with Apache 2.4; I had the same problems with Apache 2.2. If you have a better solution, feel free to post it as an answer. – user1171848 Aug 07 '13 at 15:08
0

The system info

# 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

I will suggest to build from source only module himself

# 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)

So there is no need to install apache/openssl/apr/apr-util from source. If you want to upgrade the packages - it would be the hell

ALex_hha
  • 7,193
  • 1
  • 25
  • 40
  • I agree that if you can install Apache via RPM, then the process is a whole lot easier. We chose to install Apache from source for a few reasons: 1) we had done it that way in the past, 2) we had better control of included modules, and 3) we could get the latest version. We may reconsider our approach in the future. – user1171848 Aug 07 '13 at 19:25