Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing Updated GCC and GDB on Ubuntu Systems

Tech May 19 1

To obtain recent releases of the GNU Compiler Collection (GCC) and GNU Debugger (GDB) on Ubuntu, alternative approaches beyond the default package repositories are required. The following methods enable installation of updated toolchain components.

PPA Installation Method

The Ubuntu Toolhcain PPA provides updated compiler and debugger packages. Execute these terminal commands:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-14 g++-14
sudo apt install gdb

To configure the new compiler as default:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 70
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 70

Verify installations with:

gcc --version
gdb --version

Source Compilation Approach

To direct installation from source code:

  1. Install prerequisites: ``` sudo apt install build-essential libgmp-dev libmpfr-dev libmpc-dev flex bison
  2. Download and extract source: ``` wget https://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz tar -xzf gcc-14.1.0.tar.gz cd gcc-14.1.0
  3. Configrue build environment: ``` mkdir build-dir cd build-dir ../configure --prefix=/usr/local/gcc-14.1 --enable-languages=c,c++ --disable-multilib
  4. Compile and install: ``` make -j$(nproc) sudo make install
  5. Update system paths: ``` echo 'export PATH=/usr/local/gcc-14.1/bin:$PATH' >> ~/.bashrc source ~/.bashrc
    
    

Snap Package Installation

For GDB installation via Snap:

sudo apt install snapd
sudo snap install gdb --classic
Tags: ubuntuGCC

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.