Menu

octaviz makes octave 2.9.8 segfault

Help
Anonymous
2006-09-29
2013-04-22
  • Anonymous

    Anonymous - 2006-09-29

    Hi everybody,

    I am facing a segfault with octaviz running on top of octave version 2.9.8. As soon as I type some vtk_* command octave quits with the following error:

    octave:5> vtk_demo
    panic: Segmentation fault -- stopping myself...
    attempting to save variables to `octave-core'...
    error: octave_base_value::save_binary(): wrong type argument `vtk_object'
    save to `octave-core' complete
    Segmentation fault

    Does anyone have an idea about this problem ? I'm using VTK version 4.4.2 on Gentoo Linux with gcc 4.1.1. I would have loved to try with the cvs version of octaviz but It won't compile at the moment. I'll recheck that later...

    Thanks in advance,
    Reynald

    P.S: I also have a more octave specific problem as "all_va_args" is no more available with octave 2.9.8 (but it's available with 2.1.72). Any hints on this ? I'm gonna ask this on the octave mailing-list also.

     
    • Jonathan Stickel

      I am having this same segfault problem now with one of my two computers.  I am using octave 2.1.73, VTK 5, octaviz CVS (11/5/06), and gcc-4.1.1, also on a gentoo system.  The strange thing is it all works fine on my laptop.  I will see if I can get Dragan's attention to get help on this.  Jonathan.

       
    • Jonathan Stickel

      I found the problem; there was a leftover liboctaviz.so file installed from a previous install.  Apparantly it conflicted with the more recently compiled version, and deleting it solved the problem.  Jonathan

       
    • flapique

      flapique - 2006-12-05

      I am facing a segfault with octaviz running on top of octave version 2.9.9 ? I'm using VTK version  5.0 on RHE 4.0.
      Thanks in advance,
      Francis

       
    • dave

      dave - 2006-12-21

      Hello Everyone,

      I have spent the past day working with vtk and octaviz. I am excited about the possibilities of octaviz, but am continually frustrated with getting it to work.

      I have downloaded the latest CVS and encountered many of the problems people are having recently:

      1) I am using vtk-5.0.2 - I fixed the paths in one of the cmake files so they don't point to the "build" path.

      2) I am using octave 2.9.9, the latest version.

      3) I fixed the uintptr_t reference in octaviz.cc

      4) The compiler complains about hundreds of missing functions in vtk. This turns out to because there are many VTK_LEGACY calls that I presume are referenced some how? In any case, octaviz compiles fine with vtk-5.0.2 after including the legacy calls from the headers in /usr/include/vtk-5.0

      5) Now there is a strange problem when calling most of the vtk_* functions from within octave. vtk_init seems to work fine, and vtk_demo_old_syntax works fine, but all of the other functions cause octave to segfault. This is a fresh install, so there is no leftover liboctaviz.so as mentioned earlier.

      6) I don't understand what it is about the "new syntax" that causes the latest version of octave to crash, while the "old syntax" seems to work fine.

      7) Is there a work-around for this, or an easy way to make everything use the "old syntax"?

      Thanks for your help.

      Dave

       
      • Dragan Tubic

        Dragan Tubic - 2006-12-21

        5) Now there is a strange problem when calling most of the vtk_* functions from within octave. vtk_init seems to work fine, and vtk_demo_old_syntax works fine, but all of the other functions cause octave to segfault. This is a fresh install, so there is no leftover liboctaviz.so as mentioned earlier.

        There is a problem related to the new way octave references objects so the new syntax doesn't work. I fixed the problem but it is not in CVS yet (there are other changes I want to make first). If you wish to test it I'll post the patch.

        Dragan

         
    • dave

      dave - 2006-12-21

      Thank you much for you help.

      I would certainly be willing to test a patch.

      Dave
      *:^)

       
    • Dragan Tubic

      Dragan Tubic - 2006-12-22

      Here's the solution:

      replace the function octave_value_list vtk_object::subsref in octaviz.cc with this one.

      Dragan

      octave_value_list vtk_object::subsref (const std::string SUBSREF_STRREF type,
                                             const LIST<octave_value_list>& idx,
                                             int nargout)
      {
          octave_value_list retval;
          size_t skip = 1;

          switch (type[0])
          {
          case '.':
          {
              std::string class_name = vtk_pointer->GetClassName();
              octave_value_list args;
              // I don't thik it is logical to initialize the reference caounter in octave_value_base
              // to 1 and not to increase it whenever an octave_value is created using it. I guess there is
              // a reason behind it so we will increase the counter here and there as needed.
              count++;
              args(0) = octave_value( this );
              args(1) = idx.front()(0).string_value();
              if (idx.LISTSIZE () < 2 || type[1] != '(')
              {
                  octave_value res;
                  retval = feval(class_name,args,nargout);
              }
              else
              {
                  skip = 2;
                  LIST<octave_value_list>::const_iterator pidx = idx.begin();
                  octave_value_list args;
                  count++;
                  args(0) = octave_value( this );
                  args(1) = (*pidx)(0).string_value ();
                  pidx++;
                  int n = args.length ();
                  for ( int i = 0; i < (*pidx).length (); i++ ) args(i+2) = (*pidx)(i);

                  if (any_arg_is_magic_colon (*pidx))
                  {
                      error ("invalid use of colon in method argument list");
                  }
                  else
                  {
                      retval = feval(class_name,args,nargout);
                  }
              }
          }
          break;
          case '(':
          case '{':
          {
              std::string nm = type_name ();
          }
          break;

          default:
              panic_impossible ();
          }

          if (!error_state && idx.LISTSIZE () > skip)
              retval = retval(0).next_subsref (type, idx, skip);

          return retval;
      }

       
    • dave

      dave - 2006-12-22

      Sorry, the patch did not change the behavior. Old syntanx works, and the new does not.

      Here is a trace from gdb

      Dave
      *:^)

      GNU Octave, version 2.9.9 (i686-redhat-linux-gnu).
      Copyright (C) 2006 John W. Eaton.
      This is free software; see the source code for copying conditions.
      There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or
      FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

      Additional information about Octave is available at http://www.octave.org.

      Please contribute if you find this software useful.
      For more information, visit http://www.octave.org/help-wanted.html

      Report bugs to <bug@octave.org> (but first, please read
      http://www.octave.org/bugs.html to learn how to write a helpful report).

      (no debugging symbols found)
      (no debugging symbols found)
      (no debugging symbols found)
      (no debugging symbols found)
      (no debugging symbols found)
      octave:1> vtk_demo

      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread -1209084208 (LWP 3828)]
      0x00000000 in ?? ()
      (gdb) where
      #0  0x00000000 in ?? ()
      #1  0x4c5a42a4 in octave_value::~octave_value ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #2  0x4c38230c in std::vector<octave_value, std::allocator<octave_value> >::_M_fill_insert () from /usr/lib/octave-2.9.9/liboctinterp.so
      #3  0x4c40de96 in octave_value_list::resize ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #4  0x4c36724d in octave_value_list::elem ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #5  0x007cb4aa in octave_value_list::operator() ()
         from /usr/lib/octave-2.9.9/liboctaviz.so
      #6  0x007c5ce8 in vtk_object::subsref ()
         from /usr/lib/octave-2.9.9/liboctaviz.so
      #7  0x4c5a5e67 in octave_value::subsref ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #8  0x4c6eb007 in tree_index_expression::rvalue ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #9  0x4c708394 in tree_statement::eval ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #10 0x4c708827 in tree_statement_list::eval ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #11 0x4c5f865b in octave_user_function::do_multi_index_op ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      ---Type <return> to continue, or q <return> to quit---
      #12 0x4c5a4329 in octave_value::do_multi_index_op ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #13 0x4c6e4826 in tree_identifier::rvalue ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #14 0x4c708394 in tree_statement::eval ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #15 0x4c708827 in tree_statement_list::eval ()
         from /usr/lib/octave-2.9.9/liboctinterp.so
      #16 0x4c508c96 in main_loop () from /usr/lib/octave-2.9.9/liboctinterp.so
      #17 0x4c490afc in octave_main () from /usr/lib/octave-2.9.9/liboctinterp.so
      #18 0x0804869a in main ()
      (gdb)

       
    • dave

      dave - 2006-12-22

      Whoops,

      Things don't get cleaned up very well with "make clean"

      Deleting everything and doing a fresh install, now it works!

      Thanks much...

      Dave
      *:^)

       
      • Dragan Tubic

        Dragan Tubic - 2006-12-22

        I'm glad it worked for you. You'll have problems with all_va_args but I can't help you there yet.

        Dragan

         
    • dave

      dave - 2006-12-23

      Yes, I do have problems with "all_va_args". Any suggestions where to start or work arounds? vtk_plot is a pretty important function for me.

      There are also a few other problems.

      1) VTK_DATA_ROOT = vtkGetDataRoot();
        This call returns the wrong directory. I assume this is a vtk problem.

      2) Many symbols are undefined, and cause octave to crash. e.g.:
        octave:2> vtk_title("test");
        octave: symbol lookup error: /usr/libexec/octave/2.9.9/site/oct/i686-redhat-linux-gnu/octaviz/vtkViewport.oct: undefined symbol: _ZN11vtkViewport8GetPropsEv
        [dave@quick ~]$

        This may be related to the legacy functions not really being present in vtk 5.0.2? I remember another post about this, I will try some of the suggestions.

      3) When goofing off with some of the examples, sometimes the octave window becomes unresponsive to key presses. I can't reliably reproduce this.

      Dave
      *:^)

       
      • Dragan Tubic

        Dragan Tubic - 2006-12-23

        Yes, I do have problems with "all_va_args". Any suggestions where to start or work arounds?

        It is actually trivial to fix: just replace  all_va_args with varargin wherever it appears in octaviz scripts.

        1. VTK_DATA_ROOT is hardcoded in vtkGetDataRoot() you can fix it manually.

        2. I don't know what it could be. Make sure that that you have no leftovers from previous installations of VTK/octave/octaviz

         
    • dave

      dave - 2006-12-24

      Replacing "all_va_args" with "varargin" causes the following errors:

      octave:9> [u,v] = meshgrid(0.01:pi/20:pi,0:pi/20:2*pi);
      octave:10> x = ( 1 - cos(u) ) .* cos( u + 2*pi/3 ) .* cos( v + 2*pi/3 ) / 2;
      octave:11> y = ( 1 - cos(u) ) .* cos( u + 2*pi/3 ) .* cos( v - 2*pi/3 ) / 2;
      octave:12> z = cos( u - 2*pi/3 );
      octave:13> vtk_mesh(x,y,z,'Fancy',1);
      error: `x' undefined near line 74 column 20
      error: evaluating argument list element number 1
      error: called from `vtk_mesh' in file `/usr/share/octave/2.9.9/site/m/octaviz/vtk_mesh.m'
      octave:13>

      It doesn't look like the arguments are getting parsed correctly.

      Dave
      *:^)

       
      • Dragan Tubic

        Dragan Tubic - 2006-12-24

        It should be "varargin{:}"

        Dragan

         
    • mickaelparis

      mickaelparis - 2007-06-14

      Hi,

      I'm sorry if I don't post inside the good thread. But I've got the same problem with octave 2.9.12/VTK 5.0.3/  Octaviz-0.4.6 :

      #####
      For information about changes from previous versions, type `news'.

      octave:1> sisc212h27
      octave:2> vtk_surf(Heightd);
      error: /usr/libexec/octave/2.9.12/site/oct/i686-pc-linux-gnu/octaviz/vtk_init.oct: undefined symbol: _ZTV12octave_value
      error: called from `vtk_trisurf' in file `/usr/share/octave/2.9.12/site/m/octaviz/vtk_trisurf.m'
      error: evaluating assignment expression near line 91, column 6
      error: evaluating if command near line 88, column 3

      #####

      so I tried with an other equation and graphic solver :

      ####

      octave:2> [u,v] = meshgrid(0.01:pi/20:pi,0:pi/20:2*pi);
      octave:3> x = ( 1 - cos(u) ) .* cos( u + 2*pi/3 ) .* cos( v + 2*pi/3 ) / 2;
      octave:4> y = ( 1 - cos(u) ) .* cos( u + 2*pi/3 ) .* cos( v - 2*pi/3 ) / 2;
      octave:5> z = cos( u - 2*pi/3 );
      octave:6> vtk_mesh(x,y,z,'Fancy',1);
      error: /usr/libexec/octave/2.9.12/site/oct/i686-pc-linux-gnu/octaviz/vtk_init.oct: undefined symbol: _ZTV12octave_value
      error: called from `vtk_trimesh' in file `/usr/share/octave/2.9.12/site/m/octaviz/vtk_trimesh.m'
      error: evaluating assignment expression near line 88, column 6
      error: evaluating if command near line 87, column 3
      error: called from `vtk_mesh' in file `/usr/share/octave/2.9.12/site/m/octaviz/vtk_mesh.m'
      octave:6>

      ####

      and I ve got the same error.
      I'don't know how to resolve this problem, so thanks in advance for your help.

      Mickael.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.