texmacs / octave

Octave plugin for GNU TeXmacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

walwan opened this issue · comments

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

  • Without fltk or gnuplot installed on the system. By default, octave will use qt as the plot engine.
  • Open TeXmaxs, open an octave session, execuate any command

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

  • Use "octave --no-gui" as the command to create a new octave instance.
  • Install fltk or gnuplot package

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.

commented

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))))

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!

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

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.