How to link libstdc++ statically with clang++

clang, llvm, static-linking

Solution

The flag you're looking for, in both GCC and Clang, is: `-static-libstdc++`

Problem

I'm trying to learn C++ deeper by reading source of STL as well as debugging it, so I want to link `libstdc++` statically to my program, and it works fine using `g++`. However, how can I achieve the same thing with `clang++` in llvm? In another way, the question is, what is the `clang++` equivalent of `-static-libgcc`? `Makefile` I'm using ``` CXX=g++ CC=g++ LDFLAGS=-g -O0 -static-libgcc CFLAGS=-O0 -Wall CXXFLAGS=$(CFLAGS) ```

Original source