Autotools/libtool link library with libstdc++ despite -stdlib=libc++ option passed to configure
Asked Answered
P

2

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?

Palpate answered 27/4, 2013 at 4:30 Comment(0)
S
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.

Semantics answered 27/4, 2013 at 4:53 Comment(1)
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.Rosiarosicrucian
R
0

Found out that you could use the build variable

LIBS+="-stdlib=libc++"

Seems to me a better place than the compiler variables.

Rosiarosicrucian answered 6/7, 2020 at 3:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.