[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing a matrix to a fortran subroutine

From: lash
Subject: Re: passing a matrix to a fortran subroutine
Date: Wed, 15 Jul 1998 14:50:39 -0500 (CDT)

> ----------
> >From: Michael J Ursiak <address@hidden>
> >To: address@hidden
> >Subject: passing a matrix to a fortran subroutine
> >Date: Wed, Jul 15, 1998, 1:12 PM
> >extern "C"
> >{
> >  int F77_FCN (xstuff, XSTUFF) ( int&,int&,double*,int&);
> >}
> >
> >
> >I get the following error when I try to execute this newvd in octave:
> >
> >octave:2> y = newsvd(h)
> > octave: fatal: relocation error: symbol not found: __f_open_nv:
> >referenced in /a/kenner/lime/homes/ursiak/octave/newstuff/newsvd.oct
> >Killed
> I haven't seen this particular error, but here's some things I had to do
> to get my .oct files working:
> (1) Make sure gcc was compiled with --enable-shared.
> (2) Run mkoctfile with sources, not object files, e.g.
>     mkoctfile xstuff.f
>   not
>     f77 -c xstuff.f
>     mkoctfile xstuff.o
> (3) Make sure your LD_LIBRARY_PATH points to your octave libs.  If you
>     configured octave with --prefix=prefix_dir, then LD_LIBRARY_PATH
>     should include prefix_dir/lib/octave-2.x.x (your version here)
> Hope this helps.

I am having a similar problem with octave 2.0.13 under solaris 2.5.1 (SunOS 

I wrote a c++ routine to do the inner loop of a routine that calculates
tvar (time variance).  My first problem was that mkoctfile would dump core
if I left it as it was, using g++ to do the linking.  If I changed it to 
use gcc or ld, the .oct file would get generated, but when I tried to use
it (or even do a which tvar_oct) octave would report:

error: octave: fatal: relocation error: symbol not found: 
 referenced in /home/tellabx-5/lash/tdv/tvar_oct.oct: 
/home/tellabx-5/lash/tdv/tvar_oct.oct `FStvar_oct__Fv'

I had assumed that this was due to our tools group not installing gcc correctly
(they have recently gone to egcs). Is there any easy way to check if they
compiled gcc with --enable-shared?  I compiled octave with this compiler and
doing an ldd on it shows:

sunl10% ldd ~/progs/octave/bin/octave =>     /usr/lib/ =>    /usr/lib/ =>        /usr/lib/ =>     /usr/lib/ =>   /usr/lib/ =>  /usr/lib/ =>    /usr/lib/ =>     /usr/lib/

Which makes me believe that it can handle shared libraries.  I do notice that
we don't have a shared version of libstdc++ which is where 

is defined. (Don't you just love that C++ name mangling!!!).  This symbol
does also appear to be in the octave executable file though.

I also made sure that LD_LIBRARY_PATH included the octave library directory,
and the same problems occur. (Just tried that, thanks for the tip.)

Anyway, if anyone has any thoughts about what might be wrong, I would
appreciate it.  I've attatched the c++ file that I am using below, but
the same problems occure with the example files (, etc.)

Bill Lash
#include <octave/oct.h>

DEFUN_DLD (tvar_oct,args,,"TVAR: tvar for particular observation interval n")
        double retval;
        ColumnVector arg_samples;
        int  arg_N;
        int  arg_n;
        double inner;
        int j;
        int i;

        int nargin = args.length ();
        retval = 0.0;
        if (nargin !=3)
                return retval;

        arg_samples = args(0).vector_value ();
        arg_N = NINT(args(1).double_value ());
        arg_n = NINT(args(2).double_value ());


                inner = 0.0;

                retval += inner * inner;
        retval = retval /(6.0*(arg_N-3*arg_n+1)*arg_n*arg_n);
        return retval;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]