From lev@ftp.translate.ru  Fri Nov  5 15:42:44 2004
Return-Path: <lev@ftp.translate.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 6AD6B16A4CF; Fri,  5 Nov 2004 15:42:44 +0000 (GMT)
Received: from ftp.translate.ru (ftp.translate.ru [195.131.4.140])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 9B6CA43D53; Fri,  5 Nov 2004 15:42:43 +0000 (GMT)
	(envelope-from lev@ftp.translate.ru)
Received: from ftp.translate.ru (localhost [127.0.0.1])
	by ftp.translate.ru (8.12.11/8.12.11) with ESMTP id iA5Fgemq045517;
	Fri, 5 Nov 2004 18:42:40 +0300 (MSK)
	(envelope-from lev@ftp.translate.ru)
Received: (from lev@localhost)
	by ftp.translate.ru (8.12.11/8.12.11/Submit) id iA5Fge33045516;
	Fri, 5 Nov 2004 18:42:40 +0300 (MSK)
	(envelope-from lev)
Message-Id: <200411051542.iA5Fge33045516@ftp.translate.ru>
Date: Fri, 5 Nov 2004 18:42:40 +0300 (MSK)
From: "Lev A. Serebryakov" <lev@freebsd.org>
Reply-To: "Lev A. Serebryakov" <lev@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: rodrigc@crodrigues.org, kuriyama@freebsd.org
Subject: `devel/apr' doesn't use pthreads on 4-STABLE system, even if asked.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         73567
>Category:       ports
>Synopsis:       `devel/apr' doesn't use pthreads on 4-STABLE system, even if asked.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 05 15:50:35 GMT 2004
>Closed-Date:    Sat Nov 06 18:21:17 GMT 2004
>Last-Modified:  Sat Nov 06 18:21:17 GMT 2004
>Originator:     Lev A. Serebryakov <lev@FreeBSD.org>
>Release:        FreeBSD 4.10-RELEASE i386
>Organization:
>Environment:
System: FreeBSD freebsd4-vmware 4.10-RELEASE FreeBSD 4.10-RELEASE #4: Sat Jul 24 18:41:28 MSD 2004 root@:/usr/src/sys/compile/VMWARE i386
Ports: 04 Nov 2004.

>Description:

  `devel/apr', builded with default options (i.e. `APR_UTIL_WITHOUT_THREADS' is _not_ set) on 4-STABLE system.
  Resulting libraries doesn't uses threads.
  Here are ouptut from `apr-1-config --cflags --cppflags --ldflags --libs':
  
 -g -O2 -D_THREAD_SAFE -D_REENTRANT  -lcrypt   
 
  Here are ouput from `configure' stage of `devel/apr' building:

========================================================== 
...
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
Applying APR hints file rules for i386-portbld-freebsd4.10
  setting apr_lock_method to "USE_FLOCK_SERIALIZE"
  setting CPPFLAGS to "-D_THREAD_SAFE -D_REENTRANT"
  setting enable_threads to "no"
(Default will be unix)
checking whether make sets $(MAKE)... yes
checking how to run the C preprocessor... gcc -E
checking for gawk... no
...
========================================================== 

  But `devel/subversion' needs apr with threads support, if Java bindings are enabled.
  And now it complains:
  
========================================================== 
/usr/local/bin/libtool15 --silent --mode=compile c++ -D_THREAD_SAFE -D_REENTRANT  -O -pipe   -g -O2  -DNEON_ZLIB -DNEON_SSL   -O -pipe   -g -O2  -DNEON_ZLIB -DNEON_SSL  -I./subversion/include -I./subversion -I/usr/local/include/neon                       -I/usr/local/include/apr-1   -I/usr/local/include/apr-1 -I/usr/local/include -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/freebsd -I/scratch/usr/home/lev/FreeBSD-commiter/ports/devel/subversion/work/subversion-1.1.1/subversion/bindings/java/javahl/include -o subversion/bindings/java/javahl/native/JNICriticalSection.lo -c /scratch/usr/home/lev/FreeBSD-commiter/ports/devel/subversion/work/subversion-1.1.1/subversion/bindings/java/javahl/native/JNICriticalSection.cpp
/scratch/usr/home/lev/FreeBSD-commiter/ports/devel/subversion/work/subversion-1.1.1/subversion/bindings/java/javahl/native/JNICriticalSection.cpp: In method `JNICriticalSection::JNICriticalSection(JNIMutex &)':
/scratch/usr/home/lev/FreeBSD-commiter/ports/devel/subversion/work/subversion-1.1.1/subversion/bindings/java/javahl/native/JNICriticalSection.cpp:36: implicit declaration of function `int apr_thread_mutex_lock(...)'
/scratch/usr/home/lev/FreeBSD-commiter/ports/devel/subversion/work/subversion-1.1.1/subversion/bindings/java/javahl/native/JNICriticalSection.cpp: In method `JNICriticalSection::~JNICriticalSection()':
/scratch/usr/home/lev/FreeBSD-commiter/ports/devel/subversion/work/subversion-1.1.1/subversion/bindings/java/javahl/native/JNICriticalSection.cpp:50: implicit declaration of function `int apr_thread_mutex_unlock(...)'
*** Error code 1

Stop in /scratch/usr/home/lev/FreeBSD-commiter/ports/devel/subversion/work/subversion-1.1.1.
*** Error code 1

Stop in /usr/home/lev/FreeBSD-commiter/ports/devel/subversion.
========================================================== 

>How-To-Repeat:

  Build `devel/apr' with default settings and try to use any threading API from it.

