Unable to compile Encode::Detect::Detector

From CPanelDirect
Jump to: navigation, search

Your error may look something along these lines:

Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/5.8.8/ExtUtils/ParseXS.pm 
line 508, <GEN36> line 65.
cc -Isrc -I/usr/lib/perl5/5.8.8/i686-linux/CORE -DXS_VERSION="1.00" -DVERSION="1.00" -fpic -x c++ 
-Iinclude -c -fno-strict-aliasing -pipe -Wdeclaration-after
-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm -O2 -o lib/Encode/Detect/Detector.o lib/Encode/Detect/Detector
.c
lib/Encode/Detect/Detector.c:73: syntax error before `__attribute__'
lib/Encode/Detect/Detector.c: In function `void
   XS_Encode__Detect__Detector_new(...)':
lib/Encode/Detect/Detector.c:74: syntax error before `__attribute__'
lib/Encode/Detect/Detector.c: In function `void
   XS_Encode__Detect__Detector_new(...)':
lib/Encode/Detect/Detector.c:74: redefinition of `void
   XS_Encode__Detect__Detector_new(...)'
lib/Encode/Detect/Detector.c:73: `void XS_Encode__Detect__Detector_new(...)'
   previously defined here
lib/Encode/Detect/Detector.c:74: redefinition of `void
   XS_Encode__Detect__Detector_new(...)'
lib/Encode/Detect/Detector.c:73: `void XS_Encode__Detect__Detector_new(...)'
   previously defined here
lib/Encode/Detect/Detector.c:79: `sp' undeclared (first use this function)
lib/Encode/Detect/Detector.c:79: (Each undeclared identifier is reported only
   once for each function it appears in.)

To fix download this from CPAN. As of this writing the latest version is at http://search.cpan.org/CPAN/authors/id/J/JG/JGMYERS/Encode-Detect-1.00.tar.gz

Untar with tar -zxvf Encode-Detect-1.00.tar.gz

Move to the Encode-Detect-1.00 directory with cd Encode-Detect-1.00

--- Detector.xs 2006-10-27 16:48:59.000000000 -0400
+++ Detector.xs.old     2008-04-29 15:59:43.000000000 -0400
@@ -38,6 +38,7 @@
 #define PERL_NO_GET_CONTEXT     /* we want efficiency */
 #include "EXTERN.h"
 #include "perl.h"
+#undef HASATTRIBUTE_UNUSED
 #include "XSUB.h"
 }

Apply this patch with patch -p0 <filename

Run perl Makefile.PL && make && make install

The module is installed successfully now.

Notes

http://solutions.szylko.com/tag/encode-detect/