Is gcc is part of standard RHEL installation?
程序员文章站
2022-05-29 11:54:07
...
https://access.redhat.com/solutions/22999
Is gcc is part of standard RHEL installation?
SOLUTION 已验证 - 已更新 2018年四月2日10:48 -
环境
- Red Hat Enterprise Linux
问题
- Is
gcc
is part of standard RHEL installation? - How to install compilers
gcc
and test if it is working?
决议
gcc is definitely available in the RHEL channels. However, whether or not it is installed would depend on the packages selected for the installation. Use yum to install gcc
:
# yum install gcc
And if you would like to install development tools such as autoconf, automake, flex, c++ compiler, etc:
# yum grouplist
Available Groups:
Backup Client
Backup Server
Client management tools
Compatibility libraries
Desktop Debugging and Performance Tools
Desktop Platform Development
Development tools <-----------------------------------------------
Eclipse
Emacs
FCoE Storage Client
Done
If you would like to know what are the basic components in this group packages:
# yum groupinfo "Development tools"
Group: Development tools
Description: A basic development environment.
Mandatory Packages:
autoconf
automake
binutils
bison
flex
gcc
gcc-c++
gettext
libtool
make
patch
pkgconfig
redhat-rpm-config
rpm-build
# yum groupinstall "Development Tools"
诊断步骤
How to verify your gcc installation:
$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz
How to see gcc compiler version:
$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 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.
Let's create a little program to test if gcc is working:
$ vi redhat.c
#include<stdio.h>
int main(void){
printf("Hello Red Hat!\n");
return 0;
}
Now, let's compile to generate an executable file:
$ gcc redhat.c -o redhat
Execute the program:
$ ./redhat
Hello Red Hat!