perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <pgollu...@p6m7g8.com>
Subject THREADS
Date Wed, 14 Sep 2005 06:28:23 GMT
Hi, I'm stumped here, so here comes a lot of information and description:

I've got $20 bucks and a beer for anyone at ApacheCon2005 that can explain this one to me!

FreeBSD x86 5.4-RELEASE

perl 5.6.2 -V snippet
-Dprefix=/usr/home/pgollucci/dev/apps/perl-5.6.2
-Dusethreads=n -Dusemymalloc=y
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef

httpd 2.0.54 prefork mpm
APR is not theaded
configure snippet:
-D HTTPD_ROOT="/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork"

grep APR_HAS_THREADS /usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include/apr.h
#define APR_HAS_THREADS           0

I do not have any previous httpd or apr, or svn builds or apr-1-config in my path at all.

mp2:
APACHE_TEST_TRACE_LEVEL=debug /usr/home/pgollucci/dev/apps/perl-5.6.2/bin/perl Makefile.PL
\
  MP_APXS=/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/bin/apxs \
  MP_MAINTAINER=1 \
  MP_DEBUG=1 \
  MP_TRACE=1

make
[snipped]
cc -I/usr/home/pgollucci/dev/repos/asf/perl/modperl/trunk/src/modules/perl 
-I/usr/home/pgollucci/dev/repos/asf/perl/modperl/trunk/xs -I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include

-I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include -I/usr/local/include 
-I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include -pipe -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H
-DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -I/usr/home/pgollucci/dev/apps/perl-5.6.2/lib/CORE
-DMOD_PERL -Wall 
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror -DAP_DEBUG -DAP_HAVE_DESIGNATED_INITIALIZER

-Wdeclaration-after-statement -DMP_COMPAT_1X -DMP_DEBUG -DMP_TRACE -D_REENTRANT -D_THREAD_SAFE
-DAP_DEBUG -ggdb3 -O0 
-DPIC -fPIC  -c modperl_util.c && mv modperl_util.o modperl_util.lo
modperl_util.c: In function `modperl_perl_call_list':
modperl_util.c:474: warning: implicit declaration of function `apr_os_thread_current'
*** Error code 1


Okay, so we've seen this before lots of times.

I can change
/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include/apr.h
to the following:

#ifndef APR_H
#define APR_H

$error "Including the correct apr.h"

Okay, recompile
cc -I/usr/home/pgollucci/dev/repos/asf/perl/modperl/trunk/src/modules/perl 
-I/usr/home/pgollucci/dev/repos/asf/perl/modperl/trunk/xs -I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include

-I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include -I/usr/local/include 
-I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include -pipe -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H
-DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -I/usr/home/pgollucci/dev/apps/perl-5.6.2/lib/CORE
-DMOD_PERL -Wall 
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror -DAP_DEBUG -DAP_HAVE_DESIGNATED_INITIALIZER

-Wdeclaration-after-statement -DMP_COMPAT_1X -DMP_DEBUG -DMP_TRACE -D_REENTRANT -D_THREAD_SAFE
-DAP_DEBUG -ggdb3 -O0 
-DPIC -fPIC  -c modperl_util.c && mv modperl_util.o modperl_util.lo
In file included from /usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include/ap_config.h:20,
                  from /usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include/httpd.h:30,
                  from modperl_apache_includes.h:26,
                  from mod_perl.h:19,
                  from modperl_util.c:16:
/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include/apr.h:20:2: #error "Including the
correct apr.h"
modperl_util.c: In function `modperl_perl_call_list':
modperl_util.c:474: warning: implicit declaration of function `apr_os_thread_current'
*** Error code 1

Stop in /usr/home/pgollucci/dev/repos/asf/perl/modperl/trunk/src/modules/perl.

Didn't help

So not only is my not threaded, but my apr is not threaded and I'm getting this error.

So now, to investigate modperl_util.c:474

