Page MenuHomePhabricator

Add support in CMake to statically link the C++ standard library.
ClosedPublic

Authored by erichkeane on Thu, Aug 1, 1:04 PM.

Details

Summary

It is sometimes useful to have the C++ standard library linked into the
assembly when compiling clang, particularly when distributing a compiler
onto systems that don't have a copy of stdlibc++ or libc++ installed.

This functionality should work with either GCC or Clang as the host
compiler, though statically linking libc++ (as may be required for
licensing purposes) is only possible if the host compiler is Clang with
a copy of libc++ available.

Diff Detail

Repository
rL LLVM

Event Timeline

erichkeane created this revision.Thu, Aug 1, 1:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Aug 1, 1:04 PM
Herald added a subscriber: mgorny. · View Herald Transcript

Unfortunately, this ends up adding a warning or two to the build if you enable this, since we have a couple of things built in "C" (flag not used...). In the 'clang' test I did, ./bin/count was the only one. Unfortunately, we don't have separate C vs C++ linking flags, so I think this is just something that someone using this flag needs to deal with.

Does anyone have issues with this? Can I commit it?

This revision was not accepted when it landed; it landed in state Needs Review.Wed, Aug 14, 12:55 PM
This revision was automatically updated to reflect the committed changes.