Skip to content

Conversation

@springmeyer
Copy link
Contributor

@springmeyer springmeyer commented Jul 26, 2017

Context

The llvm package contains a nearly complete, cross-platform, toolchain for building and linking C++ code. Normally this would be provided by the operating system (g++ toolchain on linux or XCode on mac). Instead we package the llvm suite of compilers in mason to enable upgrading your systems toolchain quickly via mason. The advantages of this are:

  • We can fully control the compiler version on both OS X and Linux, and upgrade seamlessly
  • We can install extra development tools like lldb, clang-tidy, clang-format, and include-what-you-use
  • The latest clang-tidy and santizers inside clang++ (compiler-rt specifically) often are able to catch new bugs not detected by previous llvm/clang++ versions, so using the latest is ideal.
  • We can package these extra development tools in a way that allows just the minimal tools to be installed, in a fast and lightweight way. For example, while the entire llvm toolchain is over 1.6GB, clang-tidy is just 21 MB and clang++ is just 44 MB. Packaging these tools separately allows them to be installed fast on travis.ci, circle, or locally.

This PR

Adds llvm 4.0.1 and related sub-packages, closing #438. This improves upon #451, by additionally adding:

  • A readme describing exactly how to create a new llvm package
  • Updated script to automatically create packages for all the sub-packages (Add llvm 4.0.1 #451 missed include-what-you-use, lldb, and llvm-cov)
  • A fix to avoid building libc++ on OS X (since we don't use it/link to it and instead use the system version)
  • Adds a dockerfile to support consistent method of building on linux binaries
  • Modifies the llvm/base/common.sh to allow pointing at a custom gitsha for a given sub-package - needed in the case of include-what-you-use which did not have a tag that worked yet with llvm 4.x.

@springmeyer
Copy link
Contributor Author

/cc @tmpsantos - this improves upon the packages you added.

@springmeyer
Copy link
Contributor Author

@daniel-j-h tagged you for review on this since I know you've been interested in the process of creating these packages being documented. The docs are now at https://github.com/mapbox/mason/blob/d6dbdad607b4a61ce4b70a119aec4147db3e262b/scripts/llvm/base/README.md. Would appreciate your 👍 before merging.


LLVM_VERSION="4.0.2"
docker run -it --volume $(pwd):/home/travis/build/mapbox/mason mason-llvm \
./mason build llvm ${LLVM_VERSION} && ./utils/llvm.sh build ${LLVM_VERSION}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this misses the code-blocks backticks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 added in c5596d5

RUN apt-get update -y && \
apt-get install -y vim python build-essential bash curl git-core ca-certificates software-properties-common python-software-properties --no-install-recommends

RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm I guess pull this ppa in for a recent C++ stdlib version. But why exactly? Does building llvm or any of the binaries need a recent stdlib? We do not link to the stdlib in the binaries anyway, no? I don't quite follow here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! This is only needed for libstdc++6: an updated version of that is needed at runtime by cmake. It is not a compile/link dependency of llvm, so I've added comments about this to the Dockerfile to make this clear: 1c73eb6.

Copy link
Contributor

@daniel-j-h daniel-j-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, thanks for making this more transparent!! 🙇 Looks good from my side - some minor comments on the changeset.

@springmeyer springmeyer merged commit bd97cb9 into master Aug 3, 2017
@springmeyer springmeyer deleted the llvm-4.0.1 branch August 3, 2017 22:46
This was referenced Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants