From nobody@FreeBSD.org  Mon Aug 31 05:24:56 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4702610656A6
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 05:24:56 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 35E308FC1B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 05:24:56 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n7V5Othj021418
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 Aug 2009 05:24:56 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n7V5OtXN021395;
	Mon, 31 Aug 2009 05:24:55 GMT
	(envelope-from nobody)
Message-Id: <200908310524.n7V5OtXN021395@www.freebsd.org>
Date: Mon, 31 Aug 2009 05:24:55 GMT
From: James Chang <james.technew@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Makefile error of mod_jk-ap2-1.2.28,1
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         138370
>Category:       ports
>Synopsis:       www/mod_jk-apache2: Makefile error of mod_jk-ap2-1.2.28,1
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    girgen
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 31 05:30:04 UTC 2009
>Closed-Date:    Mon Feb 08 11:29:24 UTC 2010
>Last-Modified:  Sat May  8 00:10:03 UTC 2010
>Originator:     James Chang
>Release:        FreeBSD 7.2
>Organization:
>Environment:
FreeBSD FreeBSD.mytest.com 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 08:49:13 UTC 2009     root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
When build mod_jk-ap2-1.2.28,1 with apache 2.2.13 from FreeBSD port.
The following error message shows:

gmake[1]: *** [mod_jk.la] Error 1
gmake[1]: Leaving directory `/usr/ports/www/mod_jk/work/tomcat-connectors-1.2.28-src/native/apache-2.0'
gmake: *** [all-recursive] Error 1
*** Error code 1

Stop in /usr/ports/www/mod_jk.



>How-To-Repeat:
Just go to /usr/ports/www/mod_jk and run "make depend all"
>Fix:
modify "APXSLDFLAGS= -Wl,-L-L/usr/local/lib/mysql -Wl,-rpath=/usr/lib -Wl,/usr/local/lib -Wl,-L/usr/lib"

with 

"APXSLDFLAGS= -Wl,-L-L/usr/local/lib/mysql -Wl,-rpath=/usr/lib -Wl,-L/usr/local/lib -Wl,-L/usr/lib"



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->girgen 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Aug 31 10:26:47 UTC 2009 
Responsible-Changed-Why:  
Fix synopsis and assign. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=138370 

From: Bill Cole <bill@scconsult.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/138370: www/mod_jk-apache2: Makefile error of mod_jk-ap2-1.2.28,1
Date: Tue, 8 Sep 2009 02:52:09 -0400

 I had the same problem and I also solved it by manually correcting  
 these files:
 
 ./work/tomcat-connectors-1.2.28-src/native/apache-1.3/Makefile
 ./work/tomcat-connectors-1.2.28-src/native/apache-1.3/Makefile.apxs
 ./work/tomcat-connectors-1.2.28-src/native/common/Makefile
 ./work/tomcat-connectors-1.2.28-src/native/apache-2.0/Makefile
 ./work/tomcat-connectors-1.2.28-src/native/apache-2.0/Makefile.apxs
 ./work/tomcat-connectors-1.2.28-src/native/Makefile
 
 However, I think the original report is slightly wrong.  The critical  
 message from the 'make' failure is:
 
 libtool: link: cc -shared  .libs/mod_jk.o ../common/.libs/ 
 jk_ajp12_worker.o ../common/.libs/jk_connect.o ../common/.libs/ 
 jk_msg_buff.o ../common/.libs/jk_util.o ../common/.libs/jk_ajp13.o ../ 
 common/.libs/jk_pool.o ../common/.libs/jk_worker.o ../common/.libs/ 
 jk_ajp13_worker.o ../common/.libs/jk_lb_worker.o ../common/.libs/ 
 jk_sockbuf.o ../common/.libs/jk_map.o ../common/.libs/ 
 jk_uri_worker_map.o ../common/.libs/jk_ajp14.o ../common/.libs/ 
 jk_ajp14_worker.o ../common/.libs/jk_md5.o ../common/.libs/jk_shm.o ../ 
 common/.libs/jk_ajp_common.o ../common/.libs/jk_context.o ../ 
 common/.libs/jk_url.o ../common/.libs/jk_status.o    -Wl,-L-L/usr/ 
 local/lib/mysql -Wl,-rpath=/usr/lib -Wl,/usr/local/lib -Wl,-L/usr/ 
 lib   -Wl,-soname -Wl,mod_jk.so -o .libs/mod_jk.so
 /usr/local/lib: file not recognized: File format not recognized
 
 
 This leads to the correct conclusion of the original report that the  
 bad variable assignment is:
 
 APXSLDFLAGS= -Wl,-L-L/usr/local/lib/mysql -Wl,-rpath=/usr/lib -Wl,/usr/ 
 local/lib -Wl,-L/usr/lib
 
 The original report states that a fix can be had by replacing that with:
 
 APXSLDFLAGS= -Wl,-L-L/usr/local/lib/mysql -Wl,-rpath=/usr/lib -Wl,-L/ 
 usr/local/lib -Wl,-L/usr/lib
 
 However, while that fixes the build time fatal error by putting '-L'  
 where it was clearly missing, it fails to remove the errant '-L' from  
 where it seems to have landed instead, which for some reason isn't  
 fatal at build time. The better workaround is:
 
 APXSLDFLAGS= -Wl,-L/usr/local/lib/mysql -Wl,-rpath=/usr/lib -Wl,-L/usr/ 
 local/lib -Wl,-L/usr/lib
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: girgen 
State-Changed-When: Mon Feb 8 11:28:30 UTC 2010 
State-Changed-Why:  
Sorry for this late reply, but I cannot reproduce this error. 
Closing the report, please respond if you still experience 
this problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=138370 

From: Bill Cole <bill@scconsult.com>
To: bug-followup@FreeBSD.org, james.technew@gmail.com
Cc:  
Subject: Re: ports/138370: www/mod_jk-apache2: Makefile error of mod_jk-ap2-1.2.28,1
Date: Fri, 07 May 2010 20:08:08 -0400

 Another round of installs landed me on this problem again with a bit more 
 focus on its root cause. The prior "solution" worked because it repaired the 
 syntax error that APXSLDFLAGS was creating, not because it actually made 
 APXSLDFLAGS correct, and in a normal case the wrongness of that hack would 
 not make a difference.
 
 The root cause is a bug in Apache's 'apxs' utility that replaces colons with 
 spaces when it is queried for build variables. The details are at 
 <https://issues.apache.org/bugzilla/show_bug.cgi?id=45343> This affects 
 mod_jk because its configure script uses 'apxs -q LDFLAGS' which emits this 
 for an Apache built with MySQL and threads support:
 
 -L/usr/local/lib/mysql -pthread -rpath=/usr/lib /usr/local/lib -L/usr/lib
 
 That is bad syntax for LDFLAGS. Given those flags, ld will see 
 '/usr/local/lib' as an object file and choke on it, which matches the build 
 failure.
 
 Fixing apxs results in it giving a usable LDFLAGS:
 
 -L/usr/local/lib/mysql -pthread -rpath=/usr/lib:/usr/local/lib -L/usr/lib
 
 That results in the mod_jk configure script writing this to the Makefiles:
 
 APXSLDFLAGS= -Wl,-L-L/usr/local/lib/mysql -Wl,-rpath=/usr/lib:/usr/local/lib 
 -Wl,-L/usr/lib
 
 Which works, but it also leaves a puzzle: why is there an extra '-L' and why 
 is there no '-Wl,-pthread' there?
 
 The solution to that puzzle:
 
 # cat files/patch-tomcat-connectors-src:native:configure
 --- configure.ori  2009-01-08 09:42:19.000000000 -0800
 +++ configure      2009-01-08 10:06:18.000000000 -0800
 @@ -3066,7 +3066,7 @@
                   APXSCC="`$APXS -q CC`"
                   APXSCFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CFLAGS` 
 -DHAVE_APR ${APRINCLUDEDIR}"
                   APXSCPPFLAGS="`${APXS} -q EXTRA_CPPFLAGS`"
 -                APXSLDFLAGS="`$APXS -q LDFLAGS`"
 +                APXSLDFLAGS="`$APXS -q LDFLAGS|sed -e 
 's#/usr/local/lib#-L/usr/local/lib#' -e 's/-pthread//'`"
                   APACHE_CONFIG_VARS="`${APXS} -q 
 exp_installbuilddir`/config_vars.mk"
                   LIBTOOL=`$APXS -q LIBTOOL`
               fi
 
 Bottom line: that patch is junk. It papers over the breakage caused by the 
 apxs bug in the same wrong way that the initial submitter of this bug and I 
 did: by adding a '-L' where apxs has swapped a space for a colon. If that is 
 the first occurrence of '/usr/local/lib' in the apxs LDFLAGS, there's no 
 problem because normally the runtime linker is already configured to search 
 there without any rpath in the binary. As far as I can tell, this patch went 
 into the port without any explanation or review, so I can't say whether its 
 obliteration of '-pthread' is similarly careless but harmless or if it 
 actually could have bad effects. The port builds just fine on my system with 
 apxs fixed and the patch removed so that -pthread survives. I can't say 
 whether the resulting mod_jk functions properly, but I can't find any modern 
 reports of pthread-related problems predating that patch.
 
>Unformatted:
