Tags:
create new tag
, view all tags

NativeSearchContribDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on NativeSearchContrib contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please file bug reports in the NativeSearchContrib bug database.

Feedback on NativeSearchContrib

See also NativeSearch

-- CrawfordCurrie - 27 Sep 2007

I can't get this to build on Windows with ActivePerl and VC++ 6.0.

C:\twiki\tools\native_search>perl Makefile.PL Writing Makefile for NativeTWikiSearch

C:\twiki\tools\native_search>nmake

Microsoft (R) Program Maintenance Utility Version 6.00.9782.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

cl -c -g -MD -Zi -DNDEBUG -O1 -DVERSION=\"\" -DXS_VERSION=\"\" " -IC:\Perl\lib\CORE" NativeTWikiSearch.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86 Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

Command line warning D4002 : ignoring unknown option '-g' NativeTWikiSearch.c C:\Perl\lib\CORE\win32.h(314) : error C2143: syntax error : missing ')' before ' *' C:\Perl\lib\CORE\win32.h(314) : error C2081: 'Stat_t' : name in formal parameter list illegal C:\Perl\lib\CORE\win32.h(314) : error C2143: syntax error : missing '{' before ' *' C:\Perl\lib\CORE\win32.h(314) : error C2059: syntax error : ')' C:\Perl\lib\CORE\win32.h(413) : error C2143: syntax error : missing ')' before ' *' C:\Perl\lib\CORE\win32.h(413) : error C2143: syntax error : missing '{' before ' *' C:\Perl\lib\CORE\win32.h(413) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(105) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(105) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(105) : error C2371: 'PerlIO_funcs' : redefinition; dif ferent basic types C:\Perl\lib\CORE\perlio.h(100) : see declaration of 'PerlIO_funcs' C:\Perl\lib\CORE\perlio.h(105) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(105) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(105) : error C2059: syntax error : ';' C:\Perl\lib\CORE\perlio.h(106) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(106) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(106) : error C2059: syntax error : 'type' C:\Perl\lib\CORE\perlio.h(107) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(108) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(108) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(108) : error C2040: 'PerlIO' : 'int ' differs in level s of indirection from 'struct _PerlIO *' C:\Perl\lib\CORE\perlio.h(108) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(108) : error C2371: 'PerlIO_funcs' : redefinition; dif ferent basic types C:\Perl\lib\CORE\perlio.h(100) : see declaration of 'PerlIO_funcs' C:\Perl\lib\CORE\perlio.h(108) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(108) : error C2059: syntax error : ',' C:\Perl\lib\CORE\perlio.h(109) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(110) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(110) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(110) : error C2040: 'PerlIO' : 'int ' differs in level s of indirection from 'struct _PerlIO *' C:\Perl\lib\CORE\perlio.h(110) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(110) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(111) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(111) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(111) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(111) : error C2040: 'PerlIO' : 'int ' differs in level s of indirection from 'struct _PerlIO *' C:\Perl\lib\CORE\perlio.h(111) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(111) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(112) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(112) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(112) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(112) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(112) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(214) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(214) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(214) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(227) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(227) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(227) : error C2059: syntax error : 'type' C:\Perl\lib\CORE\perlio.h(229) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(339) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(339) : error C2081: 'SV' : name in formal parameter li st illegal C:\Perl\lib\CORE\perlio.h(339) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(339) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(339) : error C2059: syntax error : ';' C:\Perl\lib\CORE\perlio.h(342) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(342) : error C2081: 'SV' : name in formal parameter li st illegal C:\Perl\lib\CORE\perlio.h(342) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(342) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(342) : error C2059: syntax error : ';' C:\Perl\lib\CORE\perlio.h(345) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(345) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(345) : error C2040: 'PerlIO' : 'int ' differs in level s of indirection from 'struct _PerlIO *' C:\Perl\lib\CORE\perlio.h(345) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(345) : error C2059: syntax error : ',' C:\Perl\lib\CORE\perlio.h(345) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(354) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(354) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(354) : error C2040: 'PerlIO' : 'int ' differs in level s of indirection from 'struct _PerlIO *' C:\Perl\lib\CORE\perlio.h(354) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(354) : error C2059: syntax error : 'type' C:\Perl\lib\CORE\perlio.h(355) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(358) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(358) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(358) : error C2040: 'PerlIO' : 'int ' differs in level s of indirection from 'struct _PerlIO *' C:\Perl\lib\CORE\perlio.h(358) : error C2143: syntax error : missing ';' before '*' C:\Perl\lib\CORE\perlio.h(358) : error C2059: syntax error : 'type' C:\Perl\lib\CORE\perlio.h(359) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(365) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(365) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(365) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perlio.h(370) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\perlio.h(370) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\perlio.h(370) : error C2059: syntax error : ')' C:\Perl\lib\CORE\win32iop.h(73) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\win32iop.h(73) : error C2081: 'Stat_t' : name in formal paramet er list illegal C:\Perl\lib\CORE\win32iop.h(73) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\win32iop.h(73) : error C2059: syntax error : ')' C:\Perl\lib\CORE\win32iop.h(74) : error C2143: syntax error : missing ')' before '*' C:\Perl\lib\CORE\win32iop.h(74) : error C2081: 'Stat_t' : name in formal paramet er list illegal C:\Perl\lib\CORE\win32iop.h(74) : error C2143: syntax error : missing '{' before '*' C:\Perl\lib\CORE\win32iop.h(74) : error C2059: syntax error : ')' C:\Perl\lib\CORE\win32iop.h(77) : error C2146: syntax error : missing ')' before identifier 'narg' C:\Perl\lib\CORE\win32iop.h(77) : error C2081: 'IV' : name in formal parameter l ist illegal C:\Perl\lib\CORE\win32iop.h(77) : error C2061: syntax error : identifier 'narg' C:\Perl\lib\CORE\win32iop.h(77) : error C2059: syntax error : ';' C:\Perl\lib\CORE\win32iop.h(77) : error C2059: syntax error : ',' C:\Perl\lib\CORE\win32iop.h(77) : error C2059: syntax error : ')' C:\Perl\lib\CORE\win32iop.h(133) : error C2143: syntax error : missing ')' befor e '*' C:\Perl\lib\CORE\win32iop.h(133) : error C2081: 'Stat_t' : name in formal parame ter list illegal C:\Perl\lib\CORE\win32iop.h(133) : error C2143: syntax error : missing '{' befor e '*' C:\Perl\lib\CORE\win32iop.h(133) : error C2059: syntax error : ')' C:\Perl\lib\CORE\perl.h(1062) : warning C4273: 'win32_strerror' : inconsistent d ll linkage. dllexport assumed. C:\Perl\lib\CORE\perl.h(2015) : error C2371: 'PerlInterpreter' : redefinition; d ifferent basic types C:\Perl\lib\CORE\perlio.h(112) : see declaration of 'PerlInterpreter' C:\Perl\lib\CORE\perl.h(2015) : fatal error C1003: error count exceeds 100; stop ping compilation NMAKE : fatal error U1077: 'cl' : return code '0x2' Stop.

-- ParBohrarper - 14 Jan 2008

The offending line in win32.h is: extern int my_fstat(int fd, Stat_t *sbufptr);

-- ParBohrarper - 14 Jan 2008

By editing Makefile.PL to this:

# Makefile for NativeTWikiSearch module use ExtUtils::MakeMaker; WriteMakefile ( NAME => 'NativeTWikiSearch', OBJECT => 'NativeTWikiSearch.o cgrep.o', LIBS => [ '-lpcre' ], # CCFLAGS => "-g", # LD => "gcc", # OBJ_EXT => ".o", # LDFROM => '$(OBJECT) -lpcre', );

it compiles, but i still get the "Free to wrong pool" errors i got before on NativeSearch...

-- ParBohrarper - 14 Jan 2008

Although test.pl would work fine, I was geting Segmentation faults under Apache2.4.10 mod_perl 2.0.9

    [core:notice] [pid 16079] AH00051: child pid 16086 exit signal Segmentation fault (11)

... and compile warnings with gcc version 4.9.1

NativeTWikiSearch.c:252:9: warning: assignment makes pointer from integer without a cast
  RETVAL = cgrep(argv);
         ^

After using gdb on some core dumps, I ended up fixing both by adding a prototype for cgrep in NativeTWikiSearch.xs (patch attached)

--- NativeTWikiSearch.xs.orig   2007-01-26 04:22:20.000000000 -0800
+++ NativeTWikiSearch.xs   2015-01-23 11:31:54.764653041 -0800
@@ -8,6 +8,8 @@
 #include "perl.h"
 #include "XSUB.h"

+extern char** cgrep(char**);
+
 /*
  * Unpack perl args into an array of (read only) strings. The function name
  * is dictated by the mapping in the default typemap i.e.
@@ -68,7 +70,7 @@
    char <b>*c;
     if (!s)
         return;
-   for(c = s; *c; c++){
+   for(c = s; *c != NULL; c++){
       sv = newSVpv(*c, 0);
       av_push(av, sv);
         free(*c);
@@ -85,4 +87,4 @@
 cgrep(argv)
    char *</b> argv
     PREINIT:
-        int count_charPtrPtr;
+        int count_charPtrPtr = 0;

Also, I don't think count_charPtrPtr is actually used for anything.

-- James Macdonell - 2015-01-23

Thank you for sharing the patch, James!

-- Peter Thoeny - 2015-01-24

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch NativeTWikiSearch.xs.patch r1 manage 0.7 K 2015-01-23 - 19:40 JamesMacdonell Add prototype for cgrep to prevent SEGFAULT under apache2.4/mod_perl (as well as complie warnings)
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2015-01-24 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.