GCC is the GNU Free C compiler, which is installed by default for many Linux releases. Many popular free software original code can be compiled and run under the GCC compiler.
Although GCC has many platforms (operating system) versions, the General commercial UNIX system does not install GCC, in order to use GCC on these operating systems, you must install it yourself. The following is a description of the steps to get GCC, install, and debug on the Sun Solaris operating system.
1 Get GCC software that is consistent with the operating system and operating system version, and if you want to use GCC on the Solaris 2.5.1, get a matched gcc
Ftp://ftp.cdit.edu.cn/pub/unix/solaris/sparc25/gcc-2.7.2.1.gz
2 Decompression
. GZ indicates that this is a file that has been compressed by gzip. Need to use Gzip/gunzip software first decompression.
$ gunzip gcc-2.7.2.1.gz
3 Installation
After the decompression is the installation package. Install a package of specialized commands and procedures in the Solaris operating system
#pkgadd-D./gcc-2.7.2.1
In the next installation, there will be an interactive installation process.
4 Debugging
In the case of gcc-2.7.2.1, GCC's default installation path is/opt/gcc2721, which may not be in the range represented by the user's path variable, so the path variable needs to be updated to make it easier to use GCC.
For users who use CSH:
% setenv path= $PATH:/opt/gcc2721/bin
For users using SH:
$ path= $PATH:/opt/gcc2721/bin
$ Export PATH
If you do not want to update the PATH environment variable every time you use GCC, you can write the above content in the user's initial file:
For CSH users: written in the. cshrc file in the user's home directory
To SH User: written in the. profile file in the user's home directory