5

I'm trying to build google-glog on Mac OS X 10.8, using following options:

./configure CXX='clang++' CXXFLAGS='-std=c++11 -stdlib=libc++'

Despite that the library gets linked with libstdc++.

Why, and how to fix this?

rincewind
  • 1,103
  • 8
  • 29

2 Answers2

8

It's better to put 'dialect' and runtime flags in the compiler variable, since it will use those flags for linking - not just source compilation: CXX="clang++ -std=c++11 -stdlib=libc++"

Save CXXFLAGS for things like -W -Wall -O2 -march=xxx, etc.

Brett Hale
  • 21,653
  • 2
  • 61
  • 90
  • I noticed that on macOS when building for iOS, I cannot append the `stdlib=libc++` to CXX with `clang++`. Must append it to CC with `clang` instead. Otherwise Autotools would fail to configure the C++ compiler. – kakyo Jul 03 '20 at 09:16
0

Found out that you could use the build variable

LIBS+="-stdlib=libc++"

Seems to me a better place than the compiler variables.

kakyo
  • 10,460
  • 14
  • 76
  • 140