Monday, 17 May 2010

Using Alternate Compilers

Using Alternate Compilers

Tuesday, November 15th, 2005 ~ 10:49 pm
Users of Fedora Core 4, SuSE 10.0 and other distributions with GCC v4 may have found some open source softwares may not compile properly. Using alternate compilers may resolve the problem. FC4 also ships with GCC v3.2. There are many ways to specify alternate compilers during the build process, below are some ways.
Environment Variables
Most softwares support the CC and CXX environment variables. First assign them, then run configure or make. Example:
# export CC=gcc32
# export CXX=g++32
# ./configure
A good example can be found on the Redhat Mailing List.
Configure Support
If the software is using the standard GNU automake and configure, then there is a chance it supports other compilers by passing in a setting to the configure script. First run configure --help to see if it mentions anything. The following example is from MPlayer:
# ./configure --help
# ./configure --cc=gcc32
Makefile Support
Sometimes the software may just come with a Makefile. Open the Makefile and look inside to see if there are variables that specify the compiler. You can either edit those variables or set them at compile time. For example:
(in Makefile)
 
C_COMPILER = cc
CPLUSPLUS_COMPILER = c++
Then using the makefile, you can run:
# make CPLUSPLUS_COMPILER=g++32
Although the above examples are not exhaustive they should provide some ideas for using alternate compilers in Fedora Core and other Linux distributions.
I am also providing some notes from my FC4 Guide on GCC and GCC Compatability Libraries.

9 Responses to “Using Alternate Compilers”

  1. Aaron Says:
    # export CC=gcc32
    # export CPP=g++32
    # ./configure
    Please note, it only worked for me when I used CXX (C++ compiler) instead of CPP (pre-processor).


    Reference: http://www.mjmwired.net/linux/2005/11/15/using-alternate-compilers/

1 comment:

Anonymous said...

ciao! come stai? ^ ^ Caloroso saluto!
hai un bel blog 0_0

se hai bisogno di trovare uniche font, potete andare sul nostro sito web.

Con i migliori saluti;