Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Updating broken and possibly incomplete SWIG Perl module building tutorial on SWIG web site

by hermida (Scribe)
on Mar 26, 2011 at 17:02 UTC ( [id://895669]=note: print w/replies, xml ) Need Help??


in reply to Re: Updating broken and possibly incomplete SWIG Perl module building tutorial on SWIG web site
in thread Updating broken and possibly incomplete SWIG Perl module building tutorial on SWIG web site

Here is just one example of the commands when installing a CPAN module and using ExtUtils::MakeMaker:
/home/hermida/soft/perl/5.12.3/bin/perl /home/hermida/soft/perl/5.12.3 +/lib/5.12.3/ExtUtils/xsubpp -noprototypes -typemap /home/hermida/soft +/perl/5.12.3/lib/5.12.3/ExtUtils/typemap -typemap typemap Expat.xs > + Expat.xsc && mv Expat.xsc Expat.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-p +rotector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS +=64 -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-prot +ector --param=ssp-buffer-size=4 -m64 -mtune=native -march=native -g - +DVERSION=\"2.40\" -DXS_VERSION=\"2.40\" -fPIC "-I/home/hermida/soft/p +erl/5.12.3/lib/5.12.3/x86_64-linux-thread-multi/CORE" Expat.c gcc -shared -O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fsta +ck-protector --param=ssp-buffer-size=4 -m64 -mtune=native -march=nati +ve -g Expat.o -o ../blib/arch/auto/XML/Parser/Expat/Expat.so

This is how all CPAN Perl modules with C + XS code compile and link (yes some have some extra flags that are just relevant to that particular module, but the all have these as the basis). The first command is not necessary for SWIG as you already have the C code and as I showed before swig -perl example.i autogenerates XS and .pm and other wrapping C code automatically. Let's breakdown the above parts that ExtUtils::MakeMaker created for this command:

gcc -c [Config-ccflags] [Config-optimize] [Config-cccdlflags] "-I[Conf +ig-archlib]/CORE" module.c gcc [Config-lddlflags] module.o -o module.so

This creates everything you need to create the Perl module and has been tested successfully by me and by SWIG people just yesterday. We ran Perl code using the modules and they work perfectly.

Please tell me why this is wrong in detail.
  • Comment on Re^2: Updating broken and possibly incomplete SWIG Perl module building tutorial on SWIG web site
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://895669]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-26 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found