How to update GDB to most current, stable version

17,924

Solution 1

This is just a guess, but it might be the case that your version of tar is so old it does not support the xz compression scheme. The link you reference suggests downloading gdb-7.8.tar.xz, you can try running unxz gdb-7.8.tar.xz which will uncompress the file into gdb-7.8.tar, you can then retry tar -xf gdb-7.8.tar which should now work.

Alternatively you could try downloading this file instead http://ftp.gnu.org/gnu/gdb/gdb-7.8.2.tar.gz, this is the 7.8.2 release compared to the 7.8 you were using before, and so contains a few minor bug fixes, however, this file uses the gzip compression scheme, which has been supported in tar for longer than xz, this new file should extract fine with tar -xf gdb-7.8.2.tar.gz.

Finally, you might be interested in skipping 7.8 completely, and moving straight to 7.10 (http://ftp.gnu.org/gnu/gdb/gdb-7.10.tar.gz) as this should contain even more exciting new features and improvements.

Solution 2

Updating GDB from 7.7.1 to 8.2 on Ubuntu 14.04:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get -y --force-yes install gdb
gdb -v
sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test
sudo apt-get update

Solution 3

You can also build and install GDB yourself from the official source code. However be aware that there are some quirks to this process on Ubuntu 20 LTS. If you dynamically link the C++ libs then you'll possibly get errors running GDB. One solution is to statically link. This is what worked for me on Ubuntu 20.04.3 LTS (aka focal) x86_64 with GDB 10.2. These instructions assume you have downloaded gdb-10.2.tar.gz (or whatever version you wish to build) and moved it into your home directory.

sudo apt update
sudo apt install build-essential texinfo
cd
tar -xvzf gdb-10.2.tar.gz
cd gdb-10.2
./configure
make CXXFLAGS="-static-libstdc++"
sudo make install
gdb --version

NOTE >> If you notice python errors when running gdb --version then a reboot will fix this and perhaps even just logging off and logging back in.

Share:
17,924
Kingamere
Author by

Kingamere

Updated on August 14, 2022

Comments

  • Kingamere
    Kingamere over 1 year

    I am using gdb version 6.8 on an ubuntu 9 machine image. I would like to update it to the latest one (7.8?) but I'm not sure how to do it.

    I tried following the instructions here https://askubuntu.com/questions/529781/upgrade-from-gdb-7-7-to-7-8 but they didn't work.

    It stopped at the tar command and said "this does not look a tar file"

    Can anyone help?

    Thanks

  • Elliott
    Elliott over 2 years
    'Didn't work for me on Ubuntu 20.04. Latest is currently 11.1, but I seem stuck at the (buggy) 10.2.
  • the kamilz
    the kamilz over 2 years
    Your solution actually works. I installed GDB 11.1. Also, log off and log in back are also needed too.
  • Caio V.
    Caio V. over 2 years
    I just have to restart my terminal to get the new version installed without the Python error.