During cross-compilation, we need to use other libraries. In config, we can use "-I" to specify the header file directory. However, it is difficult to set the directory every time, find a simple method. See the red section below.
There are a large number of environment variables that can be set to affect the GCC compilation method. Appropriate command line options can also be used to control these variables. Some environment variables are set in the directory name table. These names and
The path environment variables are in the same format. The special character path_separator (defined during installation and compilation) is used between directory names. In Unix
In the system, the Delimiter is a colon, while in Windows, it is a semicolon.
C_include_path
This environment variable is used to compile the C program. This environment variable specifies a list of one or more directory names to search for header files, just like specifying the-isystem option in the command line. Searches for all Directories specified by-isystem.
See cpath, cplus_include_path, and objc_include_path.
Compiler_path
This environment variable specifies one or more directory names. If gcc_exec_prefix is not specified to locate the subroutine, the compiler will look for its subroutine here.
See also LIBRARY_PATH, gcc_exec_prefix, and-B command line options.
This environment variable is used when cpath compiles C, C ++, and objective-C Programs. This environment variable specifies a list of one or more directory names to search for header files, just as if the-L option is specified in the command line. Searches for all Directories specified by-L.
See c_include_path, cplus_include_path, and objc_include_path.
This environment variable is used when the C ++ program is compiled using cplus_include_path. This environment variable specifies a list of one or more directory names to search for header files, just like specifying the-isystem option in the command line. Searches for all Directories specified by-isystem.
See cpath, c_include_path, and objc_include_path.
Dependencies_output sets the environment variable for the file name so that the Preprocessing Program writes the dependency-based makefile rule to the file. The system header file name is not included.
If the environment variable is set to a single name, it is regarded as the file name, and the dependency rule name comes from the source file name. If there are two names in the definition, the second name is used as the target name of the dependency rule.
The result of setting the environment variable is the same as the combination of command line options-mm,-MF, and-MT. See also sunpro_dependencies.
If the environment variable is defined, gcc_exec_prefix is used as the prefix of all subroutine names executed by the Compilation Program. For example, if you set the variable to testver
Instead of searching for as, the assembler will first
. If it is not found, the Compilation Program will continue to search for it based on its common name. You can use a slash to indicate the path name in the prefix name.
Gcc_exec_prefix is setPrefix
/Lib/GCC-lib /.Prefix
Is the name specified by the configure script when the program is installed and compiled. This prefix is also used to locate standard connection program files that are included as part of the executable program.
If you use the-B command line option, this setting is overwritten. See compiler_path.
Lang this environment variable is used to indicate the character set used by the compiler. You can create wide character text, string text, and comments.
Defines Lang as a C-JIS, indicating that the preprocessing program interprets multi-byte characters according to JIS (Japanese Industrial Standard) characters. The C-SJIS can be used to indicate the shift-JIS character while the C-EUCJP points out the Japanese EUC.
If Lang is not defined or is defined as unidentifiable, the function mblen () is used to determine the character width, while mbtowc () is used to convert a multibyte sequence to a wide character.
If lc_all is set, the environment variable value overwrites all the settings of lc_messages and lc_ctype.
Lc_ctype
This environment variable indicates the character classification of Multi-byte characters defined in the reference string. It is mainly used to determine the character boundary of a string. character encoding requires quotation marks or escape characters, which can be incorrectly interpreted as the end or special word of a string.
String. For semantic Alian English, you can set it to en_au; for Mexican Spanish, you can set it
Es_mx. If this variable is not set, the default value is the Lang variable value, or if Lang is not set, then use C English behavior. See lc_all.
Lc_messages this environment variable specifies the language in which the compiler uses to send diagnostic messages. You can set this parameter to en_au for Australian English;
For mexicanspanish, you can set it to es_mx. If the variable is not set, use the default value of the Lang variable, or if the Lang variable is not set
Then use C English. See lc_all.
LD_LIBRARY_PATH this environment variable does not affect the Compilation Program, but will affect the program running. The variable specifies a directory list, and the program searches for the list to locate the shared library. This variable must be set only when the shared library is not found in the compiled program directory.
Ld_run_path this environment variable does not affect the compilation program, but it may affect the program running. This variable indicates the name of the file during running. The running program obtains its symbolic name and address. The address is not reloaded, so it may reference the absolute address in other files. This is exactly the same as the-r option used by the LD tool.
LIBRARY_PATH this environment variable can be set to a list of one or more directory names, the Connection Program will search for this directory to find the special connection program file, and by-l (letterL
) The command line option specifies the database name.
The directory specified by the-l command line option is located before the environment variable and is first searched. See compiler_path.
Objc_include_path uses this environment variable when compiling the objective-C program. The list of one or more directory names is specified by the environment variable to find the header file, just as if the-isystem option is specified in the command line. All Directories specified by the-isystem option are first searched.
See cpath, cplus_include_path, and c_include_path.
Sunpro_output sets the environment variable for the file name so that the Preprocessing Program writes the dependency-based makefile rule to the file. Will contain the system header file name.
If the environment variable is set to a single name, it will be treated as a file name, and the name in the dependency rules will be obtained from the name of the source file. If there are two names in the definition, the second name is the target name in the dependency rule.
The result of setting the environment variable is the same as that of using the-M,-MF, and-MT parameters in the command line. See dependencies_output.
The tmpdir variable contains the path name of the directory for the Compilation Program to store temporary work files. These files are usually deleted at the end of the compilation process. An example of this type of file is the file output by the Preprocessing Program and input to the Compilation Program.