lamuguo / re2

Automatically exported from code.google.com/p/re2
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

re2 fails to build on OS X 10.9 out of the box #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Solution: 

1. Add -DUSE_CXX0X to CXXFLAGS.
2. Empty libre2.symbols.darwin. 

Otherwise it won't build and won't link. I'm not sure if that is a right 
solution. 

Original issue reported on code.google.com by egor.egorov@gmail.com on 20 Oct 2013 at 8:47

GoogleCodeExporter commented 9 years ago
re2 specifically fails with the libc++ standard library from clang, which is 
now the default C++ stdlib on 10.9.

There are a couple of problems:

* re2 accesses unordered_list via the tr1 prefix. libc++ doesn't implement the 
tr1 version, just the version that was standardized in C++11.
* If c++ is told to build with libstdc++, the build fails at linktime: 
https://gist.github.com/mistydemeo/90ff352b9be5c00b3b4c

If -stdlib=libstdc++ is passed in both CXXFLAGS and LDFLAGS, re2 will build, 
but the resulting library is ABI incompatible with C++ software linked against 
the default OS C++ stdlib.

Original comment by mistyde...@gmail.com on 24 Oct 2013 at 6:39

GoogleCodeExporter commented 9 years ago
Looks like the libc++ issue was previously reported in #76, which has a patch. 
(However, that patch doesn't work for me - it fails while linking.)

Original comment by mistyde...@gmail.com on 24 Oct 2013 at 6:41

GoogleCodeExporter commented 9 years ago
Here is a patch that solves the following issues with building on OS X 10.9.

1. Build with C++11 support. This requires the macro -DUSE_CXX0X and -std=c++11 
in the Makefile. This will resolve the unordered_set include problem.

2. OS X 10.9 has switched to defaulting to libc++ instead of libstdc++. This 
has caused some of the symbols being exported to be wrong. In particular, this 
is the std::ostream << overload. I've included in the patch the correct encoded 
name.

Original comment by will...@lynch.us on 3 Nov 2013 at 4:09

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 975db9909185.

Original comment by rsc@swtch.com on 10 Jan 2014 at 1:49