LoginSignup
1
0

RHEL系Linuxでc++コードをビルドする

Last updated at Posted at 2019-08-12

前提

  • g++を使用したい
  • rpmbuildも使用したい
  • ソースコードはGitリポジトリからダウンロードしたい

RHEL 7.x

g++のインストール

以下のコマンドを実行する。

$ sudo yum repolist all

"rhui-REGION-rhel-server-rhscl"がenabledになっていなければ,次のコマンドを実行する。

$ sudo yum-config-manager --enable rhui-REGION-rhel-server-rhscl

再度以下のコマンドを実行し,"rhui-REGION-rhel-server-rhscl"がenabledになっていることを確認する。

$ sudo yum repolist all

以下のコマンドでg++およびrpmbuildをインストールを実行する。

$ sudo yum install devtoolset-7
$ sudo yum install rpm-build

以下のコマンドでg++のバージョンを確認する。

$ scl enable devtoolset-7 bash
$ g++ --version

Gitリポジトリからソースコードをダウンロード

git clone -q --branch=master https://github.com/xxx/xxx.git /home/ec2-user/xxx

クローンしたワークフォルダーに入り下記のコマンドを実行すると,最新のソースコードがダウンロードされる。

$ git pull origin master

強制的に上書きするには下記のコマンドを実行する。

$ git fetch origin master
$ git reset --hard origin/master

AlmaLinux 8.x

Minimal installのAlmaLinuxへのインストール

yum install gcc
yum install rpm-build
yum install git
yum install make
yum install gcc-c++
yum install openssl-devel
yum install libstdc++-static

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0