CppCon 2108 Call For Submissions

CppCon is the annual, week-long, face-to-face gathering for the entire C++ community, organized by C++ the community for the C++ community.  This is an outstanding conference for the professional C++ programmer, and I’m proud to serve as its Poster Chair.

Proposals for talks at CppCon 2018 are now being accepted, through May 11, with decisions sent by July 1.  To submit a proposal, see the guidelines on the Call For Submissions page.

I’m Speaking at C++Now 2018!

C++Now, a meeting C++ experts from around the worldI’m very pleased to announce that I’ll be presenting three talks this year at C++Now 2018:

This is my second time attending C++Now; I attended for the first time last year when I gave a talk entitled “Testing the Limits of Allocator Awareness“.   Here’s the video for you allocator nerds… 🙂  This is the conference to attend for an in-depth and technical C++ experience like no other.

Building Clang on Linux

GCC is not the only open source C++ compiler that’s available out there on the interwebs — there’s also Clang, which is part of the LLVM Compiler Infrastructure. Each has its strengths and weaknesses, and both are excellent compilers for a wide variety of platforms. Whenever possible, I try to compile the Linux code I write with both compilers, for the simple reason that sometimes one will catch an error or emit a warning that the other one missed. I find that having my code build cleanly with at least two compilers and all warnings enabled is a useful best practice for improving code quality.

As it turns out, Clang on Linux has a very interesting capability: it can use GCC’s version of the standard C++ library (libstdc++), or its own version (libc++). The choice of standard library may be specified using a command-line argument (-stdlib=libstdc++ or -stdlib=libc++, respectively). Furthermore, if you have multiple versions of GCC installed on your Linux system, you can provide an optional command-line argument to Clang that specifies the GCC version whose libstdc++ you want to use (--gcc-toolchain=<path>).

This post is a followup to Building GCC on Linux, and in it I’m going to describe a set of scripts I wrote for building Clang on Linux. I call this collection clang-builder and it is available on GitHub. (continue…)

Building GCC on Linux

I have a confession to make: I’m a bit of a compiler hoarder. As I write this, the CentOS-7 virtual machine on my workstation at home has eleven versions of GCC and ten versions of Clang installed. I like to have multiple versions of GCC and Clang available on my various Linux-based home and work systems so that I can easily compare old and new behavior, check for performance improvements and bug fixes, explore new language features, and retain the stability of previous compiler releases that have proven themselves.

However, there’s often a practical problem when trying to do this. The standard compiler installations blessed and distributed by the major Linux distros typically install into the system directories /usr/bin and /usr/lib. That’s fine if you only need one version of GCC and/or Clang, but it doesn’t work so well when you want multiple versions. Upgrade packages usually replace the existing compiler, which is not the behavior we want. Packages that attempt to install additional new versions can sometimes overwrite the files of an existing installation, resulting in a mis-configuration of one or more versions.

There are also cases where it’s impermissible or undesirable to add or change files in the system directories. Company policy may prohibit you from installing software there (although this seems less and less likely in modern software development shops). Or perhaps you need to develop on a system that is configured as closely as possible to production systems, and so system directory changes are discouraged.

In any event, it would be great if there was a way to install an arbitrary number of compilers on your system independently of each other, and with no changes to the standard system directories. It’s possible, but does require a little work. In short: you must build it yourself! As it turns out, GCC and Clang are remarkably flexible in how they can be configured and built, and we’re going to use that flexibility to our advantage.

In this post I’m going to describe a set of scripts I wrote for building GCC such that each installed version is completely independent of every other installed version, allowing you add or remove them at will without affecting the system directories. (continue…)

Welcome to the Machine!

Welcome to the inaugural post of The State Machine.  My name is Bob Steagall, and lately I’ve been in the pipeline filling in time (sorry, I couldn’t resist). I created this blog to put down some thoughts about C++, software engineering, and other tangentially-related areas of interest. I expect to cover a wide variety of topics related to C++ – tips, techniques, tutorials, tools, news, algorithms, and perhaps even some noteworthy applications. I may also pen the occasional opinion (or rant, depending on your perspective) regarding the current state of software engineering and processes that claim to improve software quality. (continue…)