<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
This is certainly not an Inline bug. This is some interaction between perl.h and search.h. I've actually found that while removing the #include <search.h> from the code will let the simple test run, it results in other problems. It seems that if #include <search.h> is specified prior to #include <perl.h>, the code works. If search.h is included after perl.h, there are issues. This occurs whether I use Inline, swig, or just a simple compiled c program.<br><br>Which brings me to an Inline question. If I look at the Inline output .xs file, it includes this at the top:<br>#include "EXTERN.h"<br>#include "perl.h"<br>#include "XSUB.h"<br>#include "INLINE.h"<br><br>Is there some configuration option that would allow me to end up with:<br>#include "search.h"<br>#include "EXTERN.h"<br>#include "perl.h"<br>#include "XSUB.h"<br>#include "INLINE.h"<br><br>I have looked over Inline documentation, but I can't seem to spot anything that does what I want. I can add the include in the perl file with the c code, but then the search.h include occurs after the perl.h include and I run into my issue.<br><br>Thanks for the help :)<br><br>> From: jaleto@gmail.com<br>> Date: Tue, 12 May 2009 13:07:04 -0700<br>> Subject: Re: [Pdx-pm] Inline::C search.h 'Perl_push_scope'<br>> To: vortix@hotmail.com<br>> CC: pdx-pm-list@pm.org<br>> <br>> Howdy,<br>> <br>> If this *was* a bug with Inline, then you could report it here<br>> <br>> http://rt.cpan.org/Public/Dist/Display.html?Name=Inline<br>> <br>> Since this is a publicly archived list, if anyone googles for this<br>> error now, they will be pointed to this thread. If you really wanted<br>> to go the extra mile, you could provide a documentation patch to<br>> Inline which says something along the lines of "including certain<br>> header files multiple times may give you odd errors" or "don't<br>> re-include things that perl.h already does" or somesuch. You would<br>> probably want to send this patch to SISYPHUS@cpan.org .<br>> <br>> Cheers,<br>> <br>> <br>> <br>> On Tue, May 12, 2009 at 11:56 AM, Thomas Thompson <vortix@hotmail.com> wrote:<br>> > The problem does not appear to be Inline::C related as I tried to do a<br>> > similar approach with swig and got the same compile error.<br>> ><br>> > After much digging, some promises of beer, and a few bribes I found that<br>> > perl.h apparently includes search.h. I can remove the #include <search.h><br>> > directive from my code and still have access to search.h functionality. This<br>> > also seems to clear up the compile error below. This new code:<br>> ><br>> > #!/usr/intel/bin/perl -w<br>> ><br>> > use Inline C;<br>> > use strict;<br>> ><br>> > hello_inline();<br>> ><br>> > __END__<br>> > __C__<br>> > //#include <search.h><br>> > #include <stdio.h><br>> ><br>> > void hello_inline( ) {<br>> > hcreate(10); // search.h hash creation here, working happily<br>> > printf( "Hello World. Best Regards from Inline\n" );<br>> > }<br>> ><br>> > Results in:<br>> > plxc1000> test_c3.pl<br>> > Hello World. Best Regards from Inline<br>> ><br>> > Somehow redeclaring the search.h include is causing a problem. In any case,<br>> > this workaround will do what I need to do. I appreciate any time you took<br>> > looking at this for me :) Is there any followup I should do? Is this a<br>> > bug, or was I not properly declaring/using search.h? Should I report this<br>> > somewhere? I'd like to try to be a useful member of the coding community<br>> > and make certain other people don't run into this issue.<br>> ><br>> > ________________________________<br>> > From: vortix@hotmail.com<br>> > To: jaleto@gmail.com<br>> > Date: Tue, 12 May 2009 11:48:41 -0500<br>> > CC: pdx-pm-list@pm.org<br>> > Subject: Re: [Pdx-pm] Inline::C search.h 'Perl_push_scope'<br>> ><br>> > Here's the output from the commands you mentioned. I also included cc<br>> > --version as that seems to be the compiler mentioned in Perl -V.<br>> ><br>> > plxc1000> perl -V<br>> > Summary of my perl5 (revision 5 version 8 subversion 5) configuration:<br>> > Platform:<br>> > osname=linux, osvers=2.6.5-7.97-smp, archname=x86_64-linux<br>> > uname='linux plxb0325 2.6.5-7.97-smp #1 smp fri jul 2 14:21:59 utc 2004<br>> > x86_64 x86_64 x86_64 gnulinux '<br>> > config_args='-Uusemymalloc -Dprefix=/usr/intel/pkgs/perl/5.8.5<br>> > -Dcc=/usr/intel/pkgs/gcc/3.4.2/bin/gcc -Doptimize=none<br>> > -Dloclibpth=/usr/intel/00r1/lib -Dlocincpth=/usr/intel/00r1/include<br>> > -Duse64bitall -Uinstallusrbinperl -Duselargefiles<br>> > -Dperladmin=tmnguye3@sedona.intel.com -Uinstallusrbinperl -des'<br>> > hint=recommended, useposix=true, d_sigaction=define<br>> > usethreads=undef use5005threads=undef useithreads=undef<br>> > usemultiplicity=undef<br>> > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef<br>> > use64bitint=define use64bitall=define uselongdouble=undef<br>> > usemymalloc=n, bincompat5005=undef<br>> > Compiler:<br>> > cc='/usr/intel/pkgs/gcc/3.4.2/bin/gcc', ccflags ='-fno-strict-aliasing<br>> > -pipe -I/usr/intel/00r1/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',<br>> > optimize=' ',<br>> > cppflags='-fno-strict-aliasing -pipe -I/usr/intel/00r1/include'<br>> > ccversion='', gccversion='3.4.2', gccosandvers=''<br>> > intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678<br>> > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16<br>> > ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',<br>> > lseeksize=8<br>> > alignbytes=8, prototype=define<br>> > Linker and Libraries:<br>> > ld='/usr/intel/pkgs/gcc/3.4.2/bin/gcc', ldflags ='<br>> > -L/usr/intel/00r1/lib'<br>> > libpth=/usr/intel/00r1/lib /lib /usr/lib /usr/local/lib<br>> > libs=-lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc<br>> > perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc<br>> > libc=, so=so, useshrplib=false, libperl=libperl.a<br>> > gnulibc_version='2.3.3'<br>> > Dynamic Linking:<br>> > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'<br>> > cccdlflags='-fpic', lddlflags='-shared -L/usr/intel/00r1/lib'<br>> ><br>> ><br>> > Characteristics of this binary (from libperl):<br>> > Compile-time options: USE_64_BIT_INT USE_64_BIT_ALL USE_LARGE_FILES<br>> > Built under linux<br>> > Compiled at Nov 1 2004 16:34:54<br>> > %ENV:<br>> ><br>> > PERL5LIB="/usr/intel/pkgs/icc/9.0.025/lib:/nfs/pdx/disks/nehalem.pde.077/lib:/nfs/pdx/disks/nehalem.pde.077/instantclient_10_2/:/nfs/pdx/disks/nehalem.pde.077/mysql/5.0.27/lib:/nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5/x86_64-linux/Alien/SVN:/usr/ucblib:/usr/lib:/usr/intel/pkgs/freeTDS/0.61.2/lib:/nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5:/nfs/pdx/disks/nehalem.pde.077/perl/lib/5.8.5/:/nfs/pdx/disks/nehalem.pde.077/perl/Inline/lib/site_perl/5.8.5"<br>> > @INC:<br>> > /usr/intel/pkgs/icc/9.0.025/lib<br>> > /nfs/pdx/disks/nehalem.pde.077/lib/5.8.5/x86_64-linux<br>> > /nfs/pdx/disks/nehalem.pde.077/lib/5.8.5<br>> > /nfs/pdx/disks/nehalem.pde.077/lib<br>> > /nfs/pdx/disks/nehalem.pde.077/instantclient_10_2/<br>> > /nfs/pdx/disks/nehalem.pde.077/mysql/5.0.27/lib<br>> ><br>> > /nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5/x86_64-linux/Alien/SVN<br>> > /usr/ucblib<br>> > /usr/lib<br>> > /usr/intel/pkgs/freeTDS/0.61.2/lib<br>> > /nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5/x86_64-linux<br>> > /nfs/pdx/disks/nehalem.pde.077/perl/lib/site_perl/5.8.5<br>> > /nfs/pdx/disks/nehalem.pde.077/perl/lib/5.8.5//x86_64-linux<br>> > /nfs/pdx/disks/nehalem.pde.077/perl/lib/5.8.5/<br>> ><br>> > /nfs/pdx/disks/nehalem.pde.077/perl/Inline/lib/site_perl/5.8.5/x86_64-linux<br>> > /nfs/pdx/disks/nehalem.pde.077/perl/Inline/lib/site_perl/5.8.5<br>> > /usr/intel/pkgs/perl/5.8.5/lib/5.8.5/x86_64-linux<br>> > /usr/intel/pkgs/perl/5.8.5/lib/5.8.5<br>> > /usr/intel/pkgs/perl/5.8.5/lib/site_perl/5.8.5/x86_64-linux<br>> > /usr/intel/pkgs/perl/5.8.5/lib/site_perl/5.8.5<br>> > /usr/intel/pkgs/perl/5.8.5/lib/site_perl<br>> ><br>> > plxc1000> cc --version<br>> > cc (GCC) 3.3.3 (SuSE Linux)<br>> > Copyright (C) 2003 Free Software Foundation, Inc.<br>> > This is free software; see the source for copying conditions. There is NO<br>> > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br>> ><br>> > plxc1000> gcc --version<br>> > gcc (GCC) 3.4.2<br>> > Copyright (C) 2004 Free Software Foundation, Inc.<br>> > This is free software; see the source for copying conditions. There is NO<br>> > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.<br>> ><br>> > Inline is version: 0.44<br>> ><br>> > A Perl upgrade could potentially be quite painful, but if there's no obvious<br>> > fix for this issue I'm willing to give it a shot. I find that getting the<br>> > compiler options/directives correct is pretty tough for us new guys :)<br>> ><br>> > Thanks!<br>> ><br>> ><br>> >> From: jaleto@gmail.com<br>> >> Date: Tue, 12 May 2009 00:26:41 -0700<br>> >> Subject: Re: [Pdx-pm] Inline::C search.h 'Perl_push_scope'<br>> >> To: vortix@hotmail.com<br>> >> CC: pdx-pm-list@pm.org<br>> >><br>> >> Howdy,<br>> >><br>> >> Providing the output of "perl -V" , "gcc --version" and the version of<br>> >> Inline would be useful. Also, Perl 5.8.3 is quite old, so upgrading to<br>> >> a more recent version of Perl and Inline may solve your issue without<br>> >> the need for exotic debugging, if that is possible.<br>> >><br>> >> Cheers,<br>> >><br>> >><br>> >><br>> >> 2009/5/11 Thomas Thompson <vortix@hotmail.com>:<br>> >> > Hi guys,<br>> >> ><br>> >> > This is my first post to this list. I'm not an expert in Perl and<br>> >> > definitely a beginner with C. I'm trying to rewrite a short section of<br>> >> > some<br>> >> > Perl code in C, but I've bumped into the following issue:<br>> >> ><br>> >> > #!/usr/bin/perl -w<br>> >> ><br>> >> > use Inline C;<br>> >> > use strict;<br>> >> ><br>> >> > hello_inline();<br>> >> ><br>> >> > __END__<br>> >> > __C__<br>> >> > #include <stdio.h><br>> >> ><br>> >> > void hello_inline( ) {<br>> >> > printf( "Hello World. Best Regards from Inline\n" );<br>> >> > }<br>> >> ><br>> >> > The above code works fine, and the output is:<br>> >> ><br>> >> > plxc1000> test_c3.pl<br>> >> > Hello World. Best Regards from Inline<br>> >> ><br>> >> > However, the following code (adding the search.h header file):<br>> >> ><br>> >> > #!/usr/bin/perl -w<br>> >> ><br>> >> > use Inline C;<br>> >> > use strict;<br>> >> ><br>> >> > hello_inline();<br>> >> ><br>> >> > __END__<br>> >> > __C__<br>> >> > #include <stdio.h><br>> >> > #include <search.h><br>> >> ><br>> >> > void hello_inline( ) {<br>> >> > printf( "Hello World. Best Regards from Inline\n" );<br>> >> > }<br>> >> ><br>> >> > Results in this output:<br>> >> ><br>> >> > plxc1000> test_c3.pl<br>> >> > /usr/bin/perl /usr/lib/perl5/5.8.3/ExtUtils/xsubpp -typemap<br>> >> > /usr/lib/perl5/5.8.3/ExtUtils/typemap test_c3_pl_f52f.xs ><br>> >> > test_c3_pl_f52f.xsc && mv test_c3_pl_f52f.xsc test_c3_pl_f52f.c<br>> >> > cc -c -I/nfs/pdx/disks/nehalem.pde.077/projects/rapttr/src -D_REENTRANT<br>> >> > -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing<br>> >> > -D_LARGEFILE_SOURCE<br>> >> > -D_FILE_OFFSET_BITS=64 -O2 -fmessage-length=0 -Wall -Wall -pipe<br>> >> > -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC<br>> >> > "-I/usr/lib/perl5/5.8.3/x86_64-linux-thread-multi/CORE"<br>> >> > test_c3_pl_f52f.c<br>> >> > In file included from test_c3_pl_f52f.xs:6:<br>> >> > /usr/include/search.h:66: error: `Perl_push_scope' redeclared as<br>> >> > different<br>> >> > kind of symbol<br>> >> > /usr/lib/perl5/5.8.3/x86_64-linux-thread-multi/CORE/proto.h:590: error:<br>> >> > previous declaration of `Perl_push_scope'<br>> >> > /usr/include/search.h:66: error: parse error before '(' token<br>> >> > make: *** [test_c3_pl_f52f.o] Error 1<br>> >> ><br>> >> > A problem was encountered while attempting to compile and install your<br>> >> > Inline<br>> >> > C code. The command that failed was:<br>> >> > make > out.make 2>&1<br>> >> ><br>> >> > Looking through the search.h header file, I don't see any instance of<br>> >> > Perl_push_scope being redeclared, especially not on line 66 (which seems<br>> >> > to<br>> >> > be the middle of an enum type declaration). I have not modified any of<br>> >> > these header files. This is on SUSE LINUX Enterprise Server 9 (x86_64).<br>> >> ><br>> >> > Any ideas to help out a new guy? :) Let me know if I missed information<br>> >> > I<br>> >> > should provide when asking this type of question and I'll make certain<br>> >> > to<br>> >> > make certain to provide everything you guys need in the future. I<br>> >> > appreciate the help!<br>> >> ><br>> >> > Thomas<br>> >> ><br>> >> ><br>> >> > ________________________________<br>> >> > Insert movie times and more without leaving Hotmail®. See how.<br>> >> > _______________________________________________<br>> >> > Pdx-pm-list mailing list<br>> >> > Pdx-pm-list@pm.org<br>> >> > http://mail.pm.org/mailman/listinfo/pdx-pm-list<br>> >> ><br>> >><br>> >><br>> >><br>> >> --<br>> >><br>> >> Jonathan Leto<br>> >> jonathan@leto.net<br>> >> http://leto.net<br>> ><br>> > ________________________________<br>> > Insert movie times and more without leaving Hotmail®. See how.<br>> > ________________________________<br>> > Windows Live™: Keep your life in sync. Check it out.<br>> <br>> <br>> <br>> -- <br>> <br>> Jonathan Leto<br>> jonathan@leto.net<br>> http://leto.net<br><br /><hr />Insert movie times and more without leaving Hotmail®. <a href='http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009' target='_new'>See how.</a></body>
</html>