Hi Nicolas, Thank you for the reply, it works (though I also had to add -std=c++11 to CXXFLAGS). I indeed previously tried to pass -stdlib=libc++ to the linker, but used LDFLAGS by mistake. Passing LDXX as you proposed solved the problem.
Thanks! Alex On Tuesday, July 11, 2017 at 10:19:17 AM UTC+3, Nicolas Noble wrote: > > This seems a very straightforward problem: you're specifying > -stdlib=libc++ at compilation time, using clang, but you're not overriding > the linker nor its options. Moreover, you're using HOST_* variables, which > are normally used for cross-compilation. I doubt this is what you want > given the context you're saying. > > Here's what you should be doing: > > export CXX=clang++ > export CXXFLAGS=-stdlib=libc++ > export LDXX="clang++ -stdlib=libc++" # yep, I just realized that's a bug > we have here to not properly support LDXXFLAGS, so you're going to have to > use that ugly form instead. > > Also, if you really want the pure C part to be compiled using clang, you'd > need to add > export CC=clang > > but that's got quite nothing to do with using libc++, so it's not a good > reason to try and hurt yourself there. > > On Mon, Jul 10, 2017 at 11:09 AM, <[email protected] <javascript:>> wrote: > >> >> Hi, >> >> I'm trying to build gRPC v1.4.1 as following. I have all the required >> third party libraries built (with Clang and libc++) and installed (besides >> boringssl which is cloned inside third_party and built recursively). >> >> I'm running make as following: >> >> make HOST_CC=clang HOST_CXX="clang++ -stdlib=libc++ -std=c++11" CC=clang >> CXX="clang++ -stdlib=libc++ -std=c++11" >> >> and I get an error during linkage of the protoc gRPC plugin: >> >> [HOSTLD] Linking /grpc-1.4.1/bins/opt/grpc_cpp_plugin >> >> /usr/bin/ld: /grpc-1.4.1/objs/opt/src/compiler/cpp_plugin.o: undefined >> reference to symbol '_ZNSt3__18ios_base4initEPv' >> >> //usr/lib/x86_64-linux-gnu/libc++.so.1: error adding symbols: DSO missing >> from command line >> >> collect2: error: ld returned 1 exit status >> >> make: *** [/grpc-1.4.1/bins/opt/grpc_cpp_plugin] Error 1 >> >> My constraint is that I really need to build with libc++. The whole thing >> does work if I build with libstdc++ (given protobuf is built with libstdc++ >> as well). >> >> I really need your help here, thank you! >> >> Alex >> >> -- >> You received this message because you are subscribed to the Google Groups >> "grpc.io" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/grpc-io. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/grpc-io/d37d91eb-d75e-4d4b-b6b3-b55424705e30%40googlegroups.com >> >> <https://groups.google.com/d/msgid/grpc-io/d37d91eb-d75e-4d4b-b6b3-b55424705e30%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/06694826-146f-4bce-be44-bf3727fd8059%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
