Skip Menu |

This queue is for tickets about the Proc-ProcessTable CPAN distribution.

Report information
The Basics
Id: 41397
Status: resolved
Priority: 0/
Queue: Proc-ProcessTable

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
bennymack [...] gmail.com
bobtfish [...] bobtfish.net
htoug [...] cpan.org
MSCHILLI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.45
Fixed in: (no value)



Subject: Cannot test on non-threaded linux perls.
Running the test for Proc::ProcessTable 0.45 gives the error: [root@clover Proc-ProcessTable-0.45]# perl -Mblib t/process.t 1..3 # Running under perl version 5.008007 for linux # Current time local: Wed Dec 3 10:16:47 2008 # Current time GMT: Wed Dec 3 09:16:47 2008 # Using Test.pm version 1.25 perl: relocation error: /root/.cpan/build/Proc-ProcessTable-0.45/blib/arch/auto/Proc/ProcessTable/ProcessTable.so: undefined symbol: pthread_once when using a non-threaded perl on linux. This seems to be the cause of many (most?) of the fail reports for linux-perls. Version 0.44 does not have this problem.
Please find a patch for this issue against 0.45 attached.
diff -ur Proc-ProcessTable-0.45/os/Linux.c Proc-ProcessTable-0.45.t0m/os/Linux.c --- Proc-ProcessTable-0.45/os/Linux.c 2008-09-08 16:10:41.000000000 +0100 +++ Proc-ProcessTable-0.45.t0m/os/Linux.c 2009-01-07 10:10:36.000000000 +0000 @@ -12,8 +12,10 @@ #include <sys/vfs.h> /* statfs */ /* glibc only goodness */ #include <obstack.h> /* glibc's handy obstacks */ +#ifdef PROCESSTABLE_THREAD /* ptheads */ #include <pthread.h> /* pthead_once */ +#endif #define obstack_chunk_alloc malloc #define obstack_chunk_free free @@ -23,8 +25,12 @@ /* NOTE: Before this was actually milliseconds even though it said microseconds, now it is correct. */ #define JIFFIES_TO_MICROSECONDS(x) (((x)*1e6)/system_hertz) +#ifdef PROCESSTABLE_THREAD /* some static values that won't change, */ static pthread_once_t globals_init = PTHREAD_ONCE_INIT; +#else +static bool globals_init = false; +#endif static long long boot_time; static unsigned page_size; @@ -155,8 +161,14 @@ if(statfs("/proc", &sfs) == -1) return (char *) get_string(STR_ERR_PROC_STATFS); - /* one time initlization of some values that won't change */ - pthread_once(&globals_init, init_static_vars); + +#ifdef PROCESSTABLE_THREAD + /* one time initlization of some values that won't change */ + pthread_once(&globals_init, init_static_vars); +#else + init_static_vars(); + globals_init = true; +#endif return NULL; }
From: jjn1056 [...] yahoo.com
By the way, this patch also fixed it for me on my 5.10.0 custom compiled Perl, running on RedHat EL5. I custom compiled non threaded Perl. Any chance of this patch making it's way into a release? On Wed Jan 07 05:12:55 2009, BOBTFISH wrote: Show quoted text
> Please find a patch for this issue against 0.45 attached.
I reviewed the patch - but to be true: it looks to me like it turns the threading support introduced with 0.44 back. Where is PROCESSTABLE_THREAD defined, if thread support is required.
Still very important! Cant build on non-threaded-perl!
Subject: Proc::ProcessTable - make test fails "undefined symbol: pthread_once"
Date: Fri, 1 May 2009 14:01:33 -0400
To: bug-Proc-ProcessTable [...] rt.cpan.org
From: "Ben. B." <bennymack [...] gmail.com>
I checked the CPANTS matrix and this same issue is occuring for other people. I fixed by changing: 'LIBS' => [''], # e.g., '-lm' to 'LIBS' => ['lpthread'], # e.g., '-lm' In Makefile.PL. I'm not sure what the proper fix would be with your current setup however. [benb@kandev Proc-ProcessTable-0.45-3eFWtx]$ make test make[1]: Entering directory `/home/benb/.cpan/build/Proc-ProcessTable-0.45-3eFWtx/Process' make[1]: Leaving directory `/home/benb/.cpan/build/Proc-ProcessTable-0.45-3eFWtx/Process' PERL_DL_NONLAZY=1 /home/benb/documents/perl/perl5100/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/process....Can't load '/home/benb/.cpan/build/Proc-ProcessTable-0.45-3eFWtx/blib/arch/auto/Proc/ProcessTable/ProcessTable.so' for module Proc::ProcessTable: /home/benb/.cpan/build/Proc-ProcessTable-0.45-3eFWtx/blib/arch/auto/Proc/ProcessTable/ProcessTable.so: undefined symbol: pthread_once at /home/benb/documents/perl/perl5100/lib/5.10.0/i686-linux/DynaLoader.pm line 203. at t/process.t line 9 Compilation failed in require at t/process.t line 9. BEGIN failed--compilation aborted at t/process.t line 9. t/process....dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 1-3 Failed 3/3 tests, 0.00% okay Failed Test Stat Wstat Total Fail List of Failed ------------------------------------------------------------------------------- t/process.t 2 512 3 6 1-3 Failed 1/1 test scripts. 3/3 subtests failed. Files=1, Tests=3, 0 wallclock secs ( 0.05 cusr + 0.01 csys = 0.06 CPU) Failed 1/1 test programs. 3/3 subtests failed. make: *** [test_dynamic] Error 2
This appears to be a duplicate of 41397.
In the README.solaris file: One can enable thread support by adding -DPROCESSTABLE_THREAD to the DEFINE line in Makefile.PL. It seems the expected behavior is to explicity set the PROCESSTABLE_THREAD flag if you want thread support. Please apply the aforementioned patch so that non-threaded perl users can use this module.
Subject: Fails on non-threaded perls on Linux (patch provided)
If a perl on Linux is compiled without threads, using Proc::ProcessTable fails with the following error message: /usr/local/bin/perl: symbol lookup error:/home/y/lib/perl5/site_perl/5.10/i686-lc essTable.so: undefined symbol: pthread_once The problem is that -lpthreads isn't available in perl itself, but it's available on the system and it's used in Proc::ProcessTable. The attached patch provides a remedy by checking if perl was compiled with threading enabled, and if not, adds -lpthreads to the link options. Would be great if you could add it in the next revision, thanks! -- Mike
Subject: patch.txt
diff hints/linux.pl hints/linux.pl --- hints/linux.pl +++ hints/linux.pl @@ -1 +1,12 @@ symlink "os/Linux.c", "OS.c" || die "Could not link os/Linux.c to os/OS.c\n"; + + + # We might have a non-threading perl, which doesn't add this + # necessary link option. +use Config; +my $thread_lib = "-lpthread"; + +if( $Config{libs} !~ /$thread_lib/ ) { + $self->{LIBS} ||= []; + push @{ $self->{LIBS} }, $thread_lib; +}
Subject: Fails on linux without threads
As per subject. On my smoker where I run many more tests than appear in http://matrix.cpantesters.org/?dist=Proc-ProcessTable-0.46 I can observe that all tests pass on threaded perls while unthreaded perls always produce a fail. Sample fail report: http://www.cpantesters.org/cpan/report/98e26ba2-1a19-11e2-bfbb-58d9a1ecbf29 There is a pthread_once dependency somewhere HTH&&Thanks,
Subject: Re: [rt.cpan.org #80436] Fails on linux without threads
Date: Sat, 27 Oct 2012 08:10:55 +0100
To: bug-Proc-ProcessTable [...] rt.cpan.org
From: Jens Rehsack <rehsack [...] gmail.com>
2012/10/27 Andreas Koenig via RT <bug-Proc-ProcessTable@rt.cpan.org>: Show quoted text
> Fri Oct 26 23:15:04 2012: Request 80436 was acted upon. > Transaction: Ticket created by ANDK > Queue: Proc-ProcessTable > Subject: Fails on linux without threads > Broken in: 0.46 > Severity: Normal > Owner: Nobody > Requestors: ANDK@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=80436 > > > > As per subject. > > On my smoker where I run many more tests than appear in > http://matrix.cpantesters.org/?dist=Proc-ProcessTable-0.46 I can observe > that all tests pass on threaded perls while unthreaded perls always > produce a fail. > > Sample fail report: > > http://www.cpantesters.org/cpan/report/98e26ba2-1a19-11e2-bfbb-58d9a1ecbf29 > > There is a pthread_once dependency somewhere > > HTH&&Thanks,
The P::PT code is grown - and I want to rewrite it instead of fixing symptoms. The final prerequisite I'm missing is a nice ExtUtils::CBuilder successor. As far as I know, Leon Timmermann working on such a thing, but I'm unsure if it fits my needs. Anyway - I hope I can find a tuit soon ... /Jens
This issue is still open. It can be fixed by applying this patch (not mine, it's originally by MSCHILLI) (it applies also to 0.46, not only to 0.45): http://www.cpan.org/authors/id/SREZIC/patches/Proc-ProcessTable-0.45-MSCHILLI-02.patch Regards, Slaven