Ubuntu 21.10にgccをインストールする方法

OSバージョンの確認

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=21.10
DISTRIB_CODENAME=impish
DISTRIB_DESCRIPTION="Ubuntu 21.10"

操作方法
1.build-essentialパッケージをインストールします

# sudo apt install ubuntu-dev-tools fakeroot build-essential gnupg pbuilder debhelper

2.makeバージョンの確認

# make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

3.gccバージョンの確認

# gcc --version
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

4.動作確認
# vi test.c

#include <stdio.h>

int main(void)
{
    int i;
    printf("Hello world!");
}

ファイルをコンパイルします
# gcc test.c -o test
# ./test
Hello world!

Ubuntu 21.10

Posted by arkgame