Upgrading to GCC 4.9.4 in CentOS 7 requires installing a newer version manually

CK CK 3788 
Created at
Updated at  
588 0 0

Below bash script is for installing gcc 4.9.4 in CentOS 7

#!/bin/bash

# Install Development Tools
sudo yum groupinstall "Development Tools"

# Install dependencies
sudo yum install gcc gcc-c++ gmp-devel mpfr-devel libmpc-devel

# Download and extract GCC source code
cd $HOME	
wget http://ftp.gnu.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.gz
if [ ! -f gcc-4.9.4.tar.gz ]; then
	echo "Error: gcc-4.9.4.tar.gz not found"
	exit 1
fi
if [ -d gcc-4.9.4 ]; then
	rm -rf gcc-4.9.4
fi
tar -xvzf gcc-4.9.4.tar.gz
cd gcc-4.9.4

# Download prerequisites
./contrib/download_prerequisites

# Configure and build GCC
mkdir ../gcc-build
cd ../gcc-build

# Configure GCC with specific options
../gcc-4.9.4/configure --enable-languages=c,c++ --disable-multilib --prefix=/usr/local/gcc-4.9.4

# Build GCC
make -j$(nproc)
sudo make install

# Update environment variables
echo 'export PATH=/usr/local/gcc-4.9.4/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/gcc-4.9.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

# Verify installation
gcc --version
g++ --version

# Clean up
rm -rf gcc-4.9.4 gcc-build gcc-4.9.4.tar.gz

 

For your information, you should have sudo permission to install the above.

Tags CentOS gcc gcc 4.9.4 Facebook X
Comments 0
Similar posts
  1. Generate Let’s Encrypt Wildcard SSL Certificate
    628
  2. How to mount windows shared folder on Centos 6.8 - mount error 12 = Cannot allocate memory to the mount.cifs(8)
    922
  3. Configuring IP Address on Centos 6.7
    795
  4. Setup Apache+PHP+MySQL on Centos 6.7
    610
  5. Adding new cron job for automated processing on every 10 minutes on Centos 6.7
    1,336
  6. mcrypt missing when using phpMyAdmin on Centos 6.7
    556
  7. Set timezone and time on Centos 6.7
    545
  8. How to optimize MySQL automatically in CentOS Linux
    1,010
  1. Why SPF and DKIM Are Essential for Linux Email Servers?
    51
  2. Force no caching in Apache by modifying the .htaccess file using appropriate headers
    2,691
  3. Beyond your conventional memory size with swap file instead of a partition
    1,147
  4. Gmail requires all senders to authenticate with either SPF or DKIM.
    684
  5. Bash script to install postfix and sasl for sending email
    1,202
  6. Guide for tmux shortcuts - split current pane, toggle pane
    1,313
  7. Tistory remote blogging example based in CLI & PHP
    2,749
  8. Preventing Unauthorized Image Crawling by Bots: A Clever Discovery and How to Address It
    1,731
  9. Network diagnostic tool for IPv4/IPv6 - traceroute/traceroute6
    1,926
  10. chmod by type (directory and file permission)
    736
  11. Check network port is open or not on CentOS 7
    1,196
  12. Change MySQL port number for security purpose
    817
  13. CentOS warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory on CentOS 7
    1,085
  14. Set up an SMTP server on CentOS 7
    730
  15. File conversion to UTF in Schell Script
    1,026
  16. Server status checking by Shell Script
    1,521
Recently updated
  1. Google OAuth Token Expiration: Causes and Solutions
    31
  2. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    57
  3. How do I create animated background for Google Meet?
    23,256
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    273
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    105
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    170
  7. Array of arguments passed to script in PHP
    99
  8. Invalid Auction Storms in Ad Tech
    108
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    209
  10. The Two Clocks of Ad Server Architecture
    78
  11. Frequency Cap Architecture Overview
    527
  12. Collecting Proof-of-Play from 100,000 Screens
    154
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    304
  14. What is RedisVL?
    117
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    247
  16. TPU & GPU Cluster Management Tools
    258
  17. The Concept of Scaffolding in AI Agents
    245
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    599
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    269
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    355
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    207
  22. Machine Learning: Training vs. Ranking
    231
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    229
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    204
  25. Designing a Data Curation System Around a Vector Database
    230
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    264
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    674
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    201
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    233
  30. Understanding Data Lineage
    272