-
Notifications
You must be signed in to change notification settings - Fork 435
9_CXX
STOP! This page is out-of-date and is superseded by the docs
In Psi4, a C++ compiler is vital for building the code.
-
#####Build with Auto-detected Compilers in $PATH
setup
-
#####Build with Specific (Intel) Compilers in $PATH
setup --cc icc --cxx icpc
-
#####Build with Specific (GNU) Compilers not in $PATH
setup --cc /opt/gcc480/bin/gcc --cxx /opt/gcc480/bin/g++
-
#####Build with OpenMP Clang on Mac
setup --cc /path/to/bin/clang-omp --cxx /path/to/bin/clang-omp ```
-
#####Relevant
setup
Options:--cc STRING set the C compiler [default: pick automatically or based on CC=...] (default: None) --cxx STRING set the C++ compiler [default: pick automatically or based on CXX=...] (default: None) --extra-cc-flags STRING additional C flags [default: None] --extra-cxx-flags STRING additional C++ flags [default: None] --custom-cc-flags STRING replacement [default: None] --custom-cxx-flags STRING replacement [default: None]
-
#####Relevant
cmake
Options:-DCMAKE_C_COMPILER=STRING - C compiler -DCMAKE_CXX_COMPILER=STRING - C++ compiler -DEXTRA_C_FLAGS="STRING" - additional C flags -DEXTRA_CXX_FLAGS="STRING" - additional C++ flags -DCUSTOM_C_FLAGS="STRING" - replacement C flags -DCUSTOM_CXX_FLAGS="STRING" - replacement C++ flags
-
Dependency Status: Required
-
##### What C and C++ compilers are approved
- On Linux,
gcc
/g++
(GNU; default) andicc
/icpc
(Intel) work nicely. - On Mac,
clang
(Apple; default) andicc
/icpc
(Intel) work nicely.
- On Linux,
-
##### What GCC fundamental libraries are approved
Even building with Intel compilers relies on fundamental libraries like
libgcc
andlibc++
, so its version (gcc --version
) matters.-
4.7
and4.8
work nicely. -
4.6
has reported problems. -
5.1
has reported problems building (basisset.cc
) and linking with Boost (which isn't building against 5 yet).
-
-
##### What are known contraindicated Intel
icpc
versions- An error
identifier "__is_trivial" is undefined
has been reported with 12.0.2 that is fixed by 12.0.4 - C++11 errors have been reported with 13.0.1
- If you are willing to live without some Psi4 features, for icpc 13.2, I was able to compile the code by changing the following C++11 lines:
- Comment out lines 439 through 441 of src/bin/fisapt/fisapt.cc
- Remove the "=false" part of lines 61 through 63 src/bin/optking/frag_apply_frozen_constraints.cc
- It probably goes without saying, but in case it doesn't, don't use these parts of the code (SAPT and geometry optimzations) after making these changes.
- An error
-
##### How to set C and C++ compiler flags for the whole project and plugins
- specifying the build type via
setup --type=[{release,debug,profile}]
sets some sensible defaults fromCXXFlags.cmake
andCFlags.cmake
for the three cases. -
OR by specifying the build type and some
--extra-cc-flags
and/or--extra-cxx-flags
to be appended to the default flags. No checks are performed for compatibility with the defaults. -
OR by specifying
--custom-cc-flags
and/or--custom-cxx-flags
to replace the default flags. No checks are performed for suitability.
- specifying the build type via
-
Packages to install for specific OS or package managers:
- Ubuntu
g++
- Ubuntu
-
##### How to obtain C and C++ compilers for Mac without Fink, MacPorts, or Homebrew
The easiest compiler to obtain is
clang
which is a drop-in replacement forgcc
andg++
. Just install XCode. OS X Mavericks and Yosemite are approved; XCode on older versions can't handle some of the advanced C++ language features. Note that this is a software not hardware limitation. As of June 2015, Psi4 can be compiled on a ca. 2009 Mac with approved OS.