TT Bigdata TT Bigdata
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件安装

    • 常规&高可用
  • 版本专题

    • 更新说明
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 模板代码

    • 各类组件
    • 通用模板
  • 国产化&其他系统

    • Centos系列
    • Kylin系列
    • OpenEuler系列
    • Rocky系列
    • Ubuntu系列
  • 生产调优

    • 组件调优指南
    • 1v1指导调优
  • 定制开发

    • 组件版本定制
    • 样式风格定制
  • 蓝图愿景
  • 技术支持
  • 合作共建
GitHub (opens new window)

JaneTTR

数据酿造智慧,每一滴都是沉淀!
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件安装

    • 常规&高可用
  • 版本专题

    • 更新说明
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 模板代码

    • 各类组件
    • 通用模板
  • 国产化&其他系统

    • Centos系列
    • Kylin系列
    • OpenEuler系列
    • Rocky系列
    • Ubuntu系列
  • 生产调优

    • 组件调优指南
    • 1v1指导调优
  • 定制开发

    • 组件版本定制
    • 样式风格定制
  • 蓝图愿景
  • 技术支持
  • 合作共建
GitHub (opens new window)
  • Ambari

    • 编译小技巧

      • Ambari 编译打前端包如何提速
      • Ambari 编译打包需要的 GCC 环境
        • 一、如何安装高版本的 GCC 🚀
          • 1.1 方法一:通过常规方式安装高版本的 gcc 🛠️
          • 1.1.1 启用 CentOS SCLo 仓库 🔧
          • 1.1.2 安装 devtoolset-7 ⚙️
          • 1.1.3 启用 devtoolset-7 环境 🎯
          • 1.1.4 永久启用 devtoolset-7 📝
          • 1.2 方法二:通过 Nexus 私服安装高版本的 gcc 🔐
          • 1.2.1 在 Nexus 上配置阿里云 YUM 仓库 💻
          • Step1:新增 Proxy 源
          • Step2:将 Proxy 源添加到 Group 中
          • Step3:配置完成后的效果
          • 1.2.2 编辑 YUM Repo 配置文件
          • 1.2.3 安装高版本的 gcc 🔄
          • 1.2.4 启用 devtoolset-7 环境 🎯
        • 二、在 Ambari 项目中编译 ambari-web 报错
          • 2.1 报错日志
          • 2.2 解决办法
          • 2.2.1 多版本共存方案
          • 2.2.2 配置示例
          • 2.3 使用 ambari-env 一键解决环境准备问题
          • 2.3.1 自动配置 YUM 源
          • 2.3.2 自动初始化 yum-public.repo 文件
          • 2.3.3 编译前自动准备环境
      • Ambari 汉化方案及实践
      • Ambari 乱码问题处理及解决方案
      • Ambari 本地二次开发——跨域处理
    • 使用Ambari-Env编译

    • 适用于Centos7.9

    • 适用于Rocky8.10

    • 适用于Ubuntu22.04

  • Ambari-Metrics

  • Ambari-Infra

  • 组件编译-Ambari
  • Ambari
  • 编译小技巧
JaneTTR
2022-12-18
目录

Ambari 编译打包需要的 GCC 环境

# Ambari 编译打包需要的 GCC 环境 🚀

在 Ambari 的编译过程中,GCC 是必不可少的工具。若系统中缺少合适版本的 GCC,编译过程将会遇到许多问题。本篇文章将介绍如何安装高版本的 GCC,并解决在 Ambari 项目编译时可能遇到的相关问题。

# 一、如何安装高版本的 GCC 🚀

# 1.1 方法一:通过常规方式安装高版本的 gcc 🛠️

# 1.1.1 启用 CentOS SCLo 仓库 🔧

首先,我们需要启用 Software Collections (SCL) 仓库来安装较新版本的 GCC:

sudo yum install centos-release-scl
1

# 1.1.2 安装 devtoolset-7 ⚙️

启用仓库后,安装高版本的 GCC 和 gcc-c++:

sudo yum install devtoolset-7-gcc devtoolset-7-gcc-c++
1

# 1.1.3 启用 devtoolset-7 环境 🎯

安装完成后,通过以下命令启用 devtoolset 环境:

scl enable devtoolset-7 bash
1

你可以通过以下命令检查 GCC 版本是否更新:

gcc --version
1

# 1.1.4 永久启用 devtoolset-7 📝

若希望每次启动时自动启用 devtoolset-7,将命令添加到 .bashrc 文件中:

echo "source scl_source enable devtoolset-7" >> ~/.bashrc
1

# 1.2 方法二:通过 Nexus 私服安装高版本的 gcc 🔐

# 1.2.1 在 Nexus 上配置阿里云 YUM 仓库 💻

首先配置阿里云的 YUM 仓库,以便从国内镜像源安装:

# 配置以下地址
https://mirrors.aliyun.com/centos/
1
2
# Step1:新增 Proxy 源

image

# Step2:将 Proxy 源添加到 Group 中

image

# Step3:配置完成后的效果

image

# 1.2.2 编辑 YUM Repo 配置文件

编辑自定义 YUM 源文件 /etc/yum.repos.d/yum-public.repo:

# 编辑一个自定义源头
vim /etc/yum.repos.d/yum-public.repo
1
2

填入以下内容:

