Conda is a package manager, which arose from the Data Science and Python community to manage complicated binary and source deployments.
It can be leveraged for non-Python environments also.
From our experience of COMP6771 2020, we required an install of clang, along with C++ libraries.
So, the steps to install all of this (excepting ranges) is:
-
Install conda from here or use a local installer such as winget (Windows 10), brew (MacOS) or apt (Debian).
-
Create a conda environment and install clang and the C++ libraries above.
conda create -n COMP6771
conda activate COMP6771
conda install -y -c conda-forge/label/llvm_rc clangdev
conda install -y -c conda-forge abseil-cpp gsl-lite fmt catch2
-
Test that clang v11.0.0 is available with
clang --version
-
Test that the libraries are available with this short C++ program attached,
test.cpp
, by running the build scriptbuild.ps1
on Windows, ortest_install.sh
on MacOS/Linux.
Please note that to run clang, you need to be in conda, and you need to activate the environment with conda activate <environmentname>
for everything to be set up.
To understand a C++ build environment, it is nearly identical to a C build environment. It is made up of include files which are in the include directories, and the library files which are in the lib directories.
Conda here has installed the include and lib files in $env:CONDA_PREFIX\Library\include
and $env:CONDA_PREFIX\Library\lib
on Windows, and on MacOS and Linux, these paths will be $CONDA_PREFIX/Library/include
and CONDA_PREFIX/Library/lib
So, to read the build script below, we just use clang to compile our file, but we set the include path to make sure the compiler knows where to find the include files with the -I
flag. Furthermore, gsl-lite requires a certain environment variable to be set for compilation to work, so we use the -D
flag.
iostream.h not found...