Hi Guy, just looking at the output and having not tried this.

It looks like you have a typo with your 'C' file. Put a new line at the end.

And looks like you need -fPIC in your second compilation line. If you do:

gcc -fPIC -shared Suma.o suma.o -o blib/arch/auto/PDL/Suma/ Suma.so -lm

immediately after the failure, does it work?

On 22/02/2007, at 8:27 AM, Phuong, Guy wrote:

Hello Xavier

Thank you so much for sending me that link. Everything seems a lot more clearer now and I think I understand how all the bits and pieces work now. I'll also be looking forward to your fortran cookbook as that is primarily
what I'm trying to do.

I have run through your instructions step by step and when I get to the part
when I type the command

Make (after perl Makefile.PL) I get an error message and I'm forced to stop
here.   The error message is as follows


/usr/bin/perl -I/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux- thread-multi
"-MPDL::PP qw/PDL::Suma PDL::Suma Suma/" Suma.pd
touch Suma.xs
/usr/bin/perl /usr/lib/perl5/5.8.5/ExtUtils/xsubpp  -typemap
/usr/lib/perl5/5.8.5/ExtUtils/typemap -typemap
/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/PDL/ Core/typema
p.pdl  Suma.xs > Suma.xsc && mv Suma.xsc Suma.c
gcc -c
-I/usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi/PDL/ Core
-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/include/gdbm -O2 -g -pipe -m64   -DVERSION=\"0.1\"
-DXS_VERSION=\"0.1\" -fPIC
"-I/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/CORE"   Suma.c
gcc -c -o suma.o -g suma.c
suma.c:11:3: warning: no newline at end of file
Running Mkbootstrap for PDL::Suma ()
chmod 644 Suma.bs
rm -f blib/arch/auto/PDL/Suma/Suma.so
gcc  -shared Suma.o suma.o  -o blib/arch/auto/PDL/Suma/Suma.so   -lm
/usr/bin/ld: suma.o: relocation R_X86_64_PC32 against `cos@@GLIBC_2.2.5' can
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/PDL/Suma/Suma.so] Error 1



I'm not exactly sure what the error is.  Do you have any idea?

Your help is much appreciated,
Regards

Guy



-----Original Message-----
From: Xavier Calbet [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 21, 2007 5:03 AM
To: Vanuxem Grégory
Cc: Karl Glazebrook; Phuong, Guy; [EMAIL PROTECTED]; [email protected]
Subject: Re: [Perldl] How to access my fortran library routines in PDL

  Hello Guy,

  I have just made a document describing how to compile a C function
into PDL. Tomorrow, hopefully, I will do the same for a FORTRAN
function.
  Have a look in

http://wiki.jach.hawaii.edu/pdl_wiki-bin/wiki/PDL_Cookbook

  Cheers,

  Xavier


On 2/21/07, Vanuxem Grégory <[EMAIL PROTECTED]> wrote:
Le mardi 20 février 2007 à 19:41 -0300, Karl Glazebrook a écrit :
On CallExt from perl have a look at callext.t in the PDL distribution.


It is important to clarify whether you are having problems building a
routine to use with CallExt or simply running it,

The other way to call C etc is using Inline::PP

Yes and here is a quickly hacked  example (I call fortran here):

====================================================================
use PDL;

use Inline Pdlpp => Config =>
INC => "-I$ENV{HOME}/include",
LIBS => "-lm -lblas -lg2c",
#code to be included in the generated XS
AUTO_INCLUDE => <<'EOINC',

extern double dasum_(int *n, double *x, int *incx);

EOINC
;

use Inline Pdlpp;

$a = random(5);
print $a->sumover,"\n";
print $a->mydasum(),"\n";

__DATA__

__Pdlpp__

pp_def('mydasum',
      Pars => 'x(n); [o] res()',
      GenericTypes => [D],
      Code =>
      '
        int inc = 1;
        $res() = dasum_(&($SIZE(n)),$P(x),&inc);
      ');



====================================================================== =====

Apparently, on my distro (Debian), the html documentation of this
functionnality was not installed so I had to use 'man' (man
PDL::PP-Inline).

Greg






______________________________________________________________________ _____
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son
interface révolutionnaire.
http://fr.mail.yahoo.com



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl


cheers

Mark Pfeiffer
[EMAIL PROTECTED]





_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to