TLDR;
I want to run octave code in the terminal without any GUI but am facing a ELF header error.
Full question;
I am trying to run a basic octave script as can be seen here which is saved as a file named testing.oct
x = 5
% This is just some silly comment to make minimum length.
But, when I punch octave testing.oct
into my command line which is already in that directory with that file, I get the following error
error: /home/user/programs/junk/testing.oct: failed to load: /home/user/programs/junk/testing.oct: invalid ELF header
Running cat testing.oct
verifies that I am loading the file I intend to.
I am running Ubuntu 18.04 which I just updated to from 16.04. According to octave --version
I am using 4.2.2 . I
I have previously (in 16.04) used octave in this fashion with "command window" output appearing in my terminal, and plot/figure functions throwing up as small windows that wait patiently for you to close them so that execution may continue.
I have already tried following the advice contained here to repair my octave install in case that was the problem, but this did not correct my issue.
Loading the octave GUI and putting the script into the Command Window throws the same error.
Any information which can help me use octave from the command line in this way would be greatly appreciated.
Edit 1:
In response to a comment requesting apt-cache policy octave
:
octave:
Installed: 4.2.2-1ubuntu1
Candidate: 4.2.2-1ubuntu1
Version table:
*** 4.2.2-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
100 /var/lib/dpkg/status
Edit 2:
In response to a comment requesting dpkg -l | grep octave
:
ii liboctave4:amd64 4.2.2-1ubuntu1 amd64 shared libraries of the GNU Octave language
ii octave 4.2.2-1ubuntu1 amd64 GNU Octave language for numerical computations
ii octave-common 4.2.2-1ubuntu1 all architecture-independent files for octave
ii octave-doc 4.2.2-1ubuntu1 all documentation of the GNU Octave language
apt-cache policy octave
anddpkg -l | grep octave
to the question.echo "x = 5" > testing.oct; octave testing.oct
on my 18.04 LTS I get other error message - "error: /tmp/testing.oct: failed to load: /tmp/testing.oct: file too short
". On 16.04 LTS the command runs without issues. So I can't understand what is going on :)ldd /usr/lib/x86_64-linux-gnu/liboctave.so.4.0.0 /usr/lib/x86_64-linux-gnu/liboctinterp.so.4.0.0 /usr/lib/x86_64-linux-gnu/octave/4.2.2/liboctgui.so.2.0.0 /usr/bin/octave /usr/bin/octave-cli | grep -E "local|not"
. It is possible that you have some unexpected overrides.