joshivineet / protobuf

Automatically exported from code.google.com/p/protobuf
Other
0 stars 0 forks source link

Cannot build protobuf with C++11 support in Mac 10.8 #567

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Install latest XCode (5.0) in Mac 10.8.5 or above to have c++11 support with 
clang
2.Configure the compiler to use c++ 11 by run the command 
./configure CC="/usr/bin/clang" CPP="/usr/bin/clang -E" CXX="/usr/bin/clang++" 
CXXCPP="/usr/bin/clang++ -E" CXXFLAGS="-std=c++11 -stdlib=libc++ -arch i386" 
LIBTOOL="/usr/bin/libtool"
3.make

What is the expected output? What do you see instead?
Expected: The lib should be build successfully
Actual: compile stage looks fine. But there are a bunch of link errors related 
std namespace, such as 

libtool: link: /usr/bin/clang++ -dynamiclib  -o .libs/libprotobuf.8.dylib  
.libs/atomicops_internals_x86_gcc.o .libs/atomicops_internals_x86_msvc.o 
.libs/common.o .libs/once.o .libs/stringprintf.o .libs/extension_set.o 
.libs/generated_message_util.o .libs/message_lite.o .libs/repeated_field.o 
.libs/wire_format_lite.o .libs/coded_stream.o .libs/zero_copy_stream.o 
.libs/zero_copy_stream_impl_lite.o .libs/strutil.o .libs/substitute.o 
.libs/structurally_valid.o .libs/descriptor.o .libs/descriptor.pb.o 
.libs/descriptor_database.o .libs/dynamic_message.o .libs/extension_set_heavy.o 
.libs/generated_message_reflection.o .libs/message.o .libs/reflection_ops.o 
.libs/service.o .libs/text_format.o .libs/unknown_field_set.o 
.libs/wire_format.o .libs/gzip_stream.o .libs/printer.o .libs/tokenizer.o 
.libs/zero_copy_stream_impl.o .libs/importer.o .libs/parser.o   -lz  -arch i386 
  -install_name  /usr/local/lib/libprotobuf.8.dylib -compatibility_version 9 
-current_version 9.0 -Wl,-single_module
Undefined symbols for architecture i386:
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find_first_of(char const*, unsigned long, unsigned long) const", referenced from:
      void google::protobuf::SplitStringToIteratorUsing<std::__1::back_insert_iterator<std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*, std::__1::back_insert_iterator<std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in strutil.o

What version of the product are you using? On what operating system?
2.5.0, Mac OS 10.8.5, with XCode 5.0 installed

Please provide any additional information below.

Probably we need some extra parameters to configure the make file. Can you 
provide some instructions on this?

Original issue reported on code.google.com by gang.wu....@gmail.com on 17 Oct 2013 at 7:41

GoogleCodeExporter commented 9 years ago
With XCode 5.0 and OSX 10.8.4 I was able to build (and test) using:

./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g 
-DGTEST_USE_OWN_TR1_TUPLE=1' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"

(There may be a better way to get tr1 tuple, but this works)

Original comment by ccon...@squareup.com on 28 Oct 2013 at 4:07