help-octave
[Top][All Lists]
Advanced

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

Re: Calling Octave from C++


From: Tatsuro MATSUOKA
Subject: Re: Calling Octave from C++
Date: Sat, 24 Mar 2018 07:47:59 +0900 (JST)

----- Original Message -----

> From: andrea.delbravo 
> To: help-octave
> Cc: 
> Date: 2018/3/23, Fri 19:28
> Subject: Re: Calling Octave from C++
> 
> Well, sorry for the nmissing infos.
> I wirk with Fedora 26 Ocatve 4.2.1. I tried also with Fedora 27 Octave 4.2.2
> but the problem persist.
> The application run perfectly under fedora 25 Octave 4.0.3.
> I minimize the application in order to focalize the problem:
> After several initialization the core of the problem is:
> 
> // THIS CODE IS WORKING
> int qq =10;
> int rr =15;
> in(0) = octave_value(qq);
> in(1) = octave_value(rr);
> octave_value_list out = feval ("gcd", in, 1);
> std::cout << out(0).int_value ()
> and it prints the correct result = 5 the Greatest common disisor between 10
> and 15

I execute the code on Octave-4.2.2 build myself on Ubuntu 16.04.
Octave hangs with Segmentation fault.
Segmentation fault

Thread 1 "test_01" received signal SIGSEGV, Segmentation fault.
0x00007ffff6e2996a in octave::application::interactive() ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4

bt

#0  0x00007ffff6e2996a in octave::application::interactive() ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#1  0x00007ffff78147a6 in octave_pager_buf::sync() ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#2  0x00007ffff571ce3e in std::ostream::flush() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff78151a6 in flush_octave_stdout() ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#4  0x00007ffff7550e2d in ?? ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#5  0x00007ffff75508c5 in ?? ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#6  0x00007ffff75509fe in ?? ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#7  0x00007ffff7550a57 in verror(char const*, __va_list_tag*) ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#8  0x00007ffff7550af9 in error(char const*, ...) ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#9  0x00007ffff73b4fb2 in feval(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&, octave_value_list 
const&, int) ()
   from /usr/lib/x86_64-linux-gnu/liboctinterp.so.4
#10 0x0000000000401920 in main () at test_01.cc:16

Perhaps bug.

However, new version octave 4.4 is coming soon.
I will test it on release candidate source afterwards. 

BTW.
Can you build octave by yourself?
I only use ubuntu as linux disro.
But on Fedora, octave can be built in similar way.

https://www.scivision.co/compiling-octave-4-on-ubuntu/

The above is guide of build octave on ubuntu, but is perhaps helpful build it 
on Fedora.
I also install portaudio in addition to the above instruction.   

Tatsuro





> 
> but if I run
> // THIS CODE IN NOT WORKING
> octave_value_list out = feval ("pp", in, 1);
> where pp.m is a stupid Octave script which shuld disply the two numbers
> (tested and working in the Octave environment)
> 
> Application crashes with Segmentation Fault insiede the interpreter, and I
> cannot debug it inside because the interpreter is not compiled with debug
> information
> 
> The OCTAVE_PATH environment variable define the path where the .m files are
> saved (see Octave manual for example version 4.4. March 2018 pag 17, but
> valid since a long time in all the Octave Version. I've been using it for at
> least 7 years
> 
> The OCTAVE_PATH variable is correctly seen inside the C++ cose. Ifact if I
> run the program with:
> 
> // THIS CODE IS WORKING
> in(0) = octave_value(a); // where a is a char[] = OCTAVE_PATH
> octave_value_list out = feval ("getenv", in, 1);   //getenv return the
> Evironmental Variable (see Octave manual)
> std::cout << out(0).string_value ()   // print the correct OCTAVE_PATH 
> value
> 
> It seems that is I use an embedded function i worke, but if I use  my own
> script it crashes
> 
> Thanks a lot in advance
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
>



reply via email to

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