Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update GDB to most current, stable version

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

like image 330
Kingamere Avatar asked Sep 25 '15 01:09

Kingamere


3 Answers

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
like image 66
Yevhen Vovchuk Avatar answered Sep 23 '22 19:09

Yevhen Vovchuk


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.

like image 23
OtterFlip Avatar answered Sep 24 '22 19:09

OtterFlip


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.

like image 42
Andrew Avatar answered Sep 23 '22 19:09

Andrew