Customizing the compilation environment

This section discusses the mechanisms used by XL C/C++ to specify the search paths for directories containing include files, libraries, and the location of a GNU C or C++ compiler. These mechanisms are environment variables, include files, attributes in a configuration file, and command-line options. The vac_configure utility is provided to facilitate the creation of valid configuration files.

The important search paths for XL C/C++ are the standard directory locations for:

Related Reference


Environment variables

Part of the compilation environment are the search paths for special files such as libraries and include files. The following system variables are used by the compiler.

LD_LIBRARY_PATH
Specifies the directory path for dynamically loaded libraries. Used by the GNU linker at link time and at run time.

LD_RUN_PATH
Specifies additional directory paths to be searched at run time for dynamically loaded libraries. The setting does not affect the search paths used by the GNU linker at link time.

MANPATH
Specifies the directory path for the product man pages.

NLSPATH
Specifies the directory path of National Language Support libraries.

PATH
Specifies the directory path for the executable files of the compiler.

PDFDIR
Specifies the directory in which the profile data file is created. The default value is unset, and the compiler places the profile data file in the current working directory. Setting this variable to an absolute path is recommended for profile-directed feedback.

TMPDIR
Specifies the directory in which temporary files are created. The default location may be inadequate at high levels of optimization, where temporary files can require significant amounts of disk space.

Setting up the environment for the invocation commands

The command-line interfaces for XL C/C++ are not automatically installed in /usr/bin. To invoke the compiler without having to specify the full path, do one of the following steps:

Ensure the correct NLSPATH for the message catalogs

The NLSPATH environment variable informs the compiler how to find the appropriate message catalogs.

To ensure that the path is correct, issue the following command:

export NLSPATH=$NLSPATH:smprt-path/msg/%L/%N:
  compiler-path/vacpp/6.0/msg/%L/%N

where smprt-path and compiler-path are the installation locations specified when you installed the packages.

Note:
If the default installation location is used, then smprt-path and compiler-path will both be /opt/ibmcmp.

Include files

The locations for GNU, IBM, and system header files are most conveniently specified in a configuration file.

The compiler option -I directory_name allows you to add directories to the search paths in the configuration file. The configuration file itself uses the -I option internally to set the directory paths that it controls. The compiler searches the directories specified by -I within the configuration file before searching those specified by -I options on the command line.

See XL C/C++ Compiler Reference for more information.

Related References

IBM Copyright 2003