Commit ab89a712 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

Set up environment: soften the assertions about STL vendors to reflect feedback from Laurent.

parent 3da2d679
......@@ -14,7 +14,7 @@
},
"source": [
"<h1>Table of contents<span class=\"tocSkip\"></span></h1>\n",
"<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#Introduction\" data-toc-modified-id=\"Introduction-1\">Introduction</a></span></li><li><span><a href=\"#Installing-a-compiler\" data-toc-modified-id=\"Installing-a-compiler-2\">Installing a compiler</a></span><ul class=\"toc-item\"><li><span><a href=\"#Ubuntu-/-Debian\" data-toc-modified-id=\"Ubuntu-/-Debian-2.1\">Ubuntu / Debian</a></span></li><li><span><a href=\"#Fedora\" data-toc-modified-id=\"Fedora-2.2\">Fedora</a></span><ul class=\"toc-item\"><li><span><a href=\"#g++\" data-toc-modified-id=\"g++-2.2.1\">g++</a></span></li><li><span><a href=\"#clang++\" data-toc-modified-id=\"clang++-2.2.2\">clang++</a></span></li></ul></li><li><span><a href=\"#macOS\" data-toc-modified-id=\"macOS-2.3\">macOS</a></span></li></ul></li><li><span><a href=\"#Editor\" data-toc-modified-id=\"Editor-3\">Editor</a></span></li><li><span><a href=\"#Software-configuration-manager\" data-toc-modified-id=\"Software-configuration-manager-4\">Software configuration manager</a></span></li><li><span><a href=\"#Build-system\" data-toc-modified-id=\"Build-system-5\">Build system</a></span></li></ul></div>"
"<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#Introduction\" data-toc-modified-id=\"Introduction-1\">Introduction</a></span></li><li><span><a href=\"#Installing-a-compiler\" data-toc-modified-id=\"Installing-a-compiler-2\">Installing a compiler</a></span><ul class=\"toc-item\"><li><span><a href=\"#Ubuntu-/-Debian\" data-toc-modified-id=\"Ubuntu-/-Debian-2.1\">Ubuntu / Debian</a></span><ul class=\"toc-item\"><li><span><a href=\"#Clang\" data-toc-modified-id=\"Clang-2.1.1\">Clang</a></span></li><li><span><a href=\"#Default-g++\" data-toc-modified-id=\"Default-g++-2.1.2\">Default g++</a></span></li><li><span><a href=\"#More-recent-gcc\" data-toc-modified-id=\"More-recent-gcc-2.1.3\">More recent gcc</a></span></li></ul></li><li><span><a href=\"#Fedora\" data-toc-modified-id=\"Fedora-2.2\">Fedora</a></span><ul class=\"toc-item\"><li><span><a href=\"#g++\" data-toc-modified-id=\"g++-2.2.1\">g++</a></span></li><li><span><a href=\"#clang++\" data-toc-modified-id=\"clang++-2.2.2\">clang++</a></span></li></ul></li><li><span><a href=\"#macOS\" data-toc-modified-id=\"macOS-2.3\">macOS</a></span></li></ul></li><li><span><a href=\"#STL\" data-toc-modified-id=\"STL-3\">STL</a></span></li><li><span><a href=\"#Editor\" data-toc-modified-id=\"Editor-4\">Editor</a></span></li><li><span><a href=\"#Software-configuration-manager\" data-toc-modified-id=\"Software-configuration-manager-5\">Software configuration manager</a></span></li><li><span><a href=\"#Build-system\" data-toc-modified-id=\"Build-system-6\">Build system</a></span></li></ul></div>"
]
},
{
......@@ -29,11 +29,33 @@
"\n",
"## Installing a compiler\n",
"\n",
"### Ubuntu / Debian\n",
"\n",
"For Ubuntu I recommend using `g++`: setting up `clang++` along with its standard library is rather dreadful... (but you may easily us `clang` with GNU standard library `libstdc++`; I just don't like to mix them up).\n",
"### Ubuntu / Debian"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Clang\n",
"\n",
"To install g++ you may use the line:\n"
"To install `clang` you need to specify explicitly the required version, e.g.:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"// In a terminal\n",
"sudo apt-get install -y clang++-11"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Default g++"
]
},
{
......@@ -50,9 +72,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### More recent gcc\n",
"\n",
"However, Ubuntu is rather conservative and the version you get might be a bit dated and it might be problematic if you intend to use the bleeding-edged features from the latest C++ standard (even if it's now better than what it used to be: with Ubuntu 18.04 you get the decent g++-7.3 now and gcc-9.3 with 20.04). \n",
"\n",
"To get a more recent version, you need to use a [PPA](https://launchpad.net/ubuntu/+ppas):"
"To get a more recent version, you need to use this [PPA](https://launchpad.net/ubuntu/+ppas):"
]
},
{
......@@ -171,6 +195,31 @@
"It is also possible to install gcc on macOS; I personally use [Homebrew](https://brew.sh) to do so.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## STL\n",
"\n",
"Besides the compiler, you may also choose which implementation of the STL you want to use. There are two mainstream choices:\n",
"\n",
"- `libstdc++`, which is the STL provided along gcc by GNU. This is the default choice for many Linux distro, ahd there is fat chance the binaries, libraries and share libraries in your package system was compiled with this one.\n",
"\n",
"- `libc++`, which is the STL provided along clang by LLVM. It is the default choice on macOS, and was until recently a pain to use with Ubuntu (according to Laurent it is much better now in Ubuntu 20.04.\n",
"\n",
"Both are pretty solid choices:\n",
"\n",
"- Going with `libstdc++` is not a bad idea if you're using with your code libraries from your package manager that uses up this STL implementation (likely in a Linux distro).\n",
"- Going with `libc++` along with clang++ seems rather natural as well."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Just a note for compatibility: `libc++` tends to provide more `include` directive in its header files than `libstdc++`. So don't be astonished if your code compiles well with `libc++` but complains about an unknown symbol from STL with `libstdc++` (and the patch is simply to use the missing include - a tool such as IncludeWhatYouUse would have underlined the missing include even when using `libc++`)."
]
},
{
"cell_type": "markdown",
"metadata": {},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment