in reply to Re: XS module build not working for Perl 5.8
in thread XS module build not working for Perl 5.8

With regards to 5.8.8, please see reply above. The error occurs at "make test".

With regards to 5.8.6, the error occurs at "make". I have attached the fail log below:

sunscape% make cp lib/MyPackage.pm blib/lib/MyPackage.pm /usr/bin/perl /usr/local/lib/perl5/5.8.6/ExtUtils/xsubpp -C++ -typema +p /usr/local/lib/perl5/5.8.6/ExtUtils/typemap -typemap perlobject.map + -typemap typemap MyPackage.xs > MyPackage.xsc && mv MyPackage.xsc M +yPackage.c Please specify prototyping behavior for MyPackage.xs (see perlxs manua +l) CC -c -I. -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFI +LE_SOURCE -D_FILE_OFFSET_BITS=64 -O -DVERSION=\"0.01\" -DXS_VERSI +ON=\"0.01\" -fPIC "-I/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE" +MyPackage.c CC: Warning: Option -fno-strict-aliasing passed to ld, if ld is invoke +d, ignored otherwise CC: Warning: Option -pipe passed to ld, if ld is invoked, ignored othe +rwise CC: Warning: Option -fPIC passed to ld, if ld is invoked, ignored othe +rwise "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 102: Erro +r: "{" expected instead of "__attribute__". "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 102: Erro +r: The function __attribute__ must have a prototype. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 102: Erro +r: noreturn is not defined. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 104: Erro +r: Badly formed expression. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 104: Erro +r: Multiple declaration for pat. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 104: Erro +r: va_list must be initialized. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 104: Erro +r: "," expected instead of "*". "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 153: Erro +r: The type "void" is incomplete. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 153: Erro +r: There is no matching ")". "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 153: Erro +r: Multiple declaration for pat. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 153: Erro +r: Multiple declaration for va_list. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 153: Erro +r: va_list must be initialized. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 153: Erro +r: "," expected instead of "*". "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 163: Erro +r: There is no matching ")". "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 163: Erro +r: Multiple declaration for pat. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 163: Erro +r: Multiple declaration for va_list. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 163: Erro +r: va_list must be initialized. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 163: Erro +r: "," expected instead of "*". "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 230: Erro +r: There is no matching ")". "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 230: Erro +r: Multiple declaration for pat. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 230: Erro +r: Multiple declaration for va_list. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 230: Erro +r: va_list must be initialized. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 230: Erro +r: "," expected instead of "*". "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 360: Erro +r: The type "void" is incomplete. "/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE/proto.h", line 360: Erro +r: Unexpected type name "U32" encountered. Compilation aborted, too many Error messages. *** Error code 1 make: Fatal error: Command failed for target `MyPackage.o'

20060821 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

Replies are listed 'Best First'.
Re^3: XS module build not working for Perl 5.8
by ysth (Canon) on Aug 21, 2006 at 17:42 UTC
    The "Command failed for target 'test_dynamic'" is just make telling you something previously got an error; what was that?

    Are you building these perls yourself or getting them from some binary distribution? If the latter, do you have the same compiler as was used to build perl?

      The error is: "Error: Can't load '/eng/proj/pacsun/DEV/MyPackage/blib/arch/auto/MyPackage/MyPackage.so' for module MyPackage: ld.so.1: /eng/proj/pacsun/TOOLS/bin/perl: fatal: relocation error: file /eng/proj/pacsun/DEV/MyPackage/blib/arch/auto/MyPackage/MyPackage.so: symbol cout: referenced symbol not found at /eng/proj/pacsun/TOOLS/lib/5.8.8/sun4-solaris-thread-multi/DynaLoader.pm line 230."

      I think you might be educating me here ... I downloaded the Perl binary for 5.8.8 from ActiveState. This is the Perl that I am running and trying to build XS based modules in. Are you telling me that I must use the same compiler as ActiveState used to generate the binary? If so, how do I know what compiler they used?

      I'm not sure I completely understand if this is true. While running 5.6, I would routinely create XS modules using C++ code. Typically I would compile using gcc. But Perl is compiled using some C compiler i.e. not gcc. I thought the XS generated library just created machine code and that the typemap dealt with passing data to and from the C/Perl object to your C++/XS object.

        I think you might be educating me here ... I downloaded the Perl binary for 5.8.8 from ActiveState. This is the Perl that I am running and trying to build XS based modules in. Are you telling me that I must use the same compiler as ActiveState used to generate the binary?
        In general, this is true, since the module build process will try to use compilers/linkers/options determined when perl was built. I know solaris has stuff to allow building modules with gcc via Solaris-PerlGcc, and recent ActiveState Win32 perl is supposed to also allow building modules with MinGW's gcc. But I don't know about ActiveState's Solaris perl or how any of those bandaids work with C++ modules.

        I'd really recommend building your own perl, perhaps starting with the Configure options given by perl -V:config_args on the perl you are using now. Also note that not many people build C++ modules, so IIRC that occasionally has been broken.

        How are you building your module now? It's starting to sound to me like you have your own makefile rather than having ExtUtils::MakeMaker build one; if so, you can expect breakage whenever perl's Config changes.