How to enable libc++ support for llvm?

Solution In Progress - Updated -

Issue

  • llvm-toolset-12.0 missing libc++
  • When using the llvm-toolset-12.0 to compile C++ code with the clang++ -stdlib=libc++ flag, standard library header files are not found.
$ clang++ -stdlib=libc++ hello-world.cpp 
hello-world.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^~~~~~~~~~
1 error generated.

Environment

  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7
  • LLVM Toolset compiling with Clang libc++ standard library instead of GCC G++ libstdc++

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content