Compiling mod_jk, mod_jk2 on Solaris

2002-08-30 Thread gabriele . garuglieri

For anyone who may be interested, i have managed to compile mod_jk and
mod_jk2
of jakarta-tomcat-connectors-4.1.9 for apache 2.0.39 under Solaris 2.8,
using
both configure and ant methods.
The tools used were:
 ant 1.5
 gcc 2.95.2
 libtool 1.4.2
 Autoconf 2.53
 automake 1.6
 JDK 1.4.0_01
If you download libtool package from one of the sunfreeware sites, i don't
know
in what environment it was built, but it produces wrong flags for ld and
the
link phase will fail. Libtool to produce reliable results is highly
sensitive to the environment so in any case i suggest to start with source
and
build it on your machine.
Here's what i did.
I'm assuming jakarta-tomcat-connectors-4.1.9-src/jk as base directory, so
any
reference will be relative to this.

** mod_jk, configure method **
This compiles right out of the box so within native dir i run
 buildconf.sh
then
 ./configure \
 --with-apxs=/usr/local/apache2/bin/apxs \
 --with-java-home=${JAVA_HOME} \
 --with-java-platform=2 \
 --enable-jni
then
 make
and that's it.

** mod_jk2, configure method **
Here things start to complicate.
native2/include/jk_global.h includes sys/ioctl.h that to expand correctly
in
solaris needs the BSD_COMP define to be set.
So as the easy option you can
 buildconf.sh
 ./configure \
  --with-apxs2=/usr/local/apache2/bin/apxs \
  --with-tomcat41=/usr/local/jakarta-tomcat-4.1.9 \
  --with-java-home=${JAVA_HOME} \
  --with-java-platform=2 \
  --with-jni

 make CPPFLAGS=-DBSD_COMP

Otherwise if you are really brave you can modify support/jk_apxs.m4
changing
the following two lines
 APXS$1_CFLAGS=`${APXS$1} -q CFLAGS` `${APXS$1} -q EXTRA_CFLAGS`
 APXS$1_CPPFLAGS=`${APXS$1} -q EXTRA_CPPFLAGS`
into
 APXS$1_CFLAGS=`${APXS$1} -q CFLAGS` `${APXS$1} -q EXTRA_CFLAGS`
${CFLAGS}
 APXS$1_CPPFLAGS=`${APXS$1} -q EXTRA_CPPFLAGS` ${CPPFLAGS}
This allow to pass additional CFLAGS and CPPFLAGS during the configure step
that will be merged with those produced by configure and apxs.
After this, again
 buildconf.sh
 ./configure \
  --with-apxs2=/usr/local/apache2/bin/apxs \
  --with-tomcat41=/usr/local/jakarta-tomcat-4.1.9 \
  --with-java-home=${JAVA_HOME} \
  --with-java-platform=2 \
  --with-jni \
  CPPFLAGS=-DBSD_COMP
 make
I know that for this the first line of jk_apxs.m4 is not really needed to
be
modified, but i have included it as a nice to have suggestion for the
developers.


*** mod_jk, ant method ***
WARNING: be aware that running ./configure into native or native2 dirs
rewrites
build.properties, so if you customize it remember to save it if you ever
think to use ./configure. (i learned it the hard way)

Here you need to customize build.properties as indicated in the README then
add
the following lines:

build.native.cc=gcc
the compiler defaults to cc so if you don't have installed Sun official
compiler or have an alias or link from cc to gcc you need the previous
line.

solaris=true
j2sdk1.4.0_01/include/jni.h includes the platform dependent jni_md.h that
for
solaris is in j2sdk1.4.0_01/include/solaris, so to allow the include to
succeed
you should modify native/build.xml adding  to the apache20 and jni
targets
where the comment says !-- Platform specific includes -- the following
line
include name=${java.home}/../include/solaris  if=solaris/

build.native.extra_cflags=-pthreads -DNO_DBM_REWRITEMAP -DSOLARIS2=8
-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DBSD_COMP
(this is broken in the mail but it must be a single line)
The values in this line are those used in my compilation but you should get
yours as the merge of the output of these commands
 apache2-dir/bin/apxs -q CFLAGS
 apache2-dir/bin/apxs -q EXTRA_CFLAGS
 apache2-dir/bin/apxs -q EXTRA_CPPFLAGS
plus the -DBSD_COMP define as previuosly explained.
(in the output of those commands you will possibly find -g and -O flags
if
they were set when apache was compiled. You should not use them since they
are controlled by so.debug and so.optimize properties)
This is needed because apacheConfig, that will extract those options from
apxs,
is not yet working and if you want to compile with the same options as the
configure method you need to extract them manually from apxs.

After this from jk dir just run

 ant native

*** mod_jk2, ant method ***
Running ant native actually builds both mod_jk and mod_jk2.
For jk2 there would be no need to add
solaris=true
line into build.properties nor to modify native2/build.xml because into it
already are steps necessary to guess os and set the necessary includes, but
since the native target is always executed before you need to add this
line.

Otherwise you can split the native target as follows

target name=all-native depends=native,native2 
target name=all-clean-native depends=clean-native,clean-native2 

target name=native depends=jkant,detect,report 
 ant  dir=native 

RE: Compiling mod_jk, mod_jk2 on Solaris

2002-08-30 Thread Ignacio J. Ortega



Saludos ,
Ignacio J. Ortega


 -Mensaje original-
 De: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]
 Enviado el: 30 de agosto de 2002 16:59
 Para: [EMAIL PROTECTED]
 Asunto: Compiling mod_jk, mod_jk2 on Solaris
 
 
 Sorry,
 the two lines
 target name=all-native depends=native,native2 
 target name=all-clean-native depends=clean-native,clean-native2 
 
 are missing the closing slash and should read
 
 target name=all-native depends=native,native2 /
 target name=all-clean-native 
 depends=clean-native,clean-native2 /
 
 I  apologize for that.
 Gabriele.
 
 [EMAIL PROTECTED]
 055-420 2832
 388-9473323
 
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]