[yum-public-base]
name=YUM Public Repository
baseurl=http://172.20.0.2:8081/repository/yum-public/$releasever/os/$basearch/
enabled=1
gpgcheck=0
[yum-public-update]
name=YUM Public Repository
baseurl=http://172.20.0.2:8081/repository/yum-public/$releasever/updates/$basearch/
enabled=1
gpgcheck=0
[yum-public-extras]
name=YUM Public Repository
baseurl=http://172.20.0.2:8081/repository/yum-public/$releasever/extras/$basearch/
enabled=1
gpgcheck=0
[yum-public-centosplus]
name=YUM Public Repository
baseurl=http://172.20.0.2:8081/repository/yum-public/$releasever/centosplus/$basearch/
enabled=1
gpgcheck=0
[yum-public-scl]
name=YUM Public Repository
baseurl=http://172.20.0.2:8081/repository/yum-public/7.9.2009/sclo/$basearch/sclo/
enabled=1
gpgcheck=0
[yum-public-scl-rh]
name=YUM Public Repository
baseurl=http://172.20.0.2:8081/repository/yum-public/7.9.2009/sclo/$basearch/rh/
enabled=1
gpgcheck=0
[yum-public-epel]
name=YUM Public Repository
baseurl=http://172.20.0.2:8081/repository/yum-public/$releasever/$basearch/
enabled=1
gpgcheck=0
[yum-public-mariadb]
name=YUM Public Repository
baseurl=http://172.20.0.2:8081/repository/yum-public/yum/10.11.8/centos7-amd64/
enabled=1
gpgcheck=0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

# 1.2.3 安装高版本的 gcc 🔄

清理 YUM 缓存并安装 GCC:

sudo yum clean all
sudo yum makecache
sudo yum install devtoolset-7-gcc devtoolset-7-gcc-c++
1
2
3

# 1.2.4 启用 devtoolset-7 环境 🎯

安装完成后,通过以下命令启用 devtoolset-7 环境:

scl enable devtoolset-7 bash
1

# 二、在 Ambari 项目中编译 ambari-web 报错

# 2.1 报错日志

在编译 ambari-web 时,可能会遇到以下报错:

[DEBUG] Loading mojo com.github.eirslett:frontend-maven-plugin:1.4:yarn from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.4, parent: sun.misc.Launcher$AppClassLoader@7852e922]
[DEBUG] Configuring mojo execution 'com.github.eirslett:frontend-maven-plugin:1.4:yarn:yarn install' with basic configurator -->
[DEBUG]   (f) arguments = install --ignore-engines --pure-lockfile --verbose
[DEBUG]   (f) environmentVariables = {npm_config_tmp=/tmp/npm_config_tmp}
[DEBUG]   (f) npmRegistryURL = https://registry.npmmirror.com
[DEBUG]   (f) project = MavenProject: org.apache.ambari:ambari-web:2.8.0.0.0 @ /opt/modules/ambari/ambari-web/pom.xml
[DEBUG]   (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@3c35c345
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@41aaedaa
[DEBUG]   (f) skip = false
[DEBUG]   (f) skipTests = false
[DEBUG]   (f) testFailureIgnore = false
[DEBUG]   (f) workingDirectory = /opt/modules/ambari/ambari-web
[DEBUG]   (f) yarnInheritsProxyConfigFromMaven = false
[DEBUG]   (f) execution = com.github.eirslett:frontend-maven-plugin:1.4:yarn {execution: yarn install}
[DEBUG] -- end configuration --
[INFO] yarn not inheriting proxy config from Maven
[INFO] Running 'yarn install --ignore-engines --pure-lockfile --verbose --registry=https://registry.npmmirror.com/' in /opt/modules/ambari/ambari-web
[DEBUG] Executing command line [/opt/modules/ambari/ambari-web/node/yarn/dist/bin/yarn, install, --ignore-engines, --pure-lockfile, --verbose, --registry=https://registry.npmmirror.com]
[ERROR] node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
[ERROR] node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by node)
[ERROR] node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
[ERROR] node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by node)
[ERROR] node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by node)
[ERROR] node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by node)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.140 s
[INFO] Finished at: 2024-08-20T09:15:00+08:00
[INFO] ------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

# 2.2 解决办法

# 2.2.1 多版本共存方案

为了解决编译问题,你可以通过启用 SCL 源并安装 devtoolset-7-gcc 和 devtoolset-7-gcc-c++,从而使用高版本的 GCC 编译器。只需确保启用相关环境即可解决问题。

image

# 2.2.2 配置示例

  1. 通过配置 YUM 仓库并启用对应版本的 gcc,解决低版本 GCC 的问题,确保安装最新版编译工具链。

  2. 在项目中配置好相应的编译环境后,执行以下命令:

    scl enable devtoolset-7 bash
    
    1

# 2.3 使用 ambari-env 一键解决环境准备问题

# 2.3.1 自动配置 YUM 源

使用 ambari-env 项目可以自动加入并配置统一的 YUM 源。

image

# 2.3.2 自动初始化 yum-public.repo 文件

通过执行 ambari-env 脚本,自动初始化并配置 yum-public.repo 文件,确保所有源都指向正确的 YUM 仓库。

image

# 2.3.3 编译前自动准备环境

在 Ambari 项目中,使用 ambari-env 进行自动环境准备,确保项目编译不再因环境问题报错。

image

#GCC#Ambari#编译环境#开发环境
Ambari 编译打前端包如何提速
Ambari 汉化方案及实践

← Ambari 编译打前端包如何提速 Ambari 汉化方案及实践→

最近更新
01
Pandoc 缺失导致 SparkR 构建失败
06-08
02
Cyrus SASL/GSASL 缺失解决
06-07
03
Hadoop_3.3.4 编译实战 1.0.0+
06-06
更多文章>
Theme by Vdoing | Copyright © 2017-2025 JaneTTR | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式