void modperl_perl_call_list(pTHX_ AV *subs, const char *name)
{
     I32 i, oldscope = PL_scopestack_ix;
     SV **ary = AvARRAY(subs);

     /* 474 */
     MP_TRACE_g(MP_FUNC, "pid %lu" MP_TRACEf_TID MP_TRACEf_PERLID
                " running %d %s subs",
                (unsigned long)getpid(), MP_TRACEv_TID_ MP_TRACEv_PERLID_
                AvFILLp(subs)+1, name);

Looking up MP_TRACE_g

from modperl_trace.h
MP_TRACE is defined as 1 from my Makefile.PL args

#ifdef MP_TRACE
#define MP_TRACE_g if (MP_debug_level & 32) modperl_trace

so line 474 is indeed compiled in good.

The macro in question here is MP_TRACEv_TID
from modperl_util.h

#if defined(MP_TRACE) && defined(APR_HAS_THREADS)
#define MP_TRACEf_TID   "/tid 0x%lx"
#define MP_TRACEv_TID   (unsigned long)apr_os_thread_current()
#define MP_TRACEv_TID_  MP_TRACEv_TID,
#define MP_TRACEv__TID  ,MP_TRACEv_TID
#else
#define MP_TRACEf_TID
#define MP_TRACEv_TID
#define MP_TRACEv_TID_
#define MP_TRACEv__TID
#endif /* APR_HAS_THREADS */

This code is correct as it stands. APR_HAS_THREADS should be 0
but yet I'm in the if not the else.

How ?

I can take this a step father and add to my gcc opts in the Makefile
-nostdinc -I-
before all the -I arguments.

 From my FreeBSD's gcc manpage
-nostdinc
               Do not search the standard system directories for header  files.
               Only  the  directories you have specified with `-I' options (and
               the current directory, if appropriate) are searched.

               By using both `-nostdinc' and `-I-', you can limit the  include-
               file search file to only those directories you specify explicit-
               ly.

So now, I can gaurantee without exception that _only_ the -I directories listed above are
searched; thus limiting my 
chances for mishap father, but to no avail!

I will go one father then even that
su -
grep -R "defined APR_HAS_THREADS" /*
[yes, a system-wide grep ... yes it took a while]
#define APR_HAS_THREADS           0

find / -type f apxs
[not thats a find and not a locate so its real-time]
/usr/home/pgollucci/dev/apps/httpd-2.0.54/bin/apxs

and thats it folks.... so its not finding the wrong axs

So even if the wrong header got pulled in somewhow, nothing else even defines this constant!


Either assume of go on my above info, that I've proven I have absolutely no other perl, httpd.
apr, mod_perl, svn 
installations on this system at all.  Nor have I EVER.

Here is my complete install line for line:

cd ~
mkdir dev
cd dev
mkdir src dist apps dists repos
cd dists
fetch -mva http://www.cpan.org/src/5.0/perl-5.6.2.tar.gz
cd ../src
tar -xvzof ../dist/perl-5.6.2.tar.gz
cd perl-5.6.2
./Configure -sde \
   -Dprefix=/usr/home/pgollucci/dev/apps/perl-5.6.2 \
   -Darchlib=/usr/home/pgollucci/dev/apps/perl-5.6.2/lib \
   -Dsitearch=/usr/home/pgollucci/dev/apps/perl-5.6.2/lib \
   -Dsitelib=/usr/home/pgollucci/dev/apps/perl-5.6.2/lib \
   -Dprivlib=/usr/home/pgollucci/dev/apps/perl-5.6.2/lib \
   -Dman3dir=/usr/home/pgollucci/dev/apps/perl-5.6.2/man/man3 \
   -Dman1dir=/usr/home/pgollucci/dev/apps/perl-5.6.2/man/man1 \
   -Dsiteman3dir=/usr/home/pgollucci/dev/apps/perl-5.6.2/man/man3 \
   -Dsiteman1dir=/usr/home/pgollucci/dev/apps/perl-5.6.2/man/man1 \
   -Dscriptdir=/usr/home/pgollucci/dev/apps/perl-5.6.2/bin \
   -Uinstallusrbinperl \
   -Dcc=cc \
   -Doptimize="-ggdb3 -O0" \
   -Duseshrplib \
   -Dusedevel \
   -Dusethreads=n \
   -Dusemymalloc=y \
   -Duse64bitint \
   -Dccflags=-pipe \
   -Ud_dosuid \
   -Ui_gdbm \
   -Ui_malloc \
   -Ui_iconv \
   -Ubincompat5005
make install

cd ../dist
fetch -mva http://archive.apache.org/dist/httpd/httpd-2.0.54.tar.bz2
cd ../src
tarx ../dist/httpd-2.0.54
cd httpd-2.0.54
CFLAGS="-DAP_UNSAFE_ERROR_LOG_UNESCAPED -ggdb3 -O0"  \
  ./configure --prefix=/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork \
  --with-perl=/usr/home/pgollucci/dev/apps/perl-5.6.2/bin/perl \
  --enable-v4-mapped \
  --with-dbm=sdbm \
  --with-ssl=/usr \
  --enable-ssl \
  --enable-so \
  --with-port=8000 \
  --with-mpm=prefork \
  --with-expat=/usr/local \
  --enable-maintainer-mode \
  --enable-debug \
  --enable-mods-shared=all \
  --enable-modules=all \
  --enable-deflate=shared \
  --enable-proxy=shared \
  --disable-log-forensic
make
make install

cd ../dist
mkdir -p repos/asf/perl/modperl
cd repos/asf/perl/modperl

[just to be sure, I've svn checkouted mod_perl2 repo on another computer and tarred it with
no changes at all (hence the 
scp command);Thus, maintaining my point, I do _not_ and will _not_ have any httpd, perl, apr,
or svn installs on this 
system other then the being talked about]

cd ../dist
scp host:mp2-svn.tar.gz .
cd ../src
tar -xvzof mp2-svn.tar.gz
rm -rf mp2-svn.tar.gz
cd trunk

APACHE_TEST_TRACE_LEVEL=debug /usr/home/pgollucci/dev/apps/perl-5.6.2/bin/perl Makefile.PL
\
  MP_APXS=/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/bin/apxs \
  MP_MAINTAINER=1 \
  MP_DEBUG=1 \
  MP_TRACE=1

make
[snipped]
cc -I/usr/home/pgollucci/dev/repos/asf/perl/modperl/trunk/src/modules/perl 
-I/usr/home/pgollucci/dev/repos/asf/perl/modperl/trunk/xs -I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include

-I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include -I/usr/local/include 
-I/usr/home/pgollucci/dev/apps/httpd-2.0.54/prefork/include -pipe -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H
-DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -I/usr/home/pgollucci/dev/apps/perl-5.6.2/lib/CORE
-DMOD_PERL -Wall 
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror -DAP_DEBUG -DAP_HAVE_DESIGNATED_INITIALIZER

-Wdeclaration-after-statement -DMP_COMPAT_1X -DMP_DEBUG -DMP_TRACE -D_REENTRANT -D_THREAD_SAFE
-DAP_DEBUG -ggdb3 -O0 
-DPIC -fPIC  -c modperl_util.c && mv modperl_util.o modperl_util.lo
modperl_util.c: In function `modperl_perl_call_list':
modperl_util.c:474: warning: implicit declaration of function `apr_os_thread_current'
*** Error code 1

This is really starting to tick me off.

-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message