in reply to Re^4: Inline::C produces compilation errors
in thread Inline::C produces compilation errors

It's that one undefined symbol pthread_getspecific that's causing the problem. It's not apparent to me just why that problem arises. Nor do I know what needs to be done to fix it.

Can you build any extensions (modules containing XS code) at all ? Can you, eg, successfully build Math::FFT from source ?

What does perl -V output ?

Cheers,
Rob

Replies are listed 'Best First'.
Re^6: Inline::C produces compilation errors
by holandes777 (Scribe) on Nov 24, 2007 at 14:06 UTC
    More Info:
    I reinstalled version-0.74 and Parse-RecDescent-v1.95.1, both of whom are prerequesistes to installing Inline::C. The make test ended with "Failed 5/6 test scripts, 16.67% okay. 8/11 subtests failed, 27.27% okay." as it had before.
    When I tried running the original program I get the same result.So I tried the following minimalist program:
    my $kk = kk(); print "perl kk=$kk\n"; use Inline C => <<'END_OF_C_CODE'; #include <stdio.h> #include <stdlib.h> #include <string.h> int kk () { printf("Hello!\n"); return(0); } END_OF_C_CODE
    And I got the following output:
    Hello! perl kk=0
    So I can compile something, I then kept adding the lines I needed one at a time until I got to this:
    my $kk = kk(); print "perl kk=$kk\n"; use Inline C => Config => LIBS => '-L/HASP/perltestP -llibhasp_linux.a +'; use Inline C => <<'END_OF_C_CODE'; #include <stdio.h> #include <stdlib.h> #include <string.h> #include <hasp_hl.h> #include <hasp_vcode.h> int kk () { hasp_status_t status; hasp_handle_t handle; int i; char filename[] = "prg"; printf("Hello!\n"); status = hasp_login(HASP_PROGNUM_DEFAULT_FID, (hasp_vendor_code_t *)vendor_code, &handle); // switch (status) { // case HASP_STATUS_OK: // printf("OK\n"); // hasp_logout(handle); // return(1); // break; // default: // printf("BAD\n"); return(0); } END_OF_C_CODE
    Which broke complaining that :perl: symbol lookup error: /HASP/perltestP/_Inline/lib/auto/c2_pl_4339/c2_pl_4339.so: undefined symbol: hasp_login".
     
    However, if I approach this from the C side as follows, it recolves hasp_login without a problem.
    #include <stdio.h> #include <stdlib.h> #include <string.h> #include <hasp_hl.h> #include <hasp_vcode.h> int kk () { hasp_status_t status; hasp_handle_t handle; int i; printf("start : "); status = hasp_login(HASP_PROGNUM_DEFAULT_FID, (hasp_vendor_code_t *)vendor_code, &handle); switch (status) { case HASP_STATUS_OK: printf("OK\n"); hasp_logout(handle); return(1); break; default: printf("BAD\n"); return(0); } } int main(void) { int result; result = kk(); printf("result was %d\n",result); }
    This would indicate that Inline::C is unable to resolve extenal references that are not from itself ??? I think it all relates the the tests that are being failed on the "make test" of the Inlince::C installation. I've googled and I have checked the bug reports in cpan.org. Nothing really looks like this. Should I report it as a bug to "INGY" on cpan.org's site?
      use Inline C => Config => LIBS => '-L/HASP/perltestP -llibhasp_linux.a';

      I think that's wrong, unless the library is called something like libhasp_linux.a.a. Or is the linker smart enough to know that the '.a' should be dropped ? I would change it to:
      use Inline C => Config => LIBS => '-L/HASP/perltestP -llibhasp_linux', BUILD_NOISY => 1;
      and check the output for any messages that tell you that no library was found for -llibhasp_linux. When you build the C program do you provide an -llibhasp_linux.a argument on the command line (or is it simply -llibhasp_linux ) ? I would expect that whatever argument works on the command line should also work for the 'LIBS' config option.

      Note: The BUILD_NOISY option means that you'll see any warnings that are emitted during the build process. Without it, relevant warnings often don't appear.

      Cheers,
      Rob
Re^6: Inline::C produces compilation errors
by holandes777 (Scribe) on Nov 24, 2007 at 13:07 UTC
    At the moment I don't think I can build anything with XS. The output of execution says it cannt find the Inline.pm module, and that is true since the deinstallation of perl 5.8.6 previous to installing 5.8.8 removed the packages. I had to reinstall all of them.
     
    output of perl -V is :
     
    [root@FC4-Casinfo perltestP]# perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.11-1.1369_fc4, archname=i686-linux uname='linux fc4-casinfo 2.6.11-1.1369_fc4 #1 thu jun 2 22:55:56 e +dt 2005 i686 i686 i386 gnulinux ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -Wdeclaration-after- +statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BIT +S=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement + -I/usr/local/include' ccversion='', gccversion='4.0.2 20051125 (Red Hat 4.0.2-8)', gccos +andvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.3.5.so, so=so, useshrplib=false, libperl=libperl. +a gnulibc_version='2.3.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO Built under linux Compiled at Nov 22 2007 07:57:47 @INC: /usr/local/lib/perl5/5.8.8/i686-linux /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/i686-linux /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl . [root@FC4-Casinfo perltestP]#
      At the moment I don't think I can build anything with XS

      What error messages do you get when you try to build a module (other than Inline) that includes XS code. (It's generally easier to diagnose error messages in relation to XS modules - rather than trying to diagnose the errors that Inline spits out.)

      Mind you, I'm pretty much at a loss to see why you should be having such difficulty. The output of your 'perl -V' is very similar to mine for linux. My configure args were '-des' and the '-Wdeclaration-after-statement' is missing on my build. Apart from that I can't spot a significant difference. I don't think the '-des' vs '-de' difference could amount to much ... I have no idea what the '-Wdeclaration-after-statement' stuff is about (and whether it could be relevant).

      Anyway, if you like to post the results of trying to build an XS module (such as Math::FFT), then I'll certainly take a look. (Whether I'll be able to provide some useful assistance is another question .... looking more'n'more unlikely :-)

      Cheers,
      Rob