Bug 33843

Summary: native jk connector ignores LDFLAGS when compiling
Product: Tomcat Connectors Reporter: Beat Kneubuehl <beat.kneubuehl>
Component: CommonAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: Sun   
OS: Solaris   

Description Beat Kneubuehl 2005-03-04 14:16:25 UTC
The jk/native/apache-2.0/Makefile from the jakarta-tomcat-connectors-1.2.8
package does ignore the LDFLAGS from the configure script and from the apache apxs.

We need to pass some special linker flags, when we build httpd and the
jakarta-tomcat-connectors (-L/opt/sfw/lib -XCClinker -static-libgcc).
When we build the native Apache2 jk connector from the jakarta-tomcat-connectors
packge, there is no way to pass theese flags to the linker.
When we pass these options as LDFLAGS to the configure script from the
jakarta-tomcat-connectors, the flags are silently ignored, because the mod_jk.lo
file is linked with the following command (where LDFLAGS is not taken into account):
-----------------
$(LIBTOOL) --mode=link ${COMPILE} -o $@ -module -rpath ${libexecdir}
-avoid-version mod_jk.lo $(APACHE_OBJECTS)
-----------------
We have used theese LDFLAGS also when compiling the httpd, thus apxs is aware of
the LDFLAGS:
---------------
/usr/local/apache_2.0.53/bin/apxs  -q LDFLAGS
-L/opt/sfw/lib -XCClinker -static-libgcc
---------------
But also the apxs flags are ignored.

In the main Makefile, the following libtool is defined:
LIBTOOL = /bin/bash /usr/local/apache_2.0.53/build/libtool --silent

I have attached a small Patch for the Makefile.in which the LDFLAGS are
requested through the apxs interface.
I have added a `${APXS} -q LDFLAGS` statement to the line which is linking the
mod_jk.lo file.

I'm not sure if this is the right way to fix the problem, or the httpd libtool
which is called by the makefile should be fixed.

We are using the following environment:
- Solaris 9
- gcc-3.3.2
- httpd-2.0.53
- jakarta-tomcat-connectors-1.2.8

Patch:
--- jk/native/apache-2.0/Makefile.in    Fri Mar  4 12:16:40 2005
+++ jk/native/apache-2.0/Makefile.in.fix        Fri Mar  4 12:27:17 2005
@@ -63,7 +63,7 @@
 # APXS will compile every file, this is derived from apxs
 
 mod_jk.la: mod_jk.lo $(APACHE_OBJECTS)
-       $(LIBTOOL) --mode=link ${COMPILE} -o $@ -module -rpath ${libexecdir}
-avoid-version mod_jk.lo $(APACHE_OBJECTS)
+       $(LIBTOOL) --mode=link ${COMPILE} `${APXS} -q LDFLAGS` -o $@ -module
-rpath ${libexecdir} -avoid-version mod_jk.lo $(APACHE_OBJECTS)
 
 mod_jk.so: mod_jk.la
        $(LIBTOOL) --mode=install cp $< `pwd`/$@
Comment 1 Mladen Turk 2005-03-07 19:39:11 UTC
Fixed in the CVS.
Thanks.