Project

General

Profile

Support #690

Updated by Daniel Curtis about 9 years ago

Every once in a while I need to compile a program with GCC, instead of the default FreeBSD compiler Clang. To accomplish this I install the latest GCC and set it over Clang with environment variables. 

 * Install GCC: 
 <pre> 
 pkg install gcc49 
 </pre> 
 #* (Optional) Install GCC from the ports tree: 
 <pre> 
 cd /usr/port/lang/gcc49 
 make install clean 
 </pre> 

 * Set the CC, CXX, and CPP environment variables to use GCC: 
 <pre> 
 setenv CC gcc49 
 setenv CXX g++49 
 setenv CPP cpp49 
 </pre> 
 #* (Optional) Environment variables can be set at build time: 
 <pre> 
 env CC="gcc49" CXX="g++49" CPP="cpp49" CFLAGS="-std=c++11" make 
 </pre> 

 h2. Resources 

 * http://unix.stackexchange.com/questions/130639/how-do-i-install-the-latest-gcc-on-freebsd

Back