Support #690
Use GCC as the Default Compiler on FreeBSD
Status:
Closed
Priority:
Normal
Assignee:
Category:
Command-Line Help
Target version:
Description
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:
pkg install gcc49
- (Optional) Install GCC from the ports tree:
cd /usr/port/lang/gcc49 make install clean
- (Optional) Install GCC from the ports tree:
- Set the CC, CXX, and CPP environment variables to use GCC:
setenv CC gcc49 setenv CXX g++49 setenv CPP cpp49
- (Optional) Environment variables can be set at build time:
env CC="gcc49" CXX="g++49" CPP="cpp49" CFLAGS="-std=c++11" make
- (Optional) Environment variables can be set at build time: