How do I change which compiler is used?

From DANSE

(others PLEASE CONFIRM) Override the default compiler with the TARGET_COMPILER environment variable. For example, to use Portland Group compilers instead of the default gcc on linux,


$ export TARGET_COMPILER=PGI


If one wanted to change to the PGI compiler for only one langauge, say fortran 77, one could specify


$ export TARGET_F77=PGI


Similarly, there are TARGET_CC and TARGET_CXX variables for C and C++, respectively. These changes can be made from the shell command line for a single session, or one might put them into one's .tools file to take effect for every session. Alternatively, one could change these in config/target/target.def, but that change will get wiped out any time one upgrades.


For this to work, the compiler needs to be specified in config/compiler; this means there needs to be a subdirectory with the name of the compiler in config/compiler.


Note that for most compilers, there are really several subdirectories. One will have a generic name for the compiler, for example gcc, while others will have the compiler name and a version number. mm will look up the *.def files from the generic directory, which really just include the *.def files from one particular version, typically the most recent. This allows one to have different specifications for different versions of a given compiler.

Personal tools
Document Uploads/Links