help-octave
[Top][All Lists]
Advanced

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

Re: liboctave crash


From: bob
Subject: Re: liboctave crash
Date: Sat, 28 Jul 2012 01:33:10 +0530


On Jul 27, 2012 10:23 PM, "Juan Pablo Carbajal" <address@hidden> wrote:
>
> On Fri, Jul 27, 2012 at 6:39 PM, Juan Pablo Carbajal
> <address@hidden> wrote:
> > On Fri, Jul 27, 2012 at 4:19 PM, bob <address@hidden> wrote:
> >>
> >> On Jul 27, 2012 7:35 PM, "Andy Buckle" <address@hidden> wrote:
> >>>
> >>>
> >>>
> >>> On 27 July 2012 14:58, Juan Pablo Carbajal <address@hidden> wrote:
> >>>>
> >>>> On Fri, Jul 27, 2012 at 1:38 PM, bob <address@hidden> wrote:
> >>>> > Hi,
> >>>> >
> >>>> > I am trying to run this small code:
> >>>> >
> >>>> > #include <iostream>
> >>>> > #include <octave/oct.h>
> >>>> >
> >>>> > using namespace std;
> >>>> >
> >>>> > int main()  {
> >>>> >     ComplexMatrix A = ComplexMatrix(2,2);
> >>>> >     return 0;
> >>>> > }
> >>>> >
> >>>> > Using octave-3.6.2 (MinGW), I am able to build the file. But when I run
> >>>> > it,
> >>>> > I get a seg-fault:
> >>>> >
> >>>> > Program received signal SIGSEGV, Segmentation fault.
> >>>> > In libstdc++-6!_ZNKSs7_M_dataEv () (C:\MinGW\bin\libstdc++-6.dll)
> >>>> >
> >>>> > Even using:
> >>>> >
> >>>> > mkoctfile --link-stand-alone <file>
> >>>> >
> >>>> > I get the same crash.
> >>>> >
> >>>> > System: WinXP SP2 (32bit), Core 2 Duo
> >>>> >
> >>>> > Any help ?
> >>>> > --
> >>>> > bob
> >>>> >
> >>>> > _______________________________________________
> >>>> > Help-octave mailing list
> >>>> > address@hidden
> >>>> > https://mailman.cae.wisc.edu/listinfo/help-octave
> >>>> >
> >>>>
> >>>> You have tu use the dynamically loaded function macro. This is an
> >>>> example form the manual
> >>>>
> >>>> http://www.gnu.org/software/octave/doc/interpreter/Getting-Started-with-Oct_002dFiles.html
> >>>>
> >>>> #include <octave/oct.h>
> >>>>
> >>>>      DEFUN_DLD (helloworld, args, nargout,
> >>>>        "Hello World Help String")
> >>>>      {
> >>>>        int nargin = args.length ();
> >>>>        octave_stdout << "Hello World has " << nargin
> >>>>              << " input arguments and "
> >>>>              << nargout << " output arguments.\n";
> >>>>        return octave_value_list ();
> >>>>      }
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> M. Sc. Juan Pablo Carbajal
> >>>
> >>>
> >>> If an oct-file function is required, then you have to use the macro. It
> >>> looks like bob is trying to create something to be called from outside
> >>> Octave.
> >>
> >> Exactly. I am trying to create:
> >>
> >> 1. A standalone executable using octave functions.
> >> 2. A DLL binary also using octave functions.
> >>
> >>>
> >>> --
> >>> /* andy buckle */
> >
> > Tried in Ubuntu 12.04 64bits
> >
> > $ mkoctfile --link-stand-alone -pthread  -L<path to liboctave> func.cc
> > $ ./a.out
> > ./a.out: error while loading shared libraries: liboctave.so.1: cannot
> > open shared object file: No such file or directory
> >
> > Any clues why it doesn't run or how to fix it?
> >
> >
> >
> > --
> > M. Sc. Juan Pablo Carbajal
> > -----
> > PhD Student
> > University of Zürich
> > http://ailab.ifi.uzh.ch/carbajal/
>
> Thanks to: jwe.
>
> In Ubuntu, definig the variable
>
> export LD_LIBRARY_PATH=<path-to-liboctave.so.1>
>
> Solves the problem and. Compiling with
>
> mkoctfile --link-stand-alone -pthread func.cc
>
> works perfectly and the program runs.
>

Thanks ! It does compile to a standalone in Ubuntu now. But how do I create a shared library ?
I tried using gcc with only liboctinterp.so, liboctave.so and libcruft.so. The library compiles fine but on loading it, I get an unknown symbol error. 

To get the exact compile and linker options, I ran mkoctfile in verbose mode:

mkoctfile --link-stand-alone main.cpp -v

From the output, the g++ command for linking the .o file is:

g++ -I/usr/include/octave-3.2.4 -I/usr/include/octave-3.2.4/octave -I/usr/include/mpi -mieee-fp -I/usr/include/freetype2 -O2 -g -rdynamic -fPIC -Wl,-Bsymbolic-functions -Wl,-z,relro main.o -L/usr/lib/octave-3.2.4 -Wl,-rpath -Wl,/usr/lib/octave-3.2.4 -loctinterp -loctave -lcruft -llapack -lblas -lfftw3 -lfftw3f -lreadline -lreadline -lncurses -ldl -lhdf5 -lz -lm -lgfortranbegin -lgfortran

Just prepending -shared to the above and running doesn't make a shared lib. So i guess something else needs to go from the above command. Any suggestions ?

> You crash may be windows related.

Maybe. I will try it in a couple  of more windows ;).

>
>
>
> --
> M. Sc. Juan Pablo Carbajal
> -----
> PhD Student
> University of Zürich
> http://ailab.ifi.uzh.ch/carbajal/


reply via email to

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