Subject: | pthreads header problem and Inline::C |
Date: | Fri, 16 Aug 2013 13:58:57 -0700 |
To: | bug-perl-dist-strawberry [...] rt.cpan.org |
From: | David Jacobowitz <david.jacobowitz [...] gmail.com> |
I've been trying to build a project that uses Strawberry Perl, Inline::C
and pthreads and ran into some problems compiling on my system on Win32.
(It works fine in Ubuntu)
In particular, it looks like some header file somewhere (I have still to
determine which despite grepping through all the obvious places) does
something along the lines of:
#define PTHREAD_CREATE_JOINABLE 0
but in the pthreads.h in the distribution, there is an enum like this:
enum {
PTHREAD_CREATE_JOINABLE = 0,
...
}
Well, when the preprocessor runs it replaces the macro with 0, and you get
enum { 0 = 0, ... }
on which the compiler of course barfs.
I initially tried solving the problem by putting
undef PTHREAD_CREATE_JOINABLE before I include <pthread.h>. That fixed the
compilation but using threads resulted in segaults.
So now I have
#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
This makes the enum in pthread.h happy and anyone expecting the macro gets
the enum value, which is the same and is also happy.
So far all is working, but who know if this is a correct solution. I spent
a long time not able to figure out the source of these segfaults. Bug is
present in at least 5.16 and 5.18 that I tried.
perl --version:
This is perl 5, version 16, subversion 3 (v5.16.3) built for
MSWin32-x86-multi-thread
OS is Windows 7 32b. gnuwin32 "uname -a" reports:
windows32 DAVIDJ-LT0362 2.6.1 7601 i686-pc Intel unknown MinG
I have attached a working and non-working example perl scripts.
fail.plwill not compile.
work.pl will print messages until stopped.
Regards,
Dave Jacobowitz
PS
A few feature requests:
- package a gdb with SP
- offer an SP built with debugging enabled
- make it so gdb can debug the dlls created by the Inline modules. Adding
-g to Inline => Config => CCFLAGS doesn't do it.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.