texmacs / octave

Octave plugin for GNU TeXmacs
6 stars 2 forks source link

Octave session error due to "octave-cli" not recognizing "qt" as a plot toolkit on Linux #3

Open walwan opened 3 years ago

walwan commented 3 years ago

Problem description

In an octave sesion, when executing a (any) command, throw an error:

error: feval: /usr/lib/octave/5.2.0/oct/x86_64-pc-linux-gnu/__init_fltk__.oct: failed to load: libfltk_gl.so.1.3: cannot open shared object file: No such file or directory error: called from graphics_toolkit at line 91 column 5 figure at line 91 column 7 gcf at line 63 column 9 tmrepl at line 41 column 21 ~/.TeXmacs/plugins/octave/octave/tmstart.m at line 47 column 1 warning: gh_manager::do_close_all_figures: some graphics elements failed to close.

Problem reproduction

Problem attribution

From /octave/progs/init-octave.scm, it seems that the command to open a new octave instance is "octave-cli". I tried to execute "available_graphics_toolkits", the result is

ans = { [1,1] = fltk }.

Also, the result of command "graphics_toolkit" in octave is

ans = fltk.

After I searched for any similar issue, I found this. Perhaps it's because octave-cli does not recognize "qt" as a plot toolkit.

Possible solution

walwan commented 3 years ago

I don't know how to write a plugin, so I cannot fix it by modifing the code and giving a pr. Sorry for that.

mgubi commented 3 years ago

Maybe you can try to modify /octave/octave/tmstart.m to set up the right gui. If this is too late, then it is enough to modify the invocation of octave in /octave/progs/init-octave.scm, try to make it look like

(define (octave-launcher)
  (with boot (string-append "\"" (octave-source-path) "/tmstart.m\"")
    (if (url-exists-in-path? "octave-cli")
        (string-append "octave-cli  --no-gui -qi " boot)
        (string-append "octave-octave-app  --no-gui -qi " boot))))
walwan commented 3 years ago

Maybe you can try to modify /octave/octave/tmstart.m to set up the right gui. If this is too late, then it is enough to modify the invocation of octave in /octave/progs/init-octave.scm, try to make it look like

(define (octave-launcher)
  (with boot (string-append "\"" (octave-source-path) "/tmstart.m\"")
    (if (url-exists-in-path? "octave-cli")
        (string-append "octave-cli  --no-gui -qi " boot)
        (string-append "octave-octave-app  --no-gui -qi " boot))))

Thank you! Just a notice: The key is to replace "octave-cli" (probably linked without qt) with "octave" (linked with qt), while passing an argument "--no-gui". So, it should be

    (string-append "octave  --no-gui -qi " boot).

Thank again for your timely reply!

walwan commented 3 years ago

I don't know whether this should be added to the code, but I will test it and give some feedbacks here.

walwan commented 3 years ago

Test result: On 5.8.18-1-MANJARO, all commands given in the demo part in the plugin manual work as expected. One thing to mention, a window will flash after running the first command.