当前位置: 首页 > news >正文

c++编译环境安装(gcc、cmake)

一、gcc下载

下载地址:https://ftp.gnu.org/gnu/gcc/
选择想要下载的版本,然后解压,查看 contrib/download_prerequisites 中的依赖。
以我下载的 gcc-7.3.0 为例,
在这里插入图片描述

二、安装依赖包

【gmp】 https://ftp.gnu.org/gnu/gmp/
【isl】 https://gcc.gnu.org/pub/gcc/infrastructure/
【mpc】 https://ftp.gnu.org/gnu/mpc/
【mpfr】 https://ftp.gnu.org/gnu/mpfr/

2.1 安装gmp

wget https://ftp.gnu.org/gnu/gmp/gmp-6.1.0.tar.bz2
tar xjf gmp-6.1.0.tar.bz2
cd gmp-6.1.0/
./configure --prefix=/path-to-install/gmp
make -j32 && make install

2.2 安装mpfr

wget https://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.gz
tar xvf mpfr-3.1.4.tar.gz
cd mpfr-3.1.4/
./configure --prefix=/path-to-install/mpfr --with-gmp=/path-to-install/gmp
make -j32 && make install

2.2 安装mpc

wget https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
tar xvf mpc-1.0.3.tar.gz
cd mpc-1.0.3/
./configure --prefix=/path-to-install/mpc --with-gmp=/path-to-install/gmp --with-mpfr=/path-to-install/mpfr
make -j32 && make install

2.4 安装isl

wget https://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2
tar xjf isl-0.16.1.tar.bz2
cd isl-0.16.1/
./configure --prefix=/path-to-install/isl  --with-gmp-prefix=/path-to-install/gmp
make -j32 && make install

三、 安装gcc

cd gcc-7.3.0/
./configure --prefix=/path-to-install/gcc \ --with-gmp=/path-to-install/gmp \--with-mpfr=/path-to-install/mpfr \--with-mpc=/path-to-install/mpc  \--with-isl=/path-to-install/isl \--enable-checking=release \--enable-languages=c,c++ \--disable-multilib
make -j32 && make install

3.1 配置环境变量

修改 ~/.bashrc

export LD_LIBRARY_PATH=/path-to-install/isl/lib:/path-to-install/gcc/lib64:$LD_LIBRARY_PATH
export PATH=/path-to-install/gcc/bin:$PATH
export CC=/path-to-install/gcc/bin/gcc
export CXX=/path-to-install/gcc/bin/g++

然后 source ~/.bashrc

四、安装cmake

wget http://www.cmake.org/files/v3.27/cmake-3.27.1.tar.gz
tar xf cmake-3.27.1.tar.gz
cd cmake-3.27.1
./configure --prefix=/path-to-install/cmake
make -j32 && make install

然后参考 3.1 修改 ~/.bashrc

http://www.lryc.cn/news/613127.html

相关文章:

  • 【C++】哈希表原理与实现详解
  • Numpy科学计算与数据分析:Numpy数学函数入门与实践
  • [激光原理与应用-172]:测量仪器 - 能量(焦耳)与功率(瓦)的图示比较
  • 此芯p1开发板使用OpenHarmony时llama.cpp不同优化速度对比(GPU vs CPU)
  • JavaWeb03——基础标签及样式(表单)(黑马视频笔记)
  • 【运维进阶】NFS 服务器
  • 智慧园区系统:打造未来城市生活新体验
  • 第一性原理科学计算服务器如何选择配置-内存选择篇
  • 软考中级【网络工程师】第6版教材 第2章 数据通信基础(下)
  • Windows下Rust编码实现MP4点播服务器
  • 【算法训练营Day22】回溯算法part4
  • Pytest项目_day07(pytest)
  • npm 与 npx 区别详解。以及mcp中npx加载原理。
  • 《深入理解Java字符串:从基础到高级特性》
  • 贪心+矩阵算法
  • 与页面共舞 —— Content Scripts 的魔法
  • 面向对象之类、继承和多态
  • leafletMap封装使用
  • 动手学深度学习13.11. 全卷积网络 -笔记练习(PyTorch)
  • Linux 中断系统全览解析:从硬件到软件的全路线理解
  • 外部排序总结(考研向)
  • MongoDB数据存储界的瑞士军刀:cpolar内网穿透实验室第513号挑战
  • 数据结构:双向链表(Doubly Linked List)
  • 生成对抗网络(GAN)实战 - 创建逼真人脸图像
  • 电路相量法
  • (易视宝)易视TV is-E4-G-全志A20芯片-安卓4-烧写卡刷工具及教程
  • C++的“模板”
  • day069-Jenkins基础使用与参数化构建
  • golang的面向对象编程,struct的使用
  • 急危重症专科智能体”构建新一代急诊、手术与重症中心的AI医疗方向探析