Download the gcc source into a folder named gcc-concepts-latest. Note that if you run this command too many times, the GNU SVN server will block your IP address and you won’t be able to download their stuff for awhile.
--enable-languages=c,c++ — gcc also supports languages like Ada and FORTRAN. Since we only care about C and C++, do not waste time compiling the frontends for any other languages. This also improves iteration time in case you get compile errors.
--disable-multilib — Only build support for this computer’s architecture and calling convention.
Having the build directory inside the source directory is technically not supported by gcc, so we moved the build directory outside. (However, nothing bad happens if you keep it inside…)
make -j8 # replace '8' with the number of CPUs on your computer
Now, there should be a bunch of gcc executables and libraries in ~/install/gcc-concepts-latest/. To verify this:
To make our freshly compiled gcc and libstdc++ the default, add this to your .profile or similar:
The first line makes your shell search for gcc in our install directory before looking elsewhere.
The second causes the dynamic linker to link your applications with our libstdc++. It is important to use the same standard library when compiling and running the program.
Get the concepts-enabled standard library
If you want to develop your own applications or libraries using concepts, it is easiest if you are able to use the prewritten constraints. That way, you don’t have to write things like Function or Number by yourself.