4

I installed Octave 3.8.1 a few months ago and discovered that the GNU readline was not working properly. I tried reinstalling Octave 3.8.0, but the GNU readline does not work for the previous version now. GNU readline was working properly for Octave 3.8.0 before I installed 3.8.1 . I tried installing GNU readline and ncursers, but sudo Make does not recognize readline and ncursers exists.

/usr/local/lib/libreadline.so.6: undefined reference to `tgetstr'
/usr/local/lib/libreadline.so.6: undefined reference to `tputs'
/usr/local/lib/libreadline.so.6: undefined reference to `BC'
/usr/local/lib/libreadline.so.6: undefined reference to `tgetent'
/usr/local/lib/libreadline.so.6: undefined reference to `tgetflag'
/usr/local/lib/libreadline.so.6: undefined reference to `tgoto'
/usr/local/lib/libreadline.so.6: undefined reference to `UP'
/usr/local/lib/libreadline.so.6: undefined reference to `tgetnum'
/usr/local/lib/libreadline.so.6: undefined reference to `PC'
collect2: ld returned 1 exit status
make[2]: *** [octave-cli] Error 1
make[2]: Leaving directory `/home/gin/Downloads/octave-3.8.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/gin/Downloads/octave-3.8.0'
make: *** [all] Error 2

Below are my synaptic packages of readline installed on my computer. readline Below are my synaptic packages of ncursers installed on my computer. ncursers

Has anyone been able to resolve this problem? Thanks.

Below is the directory for where my readline files are located.

@:/usr/local/lib$ ls
libhistory.a           libpcreposix.a            libreadline.so.6.3.old
libhistory.old         libpcreposix.la           libSDL2-2.0.so.0
libhistory.so          libpcreposix.so           libSDL2-2.0.so.0.1.0
libhistory.so.6        libpcreposix.so.0         libSDL2.a
libhistory.so.6.3      libpcreposix.so.0.0.2     libSDL2.la
libhistory.so.6.3.old  libpcre.so                libSDL2main.a
liblua.a               libpcre.so.1              libSDL2.so
libpcre.a              libpcre.so.1.2.2          libSDL2_test.a
libpcrecpp.a           libreadline.a             lua
libpcrecpp.la          libreadline.old           octave
libpcrecpp.so          libreadline_problem.so.6  pkgconfig
libpcrecpp.so.0        libreadline.so            python2.7
libpcrecpp.so.0.0.0    libreadline.so.6          vmd
libpcre.la             libreadline.so.6.3

I tried bain's solution. I received the following installation errors.

$ sudo find /usr/local -name '*octave*' -exec rm -f {} \;
rm: cannot remove `/usr/local/include/octave-3.8.0': Is a directory
rm: cannot remove `/usr/local/include/octave-3.8.0/octave': Is a directory
rm: cannot remove `/usr/local/include/octave-3.8.1': Is a directory
rm: cannot remove `/usr/local/include/octave-3.8.1/octave': Is a directory
rm: cannot remove `/usr/local/libexec/octave': Is a directory
rm: cannot remove `/usr/local/lib/octave': Is a directory
rm: cannot remove `/usr/local/share/octave': Is a directory
rm: cannot remove `/usr/local/share/octave/3.8.1/etc/tests/liboctave': Is a directory
rm: cannot remove `/usr/local/share/octave/3.8.1/etc/tests/libinterp/octave-value': Is a directory
rm: cannot remove `/usr/local/share/octave/3.8.0/etc/tests/liboctave': Is a directory
rm: cannot remove `/usr/local/share/octave/3.8.0/etc/tests/libinterp/octave-value': Is a directory

$ sudo apt-get install octave
...
Errors were encountered while processing:
 octave
E: Sub-process /usr/bin/dpkg returned an error code (1)

Third Image Third Image

Fourth Image Fourth Image

Below is the readline.so.6 being recreated during the purge-install process for octave

$:/usr/local/lib$ ls
libhistory.a           libpcrecpp.a         libpcreposix.so        libreadline.so          libSDL2main.a
libhistory.old         libpcrecpp.la        libpcreposix.so.0      libreadline.so.6        libSDL2.so
libhistory.so          libpcrecpp.so        libpcreposix.so.0.0.2  libreadline.so.6.3      libSDL2_test.a
libhistory.so.6        libpcrecpp.so.0      libpcre.so             libreadline.so.6.3.old  lua
libhistory.so.6.3      libpcrecpp.so.0.0.0  libpcre.so.1           libSDL2-2.0.so.0        pkgconfig
libhistory.so.6.3.old  libpcre.la           libpcre.so.1.2.2       libSDL2-2.0.so.0.1.0    python2.7
liblua.a               libpcreposix.a       libreadline.a          libSDL2.a               vmd
libpcre.a              libpcreposix.la      libreadline.old        libSDL2.la
$:/usr/local/lib$ sudo rm /usr/local/lib/libreadline.so.6
$:/usr/local/lib$ ls
libhistory.a           libpcrecpp.a         libpcreposix.so        libreadline.so          libSDL2.so
libhistory.old         libpcrecpp.la        libpcreposix.so.0      libreadline.so.6.3      libSDL2_test.a
libhistory.so          libpcrecpp.so        libpcreposix.so.0.0.2  libreadline.so.6.3.old  lua
libhistory.so.6        libpcrecpp.so.0      libpcre.so             libSDL2-2.0.so.0        pkgconfig
libhistory.so.6.3      libpcrecpp.so.0.0.0  libpcre.so.1           libSDL2-2.0.so.0.1.0    python2.7
libhistory.so.6.3.old  libpcre.la           libpcre.so.1.2.2       libSDL2.a               vmd
liblua.a               libpcreposix.a       libreadline.a          libSDL2.la
libpcre.a              libpcreposix.la      libreadline.old        libSDL2main.a
$:/usr/local/lib$ sudo apt-get purge '.*octave.*'
$:/usr/local/lib$ ls
libhistory.a           libpcrecpp.a         libpcreposix.so        libreadline.so          libSDL2main.a
libhistory.old         libpcrecpp.la        libpcreposix.so.0      libreadline.so.6        libSDL2.so
libhistory.so          libpcrecpp.so        libpcreposix.so.0.0.2  libreadline.so.6.3      libSDL2_test.a
libhistory.so.6        libpcrecpp.so.0      libpcre.so             libreadline.so.6.3.old  lua
libhistory.so.6.3      libpcrecpp.so.0.0.0  libpcre.so.1           libSDL2-2.0.so.0        pkgconfig
libhistory.so.6.3.old  libpcre.la           libpcre.so.1.2.2       libSDL2-2.0.so.0.1.0    python2.7
liblua.a               libpcreposix.a       libreadline.a          libSDL2.a               vmd
libpcre.a              libpcreposix.la      libreadline.old        libSDL2.la
$:/usr/local/lib$ sudo rm /usr/local/lib/libreadline.so.6
$:/usr/local/lib$ ls
libhistory.a           libpcrecpp.a         libpcreposix.so        libreadline.so          libSDL2.so
libhistory.old         libpcrecpp.la        libpcreposix.so.0      libreadline.so.6.3      libSDL2_test.a
libhistory.so          libpcrecpp.so        libpcreposix.so.0.0.2  libreadline.so.6.3.old  lua
libhistory.so.6        libpcrecpp.so.0      libpcre.so             libSDL2-2.0.so.0        pkgconfig
libhistory.so.6.3      libpcrecpp.so.0.0.0  libpcre.so.1           libSDL2-2.0.so.0.1.0    python2.7
libhistory.so.6.3.old  libpcre.la           libpcre.so.1.2.2       libSDL2.a               vmd
liblua.a               libpcreposix.a       libreadline.a          libSDL2.la
libpcre.a              libpcreposix.la      libreadline.old        libSDL2main.a
$:/usr/local/lib$ sudo apt-get install octave
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  units rtkit conky-std libpulsedsp libgsl0ldbl pulseaudio-utils
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  liboctave2 octave-common
Suggested packages:
  octave-info octave-doc octave-htmldoc
The following NEW packages will be installed:
  liboctave2 octave octave-common
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/12.3 MB of archives.
After this operation, 43.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
WARNING: The following packages cannot be authenticated!
  liboctave2 octave-common octave
Install these packages without verification [y/N]? y
Selecting previously unselected package liboctave2.
(Reading database ... 368749 files and directories currently installed.)
Unpacking liboctave2 (from .../liboctave2_3.8.1-1ubuntu1~octave1~precise1_amd64.deb) ...
Selecting previously unselected package octave-common.
Unpacking octave-common (from .../octave-common_3.8.1-1ubuntu1~octave1~precise1_all.deb) ...
Selecting previously unselected package octave.
Unpacking octave (from .../octave_3.8.1-1ubuntu1~octave1~precise1_amd64.deb) ...
Processing triggers for menu ...
Processing triggers for desktop-file-utils ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for gnome-menus ...
Processing triggers for man-db ...
Setting up liboctave2 (3.8.1-1ubuntu1~octave1~precise1) ...
Setting up octave-common (3.8.1-1ubuntu1~octave1~precise1) ...
Setting up octave (3.8.1-1ubuntu1~octave1~precise1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for menu ...
$:/usr/local/lib$ octave
/usr/bin/octave-cli: symbol lookup error: /usr/local/lib/libreadline.so.6: undefined symbol: UP
$:/usr/local/lib$ ls
libhistory.a           libpcrecpp.a         libpcreposix.so        libreadline.so          libSDL2main.a
libhistory.old         libpcrecpp.la        libpcreposix.so.0      libreadline.so.6        libSDL2.so
libhistory.so          libpcrecpp.so        libpcreposix.so.0.0.2  libreadline.so.6.3      libSDL2_test.a
libhistory.so.6        libpcrecpp.so.0      libpcre.so             libreadline.so.6.3.old  lua
libhistory.so.6.3      libpcrecpp.so.0.0.0  libpcre.so.1           libSDL2-2.0.so.0        pkgconfig
libhistory.so.6.3.old  libpcre.la           libpcre.so.1.2.2       libSDL2-2.0.so.0.1.0    python2.7
liblua.a               libpcreposix.a       libreadline.a          libSDL2.a               vmd
libpcre.a              libpcreposix.la      libreadline.old        libSDL2.la
$:/usr/local/lib$ 

The following below is bain's suggested commands since 5/9/2014 :

$ sudo ppa-purge ppa:octave/stable
Updating packages lists
W: GPG error: http://us.archive.ubuntu.com precise Release: Unknown error executing gpgv
W: GPG error: http://repo.steampowered.com precise Release: Unknown error executing gpgv
W: GPG error: http://dl.google.com stable Release: Unknown error executing gpgv
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://us.archive.ubuntu.com precise-updates Release: Unknown error executing gpgv

W: GPG error: http://us.archive.ubuntu.com precise-backports Release: Unknown error executing gpgv
W: GPG error: http://packages.mate-desktop.org precise Release: Unknown error executing gpgv
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://security.ubuntu.com precise-security Release: Unknown error executing gpgv

W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com precise Release: Unknown error executing gpgv

W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: GPG error: http://deb.playonlinux.com maverick Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/Release  

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release  

W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release  

W: Some index files failed to download. They have been ignored, or old ones used instead.
PPA to be removed: octave stable
comm: file 2 is not in sorted order
Package revert list generated:
 liboctave2/precise octave/precise octave-common/precise

Disabling octave PPA from /etc/apt/sources.list
Updating packages lists
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://security.ubuntu.com precise-security Release: Unknown error executing gpgv

W: GPG error: http://repo.steampowered.com precise Release: Unknown error executing gpgv
W: GPG error: http://dl.google.com stable Release: Unknown error executing gpgv
W: GPG error: http://us.archive.ubuntu.com precise Release: Unknown error executing gpgv
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://us.archive.ubuntu.com precise-updates Release: Unknown error executing gpgv

W: GPG error: http://us.archive.ubuntu.com precise-backports Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com precise Release: Unknown error executing gpgv

W: GPG error: http://deb.playonlinux.com maverick Release: Unknown error executing gpgv
W: GPG error: http://packages.mate-desktop.org precise Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: GPG error: http://ppa.launchpad.net precise Release: Unknown error executing gpgv
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release  

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/Release  

W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release  

W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Release 'precise' for 'liboctave2' was not found
Unable to find an archive "precise" for the package "liboctave2"
Unable to find an archive "precise" for the package "liboctave2"
The following packages will be DOWNGRADED:
  octave octave-common 
The following NEW packages will be installed:
  liboctave1{a} 
The following packages will be REMOVED:
  conky-std{u} libgsl0ldbl{u} liboctave2{u} libpulsedsp{u} pulseaudio-utils{u} rtkit{u} units{u} 
0 packages upgraded, 1 newly installed, 2 downgraded, 7 to remove and 0 not upgraded.
Need to get 0 B/11.1 MB of archives. After unpacking 10.6 MB will be freed.
Do you want to continue? [Y/n/?]  Y
WARNING: untrusted versions of the following packages will be installed!

Untrusted packages could compromise your system's security.
You should only proceed with the installation if you are certain that
this is what you want to do.

  octave-common octave liboctave1 

Do you want to ignore this warning and proceed anyway?
To continue, enter "Yes"; to abort, enter "No": Yes
(Reading database ... 370422 files and directories currently installed.)
Removing conky-std ...
Removing libgsl0ldbl ...
Processing triggers for man-db ...
Processing triggers for menu ...
Processing triggers for doc-base ...
Processing 1 removed doc-base file...
Registering documents with scrollkeeper...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Selecting previously unselected package liboctave1.
(Reading database ... 370388 files and directories currently installed.)
Unpacking liboctave1 (from .../liboctave1_3.6.1-1ubuntu1ppa1~precise1_amd64.deb) ...
dpkg: warning: downgrading octave from 3.8.1-1ubuntu1~octave1~precise1 to 3.6.1-1ubuntu1ppa1~precise1.
Preparing to replace octave 3.8.1-1ubuntu1~octave1~precise1 (using .../octave_3.6.1-1ubuntu1ppa1~precise1_amd64.deb) ...
Unpacking replacement octave ...
dpkg: warning: downgrading octave-common from 3.8.1-1ubuntu1~octave1~precise1 to 3.6.1-1ubuntu1ppa1~precise1.
Preparing to replace octave-common 3.8.1-1ubuntu1~octave1~precise1 (using .../octave-common_3.6.1-1ubuntu1ppa1~precise1_all.deb) ...
Unpacking replacement octave-common ...
Processing triggers for menu ...
Processing triggers for man-db ...
Processing triggers for desktop-file-utils ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for gnome-menus ...
(Reading database ... 369976 files and directories currently installed.)
Removing liboctave2 ...
Removing pulseaudio-utils ...
Removing libpulsedsp ...
Removing rtkit ...
Removing units ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for man-db ...
Processing triggers for install-info ...
Processing triggers for menu ...
Setting up liboctave1 (3.6.1-1ubuntu1ppa1~precise1) ...
Setting up octave-common (3.6.1-1ubuntu1ppa1~precise1) ...
Installing new version of config file /etc/octave.conf ...
Setting up octave (3.6.1-1ubuntu1ppa1~precise1) ...
octave: symbol lookup error: /usr/local/lib/libreadline.so.6: undefined symbol: UP
dpkg: error processing octave (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for menu ...
Errors were encountered while processing:
 octave
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up octave (3.6.1-1ubuntu1ppa1~precise1) ...
octave: symbol lookup error: /usr/local/lib/libreadline.so.6: undefined symbol: UP
dpkg: error processing octave (--configure):
 subprocess installed post-installation script returned error exit status 127
Processing triggers for menu ...
Errors were encountered while processing:
 octave

Warning:  Something went wrong, packages may not have been reverted
bain
  • 11,260
linuxfreebird
  • 215
  • 1
  • 6
  • 17
  • 1
    Which version are you trying to use finally- 3.8.1 or 3.8.0? How did you install ncurses and readline? Can you provide a link from where you downloaded the version you are trying to install? – jobin May 05 '14 at 14:28
  • 4
    It looks like you're on Ubuntu 12.04, is that correct? Octave 3.8.1 will definitely work with the readline and ncurses provided in the repos. You can install it from ppa:octave/stable without having to build from source at all. Can you clarify what you mean by "GNU readline was not working properly"? – Michael Miller May 05 '14 at 17:42
  • This fixed the previous comment issue above : ~$ sudo mv /usr/local/lib/libreadline.so.6 /usr/local/lib/libreadline_problem.so.6~$ sudo ln -s /lib/x86_64-linux-gnu/libreadline.so.6 /usr/local/lib/libreadline.so.6 – linuxfreebird May 05 '14 at 18:54
  • 1
    @linuxfreebird: I think this error is because you also have octave in /usr/local/bin, try moving it out of the way or simply deleting the /usr/local/bin/octave executable. I've seen this error a lot and that's usually the culprit. – Michael Miller May 05 '14 at 23:29
  • 1
    try this: $sudo rm -rf /usr/local/bin/octave – j0h May 06 '14 at 19:26
  • @linuxfreebird Ok, this means that octave is no longer in your $PATH, including /usr/bin which is where it should be. Now that it is removed from /usr/local, can you try sudo apt-get install octave --reinstall, does that complete without an error? – Michael Miller May 08 '14 at 12:16

1 Answers1

3

Delete every file you added to /usr/local. If you have not installed any other packages to /usr/local, then do:

find /usr/local -type f -exec rm -f {} \;

Do not do that if you have installed other packages to /usr/local. Instead you will have to go through /usr/local manually and delete any files related to octave. A good start would be:

find /usr/local -name '*octave*' -exec rm -rf {} \;

Move your local build of libreadline somewhere else:

mkdir ~/libreadline
mv /usr/local/lib/libreadline* ~/libreadline 

Then uninstall octave:

apt-get purge '.*octave.*'

Octave in the Ubuntu 12.04 repository is v3.2, if want the most recent stable version (currently 3.8.1), add the Octave stable releases PPA:

add-apt-repository ppa:octave/stable

Make sure your other packages are up-to-date:

apt-get update
apt-get dist-upgrade

And reinstall octave:

apt-get install octave

As mtmiller commented, Octave from the repositories will work with readline. You just need to fix your system and restore Octave from the official repository.

bain
  • 11,260
  • 1
    Try: find /usr/local -name '*octave*' -exec rm -rf {} \; – bain May 09 '14 at 00:36
  • 1
    @linuxfreebird The error you got was because rm was missing the -r parameter. – bain May 09 '14 at 00:42
  • 1
    @linuxfreebird Does /usr/local/lib/libreadline.so.6 exist? Did you do the first command find /usr/local -type f -exec rm -f {} \;? – bain May 09 '14 at 00:53
  • 1
    @linuxfreebird and did you apt-get purge '.*octave.*'? – bain May 09 '14 at 00:55
  • 1
    @linuxfreebird Yes remove it. Did you install anything else to /usr/local? If not, it is safe to delete everything there. Official Ubuntu packages do not put any files in /usr/local. – bain May 09 '14 at 00:58
  • 1
    @linuxfreebird No need for find unless you are iterating. Just do rm /usr/local/lib/libreadline.so.6 – bain May 09 '14 at 01:07
  • 1
    @linuxfreebird do ppa-purge ppa:octave/stable then apt-get install octave – bain May 09 '14 at 11:13
  • Thanks for the ppa-purge command, but it did not work. The installation has a problem with libreadline. Not sure what to do. I posted the ppa-purge results below my question. – linuxfreebird May 09 '14 at 21:34
  • 1
    The apt errors are because you have that extra libreadline library, you need to remove it and get apt working again, see GPG error while updating – bain May 10 '14 at 10:56
  • I solved the problem. I took anything that closely resembled or seemed to be related to libreadline and stuffed in an old folder to remove it from /usr/local/lib . After purging octave and re-adding back into the repository I was able to install it with zero problems. I am able to pull up all of my entered octave commands from the terminal now. Thank you so much for helping me on this problem. – linuxfreebird May 10 '14 at 14:37
  • I am not sure if the answer you provided contains enough information to help others who might run into the same problem. What can I add to your answer to help improve its clarity for future help to others? – linuxfreebird May 10 '14 at 15:39
  • 1
    I edited the answer to mention moving libreadline. – bain May 10 '14 at 17:31
  • I have to manually move the octave executable into the /usr/local/bin folder from the /usr/bin folder in order to execute octave from the terminal. Is this normal? – linuxfreebird May 12 '14 at 13:11