New issue 121 by heinrich...@gmail.com: Fix Apple clang & libc++ issues
http://code.google.com/p/google-glog/issues/detail?id=121
What steps will reproduce the problem?
1. Install recent Xcode command line tools.
Use
CXXFLAGS="-stdlib=libc++" CC=clang CXX=clang++ ./configure
to configure.
What is the expected output?
Clean build, unit tests execute successfully.
What do you see instead?
Compile fails with
"./src/glog/stl_logging.h:77:11: fatal error: 'ext/slist' file not found"
What version of the product are you using?
glog SVN revision r109.
On what operating system?
Mac OS X 10.7.3, Apple clang version 3.1
Please provide any additional information below.
Even if the inclusion of the missing header is fixed, unit tests would
still fail. This is actually a separate issue, but I will include it here
since it is related to clang and libc++ as well:
In logging.cc, the use of std::strstream in the macro definition
DEFINE_CHECK_STROP_IMPL corrupts memory. This seems to be a general issue
with std::strstream producing garbage. Replacing strstream with the safer
stringstream fixes this issue.
I have attached a patch that fixes the issues reported here. In order to
compile glog on clang with libc++ use the configure command as mentioned
above:
CXXFLAGS="-stdlib=libc++" CC=clang CXX=clang++ ./configure
then
make && make check
should execute successfully.
cheers,
Heinrich
Attachments:
clang_libcpp_patch.patch 3.9 KB
I further removed strstream usage from logging.h.in. This is just a quick
fix, it's probably not optimal as binary sizes increases by a factor of at
least 2 (due to the inclusion of stringstream.h in logging.h.)
- h
Attachments:
further_replacement.patch 801 bytes