>Fix:

  I don't know. Adding `--enable-threads' to CONFIGURE_ARGS doesn't help, because then
  both `-pthreads' and `-lc_r' will be used, that is surely mistake.
>Release-Note:
>Audit-Trail:

Adding to audit trail from misfiled PRs 73571 through 73574:

Date: Fri, 5 Nov 2004 11:18:17 -0500
From: Craig Rodrigues <rodrigc@crodrigues.org>
 
 > But `devel/subversion' needs apr with threads support, if Java bindings
 > are enabled.
 
 Well this is a problem.  APR with threads on 4.x is broken,
 because threads on 4.x is broken.  The APR maintainers got sick
 of all this and unconditionally disabled threads in APR in FreeBSD 4.x.
 
 This configuration you are describing: devel/subversion + apr/threads + Java
 bindings, should not be supported, because it is a recipe for disaster. 
 
 > I don't know. Adding `--enable-threads' to CONFIGURE_ARGS doesn't help,
 > because then both `-pthreads' and `-lc_r' will be used, that is surely
 > mistake.
 
 Don't do it!
 
 -- 
 Craig Rodrigues        

Date: Fri, 5 Nov 2004 19:28:05 +0300
From: Lev Serebryakov <lev@FreeBSD.org>
 
 CR> Well this is a problem.  APR with threads on 4.x is broken,
 CR> because threads on 4.x is broken.

   Threads on 4-STABLE are not too effective and scalable, yes. But broken?
   Could you send some links about this? If they are broken, then default
   Linux threads are mega-broken stuff! And they are supported with apr!
 
 CR> The APR maintainers got sick
 CR> of all this and unconditionally disabled threads in APR in FreeBSD 4.x.
 CR> This configuration you are describing: devel/subversion + apr/threads +
 CR> Java bindings, should not be supported, because it is a recipe for
 CR> disaster. 

   We could add warning :) But, of course, I will not enable this till apr
   will be support threads on 4-stable. I'll enable these bindings for
   5-CURRENT (in next commit) with proper condition for OSVERSION, of course.
 
 >> I don't know. Adding `--enable-threads' to CONFIGURE_ARGS doesn't 
 >> help, because then  both `-pthreads' and `-lc_r' will be used, that
 >> is surely mistake.

 CR> Don't do it!

   Of course, I'll not! :)
 
 -- 
 Best regards,
  Lev                            mailto:lev@FreeBSD.org

Date: Fri, 5 Nov 2004 19:39:21 +0300
From: Lev Serebryakov <lev@FreeBSD.org>
 
 CR> This configuration you are describing: devel/subversion + apr/threads +
 CR> Java bindings, should not be supported, because it is a recipe for
 CR> disaster. 

  BTW, native jdk-1.4.2 itself works well for me on 4.10-RELEASE...

Date: Fri, 5 Nov 2004 11:54:05 -0500
From: Craig Rodrigues <rodrigc@crodrigues.org>

 >   Threads on 4-STABLE are not too effective and scalable, yes. But broken? 
 
 Yes, broken.
 
 > Could you send some links about this?
 
 http://marc.theaimsgroup.com/?l=apr-dev&m=108887663616352&w=2
 
 -- 
 Craig Rodrigues        
State-Changed-From-To: open->closed 
State-Changed-By: lev 
State-Changed-When: Sat Nov 6 18:20:33 GMT 2004 
State-Changed-Why:  

I see, that it is problem in threading of FreeBSD 4-STABLE, not in apr itself :( 


http://www.freebsd.org/cgi/query-pr.cgi?pr=73567 
>Unformatted:
