1. this document is applicable to the compilation and use of gcc-3.0 and gcc-3.0.x under SCO 5.0.6. the same method can also be used to compile gcc-2.95.x, gcc-3.2.x, gcc-3.3. this article takes the gcc-3.0 as an example to illustrate the GCC compilation process and some points of attention in use.
2. Source Code gcc-3.0 source code can be from the GCC official website (gcc.gnu.org) and mirror site.
Decompress and unpackage the source code package under SCO. In this article, assume that the directory after unpacking is/usr/test/gcc-3.0.
3. Pre-compilation preparation 3.1. Operating System patch under SCO openserver 5.0.6 to compile the gcc-3.0 does not need to play the operating system patch. If oss646c is used, the compilation process may fail.
. When installing GNU make to compile GCC using make that comes with the SCO development environment, it will cause compilation failure because some syntax in makefile cannot be parsed. Therefore, it is necessary to compile it using GNU make.
First, download the GNU make source code from the GNU official website (the current version is 3.80), compile the make Execution Code under SCO, and replace/bin/make with this Execution Code.
4. configuration in order to avoid damage to GCC source code due to misoperations, the GCC configuration and compilation are generally carried out in another directory.
Create the gcctmp directory under/usr/test. Go to the gcctmp directory and run the following command :...... /Gcc-3.0/configure -- prefix =/usr/local/gcc-3.0 prefix represents the GCC installation directory. If you do not use this parameter, the default installation directory is/usr/local. If you may install multiple versions of GCC, it is best to install different versions of GCC to different directories.
Configure also has many other compilation options. You can carefully read the documentation in the install directory before configuration, and enable or disable some options as needed.
5. Compile and execute make Bootstrap in gcctmp. Because the GCC system is large, it takes a long time to compile.
6. After GCC compilation is completed successfully, run the su command to switch to the root user and run make install to install GCC to the/usr/local/gcc-3.0 directory.
7. verify after installation Add the GCC installation path to the execution path: Path =/usr/local/gcc-3.0/binpath; export path execute gcc-V, the following message is prompted: reading specs from/usr/local/gcc-3.0/lib/GCC-lib/i386-pc-sco3.2v5.0.6/3.0/specs configured :...... /Gcc-3.0/configure -- prefix =/usr/local/gcc-3.0 thread model: single GCC version 3.0 indicates that GCC has been compiled, installed, can be used for program development. Congratulations!
8.-The compatibility of-belf and-bcoff sometimes requires Elf or coff format for programs compiled on the SCO platform. This function is controlled through the-belf and-bcoff compilation options.
From the gcc-2.95.x, there will be such a statement about the SCO platform in the GCC official documentation (see host/target specific installation notes for GCC): Unlike earlier versions of GCC, the ability to generate coff with this target is no longer provided. therefore, do not expect GCC to generate COFF binary codes in SCO format. Worse, if the-belf or-bcoff option is added to the GCC runtime under SCO openserver, the following error is reported: GCC: installation problem, cannot exec 'cc1 ': no such file or directory causes configuration and compilation errors of some software packages.
There are many questions on the Internet, but few have answered them. In fact, the solution is very simple: 1. log on as the root user and enter/usr/local/gcc-3.0/lib/GCC-lib 2. ln-s i386-pc-sco3.2v5.0.6 elf ln-s i386-pc-sco3.2v5.0.6 coff after completing the above operation, you can use the-B option properly.
Of course, our purpose is not to generate binary codes in elf or coff format (the code generated when-belf and-bcoff are used is identical ), instead, errors will not occur when the-B option is used.
This method can also be used for gcc-2.95.x and other versions.