Double definition of identifiers

Since the MinGW that comes with Perl 5.16.1 cpan installation is officially weird, I upgraded the Perl installation to use MinGW 4.6.2.

But this comes with it's own problem, today, I tried to install DB_File and I encounter this error during make process:
> dmake
C:\CPANTE~1\PERL51~1.1\site\lib\auto\MINGW-~1.2\bin\gcc.exe -c  -IC:\CPANTesters\archives\db-4.8.30-mingw32\include\db  -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT-DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields -O2           -DVERSION=\"1.827\"   -DXS_VERSION=\"1.827\"  "-IC:\CPANTesters\Perl5.16.1\lib\CORE"  -D_NOT_CORE  -DmDB_Prefix_t=size_t -DmDB_Hash_t=u_int32_t version.c
In file included from C:\CPANTesters\archives\db-4.8.30-mingw32\include\db/db.h:30:0,
                 from version.c:30:
c:\cpante~1\perl51~1.1\site\lib\auto\mingw-~1.2\bin\../lib/gcc/mingw32/4.6.2/../../../../include/pthread.h:612:3: error: expected identifier before numeric constant
dmake.exe:  Error code 129, while making 'version.o'
This is the offending code on MinGW-4.6.2/include/pthread.h.
enum {
	PTHREAD_CREATE_JOINABLE       = 0,
	...
};
After a long winded troubleshooting session & research, I found that PTHREAD_CREATE_JOINABLE has already defined in Perl\lib\CORE\thread.h. Disabling the offending line in MinGW-4.6.2/include/pthread.h fixes the problem.

But I encounter a new dilemma, for future usage, should I disable PTHREAD_CREATE_JOINABLE definition at MinGW-4.6.2/include/pthread.h or Perl\lib\CORE\thread.h?

I am really tempted to edit Perl\lib\CORE\thread.h instead of MinGW 4.6.2 since I use MinGW to make other binaries.

Any suggestion?

Touching Perl\lib\CORE\thread.h will bork the test, need to edit MinGW-4.6.2/include/pthread.h instead before testing.

Leave a comment

About Leo Susanto

user-pic I blog about Perl.