I know this is an old thread, but I'm stucking with same at the moment.
What i did. Build gRPC with CMake on Mac. No failures. Then linking libs to
my project and when trying to build get the following
```
libgrpc.a(ssl_transport_security.cc.o):-1: Fehler: Undefined symbols for
architecture x86_64:
"_BIO_get_mem_data", referenced from:
tsi_ssl_get_cert_chain_contents(stack_st_X509*, tsi_peer_property*)
in libgrpc.a(ssl_transport_security.cc.o)
add_pem_certificate(x509_st*, tsi_peer_property*) in
libgrpc.a(ssl_transport_security.cc.o)
"_BIO_get_mem_ptr", referenced from:
aes_gcm_get_openssl_errors() in libgrpc.a(aes_gcm.cc.o)
"_BIO_pending", referenced from:
ssl_handshaker_process_bytes_from_peer(tsi_ssl_handshaker*, unsigned
char const*, unsigned long*) in libgrpc.a(ssl_transport_security.cc.o)
ssl_handshaker_get_bytes_to_send_to_peer(tsi_ssl_handshaker*,
unsigned char*, unsigned long*) in libgrpc.a(ssl_transport_security.cc.o)
ssl_protector_protect(tsi_frame_protector*, unsigned char const*,
unsigned long*, unsigned char*, unsigned long*) in
libgrpc.a(ssl_transport_security.cc.o)
ssl_protector_protect_flush(tsi_frame_protector*, unsigned char*,
unsigned long*, unsigned long*) in libgrpc.a(ssl_transport_security.cc.o)
"_BIO_should_retry", referenced from:
ssl_handshaker_get_bytes_to_send_to_peer(tsi_ssl_handshaker*,
unsigned char*, unsigned long*) in libgrpc.a(ssl_transport_security.cc.o)
"_EVP_DigestSignUpdate", referenced from:
compute_and_encode_signature(grpc_auth_json_key const*, char const*,
char const*) in libgrpc.a(json_token.cc.o)
"_EVP_MD_CTX_create", referenced from:
compute_and_encode_signature(grpc_auth_json_key const*, char const*,
char const*) in libgrpc.a(json_token.cc.o)
"_EVP_MD_CTX_destroy", referenced from:
compute_and_encode_signature(grpc_auth_json_key const*, char const*,
char const*) in libgrpc.a(json_token.cc.o)
"_OPENSSL_free", referenced from:
peer_property_from_x509_common_name(x509_st*, tsi_peer_property*) in
libgrpc.a(ssl_transport_security.cc.o)
add_subject_alt_names_properties_to_peer(tsi_peer*,
stack_st_GENERAL_NAME*, unsigned long) in
libgrpc.a(ssl_transport_security.cc.o)
"_OpenSSL_add_all_algorithms", referenced from:
init_openssl() in libgrpc.a(ssl_transport_security.cc.o)
"_SSL_CTX_add_extra_chain_cert", referenced from:
ssl_ctx_use_certificate_chain(ssl_ctx_st*, char const*, unsigned
long) in libgrpc.a(ssl_transport_security.cc.o)
"_SSL_CTX_get_ex_new_index", referenced from:
init_openssl() in libgrpc.a(ssl_transport_security.cc.o)
"_SSL_CTX_set_session_cache_mode", referenced from:
tsi_create_ssl_client_handshaker_factory_with_options(tsi_ssl_client_handshaker_options
const*, tsi_ssl_client_handshaker_factory**) in
libgrpc.a(ssl_transport_security.cc.o)
"_SSL_CTX_set_tlsext_servername_arg", referenced from:
tsi_create_ssl_server_handshaker_factory_with_options(tsi_ssl_server_handshaker_options
const*, tsi_ssl_server_handshaker_factory**) in
libgrpc.a(ssl_transport_security.cc.o)
"_SSL_CTX_set_tlsext_servername_callback", referenced from:
tsi_create_ssl_server_handshaker_factory_with_options(tsi_ssl_server_handshaker_options
const*, tsi_ssl_server_handshaker_factory**) in
libgrpc.a(ssl_transport_security.cc.o)
"_SSL_CTX_set_tlsext_ticket_keys", referenced from:
tsi_create_ssl_server_handshaker_factory_with_options(tsi_ssl_server_handshaker_options
const*, tsi_ssl_server_handshaker_factory**) in
libgrpc.a(ssl_transport_security.cc.o)
"_SSL_CTX_set_tmp_ecdh", referenced from:
populate_ssl_context(ssl_ctx_st*, tsi_ssl_pem_key_cert_pair const*,
char const*) in libgrpc.a(ssl_transport_security.cc.o)
"_SSL_library_init", referenced from:
init_openssl() in libgrpc.a(ssl_transport_security.cc.o)
"_SSL_load_error_strings", referenced from:
init_openssl() in libgrpc.a(ssl_transport_security.cc.o)
"_SSL_set_tlsext_host_name", referenced from:
create_tsi_ssl_handshaker(ssl_ctx_st*, int, char const*,
tsi_ssl_handshaker_factory*, tsi_handshaker**) in
libgrpc.a(ssl_transport_security.cc.o)
"SharedLock::SharedLock(CReadWriteLock&, bool)", referenced from:
UssGrpcClient::isChannelConnected(CAutoPtr<wchar_t>*, unsigned int*)
in UssGrpcClient.o
"SharedLock::~SharedLock()", referenced from:
UssGrpcClient::isChannelConnected(CAutoPtr<wchar_t>*, unsigned int*)
in UssGrpcClient.o
"ExclusiveLock::ExclusiveLock(CReadWriteLock&, bool)", referenced from:
UssGrpcClient::init(unsigned int*, bool) in UssGrpcClient.o
"ExclusiveLock::~ExclusiveLock()", referenced from:
UssGrpcClient::init(unsigned int*, bool) in UssGrpcClient.o
"CReadWriteLock::CReadWriteLock(bool)", referenced from:
UssGrpcClient::UssGrpcClient(wchar_t const*) in UssGrpcClient.o
UssGrpcClient::UssGrpcClient(UssGrpcClient*) in UssGrpcClient.o
"IGarbageCollectedObject::IGarbageCollectedObject()", referenced from:
UssClient::UssClient() in UssGrpcClient.o
"UssClient::~UssClient()", referenced from:
UssGrpcClient::UssGrpcClient(wchar_t const*) in UssGrpcClient.o
UssGrpcClient::UssGrpcClient(UssGrpcClient*) in UssGrpcClient.o
UssGrpcClient::~UssGrpcClient() in UssGrpcClient.o
"typeinfo for UssClient", referenced from:
typeinfo for UssGrpcClient in UssGrpcClient.o
"vtable for UssClient", referenced from:
UssClient::UssClient() in UssGrpcClient.o
NOTE: a missing vtable usually means the first non-inline virtual member
function has no definition.
"_sk_new_null", referenced from:
_sk_X509_NAME_new_null in libgrpc.a(ssl_transport_security.cc.o)
(maybe you meant: _OPENSSL_sk_new_null)
"_sk_num", referenced from:
_sk_X509_num in libgrpc.a(ssl_transport_security.cc.o)
_sk_GENERAL_NAME_num in libgrpc.a(ssl_transport_security.cc.o)
(maybe you meant: _OPENSSL_sk_num)
"_sk_pop_free_ex", referenced from:
_sk_GENERAL_NAME_pop_free in libgrpc.a(ssl_transport_security.cc.o)
_sk_X509_NAME_pop_free in libgrpc.a(ssl_transport_security.cc.o)
"_sk_push", referenced from:
_sk_X509_NAME_push in libgrpc.a(ssl_transport_security.cc.o)
(maybe you meant: _OPENSSL_sk_push)
"_sk_value", referenced from:
_sk_X509_value in libgrpc.a(ssl_transport_security.cc.o)
_sk_GENERAL_NAME_value in libgrpc.a(ssl_transport_security.cc.o)
(maybe you meant: _OPENSSL_sk_value)
```
The same project with libs build on windows with CMake is working there. So
it seems to be a problem with clang on Mac. Is there any solution for this.
It seems there are many old threads on github, but none with a solution.
Thx.
[email protected] schrieb am Samstag, 24. November 2018 um 06:28:38
UTC+1:
> Did you found a reason for this error? I am stuck at the same point with
> the same error as yours.
>
>
> On Thursday, 1 June 2017 04:37:09 UTC-7, Bugsfunny wrote:
>>
>> Thanks for replying..
>>
>> I tried deleting all the files that are related to protobuf and grpc in
>> all the bin and lib folders and tried installing it again.
>>
>>
>> 1) When I install grpc first and then protobuf.. I'm able to install it
>> without any errors... But i'm getting the below error while running the
>> helloworld program in cpp exmaples.
>>
>> Undefined symbols for architecture x86_64:
>>
>> "grpc::CreateChannel(std::__cxx11::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&,
>> std::shared_ptr<grpc::ChannelCredentials> const&)", referenced from:
>>
>> _main in greeter_client.o
>>
>> "google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char
>> const*, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>,
>> std::allocator<char> > const&))", referenced from:
>>
>> helloworld::protobuf_helloworld_2eproto::AddDescriptorsImpl()
>> in helloworld.pb.o
>>
>>
>> "google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__cxx11::basic_string<char,
>>
>> std::char_traits<char>, std::allocator<char> > const&, unsigned char*)",
>> referenced from:
>>
>> google::protobuf::internal::WireFormatLite::WriteStringToArray(int,
>> std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator
>> <char> > const&, unsigned char*) in helloworld.pb.o
>>
>>
>> "google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char,
>>
>> std::char_traits<char>, std::allocator<char> > const*,
>> google::protobuf::internal::ArenaStringPtr)", referenced from:
>>
>> helloworld::HelloRequest::HelloRequest(helloworld::HelloRequest
>> const&) in helloworld.pb.o
>>
>> helloworld::HelloRequest::HelloRequest(helloworld::HelloRequest
>> const&) in helloworld.pb.o
>>
>> helloworld::HelloRequest::MergeFrom(helloworld::HelloRequest const
>> &) in helloworld.pb.o
>>
>> helloworld::HelloReply::HelloReply(helloworld::HelloReply const&)
>> in helloworld.pb.o
>>
>> helloworld::HelloReply::HelloReply(helloworld::HelloReply const&)
>> in helloworld.pb.o
>>
>> helloworld::HelloReply::MergeFrom(helloworld::HelloReply const&) in
>> helloworld.pb.o
>>
>> "google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int,
>> std::__cxx11::basic_string<char, std::char_traits<char>,
>> std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)"
>> , referenced from:
>>
>> helloworld::HelloRequest::SerializeWithCachedSizes(google::protobuf
>> ::io::CodedOutputStream*) const in helloworld.pb.o
>>
>> helloworld::HelloReply::SerializeWithCachedSizes(google::protobuf::
>> io::CodedOutputStream*) const in helloworld.pb.o
>>
>>
>> "google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*,
>>
>> std::__cxx11::basic_string<char, std::char_traits<char>,
>> std::allocator<char> >*)", referenced from:
>>
>> google::protobuf::internal::WireFormatLite::ReadString(google::
>> protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::
>> char_traits<char>, std::allocator<char> >*) in helloworld.pb.o
>>
>>
>> "google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string<char,
>>
>> std::char_traits<char>, std::allocator<char> > const&,
>> google::protobuf::internal::MigrationSchema const*,
>> google::protobuf::Message const* const*, unsigned int const*,
>> google::protobuf::MessageFactory*, google::protobuf::Metadata*,
>> google::protobuf::EnumDescriptor const**,
>> google::protobuf::ServiceDescriptor const**)", referenced from:
>>
>> helloworld::protobuf_helloworld_2eproto::(anonymous namespace)::
>> protobuf_AssignDescriptors() in helloworld.pb.o
>>
>> "google::protobuf::internal::fixed_address_empty_string[abi:cxx11]",
>> referenced from:
>>
>> google::protobuf::internal::GetEmptyStringAlreadyInited[abi:cxx11
>> ]() in helloworld.pb.o
>>
>> google::protobuf::internal::GetEmptyStringAlreadyInited[abi:cxx11
>> ]() in greeter_client.o
>>
>> "google::protobuf::Message::GetTypeName[abi:cxx11]() const",
>> referenced from:
>>
>> vtable for helloworld::HelloReply in helloworld.pb.o
>>
>> vtable for helloworld::HelloRequest in helloworld.pb.o
>>
>> "google::protobuf::Message::InitializationErrorString[abi:cxx11]()
>> const", referenced from:
>>
>> vtable for helloworld::HelloReply in helloworld.pb.o
>>
>> vtable for helloworld::HelloRequest in helloworld.pb.o
>>
>> ld: symbol(s) not found for architecture x86_64
>>
>> collect2: error: ld returned 1 exit status
>>
>> make: *** [greeter_client] Error 1
>> Enter code here...
>>
>>
>>
>> 2) When I install protobuf first and then grpc i'm getting the same error
>> which i first posted in this thread (during executing make command in grpc
>> directory ).
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Wednesday, May 31, 2017 at 3:26:58 AM UTC+5:30, Makarand Dharmapurikar
>> wrote:
>>>
>>> My guess is that you have an older copy of protobuf installed on the
>>> system somewhere. Can you manually search and remove older protobuf
>>> libraries?
>>>
>>> On Sun, May 28, 2017 at 12:09 PM, Bugsfunny <[email protected]>
>>> wrote:
>>>
>>>> Plz help me with this..
>>>> On Wednesday, May 24, 2017 at 12:44:25 PM UTC+5:30, Bugsfunny wrote:
>>>>>
>>>>> I installed grpc using the below commands :
>>>>>
>>>>> git clone -b $(curl -L http://grpc.io/release)
>>>>> https://github.com/grpc/grpc
>>>>> cd grpc
>>>>> git checkout -b 1.2.0
>>>>> git submodule foreach git clean -xfd
>>>>> git submodule update --init
>>>>> cd third_party/protobuf
>>>>> ./autogen.sh
>>>>> ./configure
>>>>> make -j2
>>>>> sudo make install
>>>>> cd ../cares/cares/
>>>>> ./buildconf
>>>>> ./configure
>>>>> make -j2
>>>>> make ahost adig acountry
>>>>> make install
>>>>> cd ../..
>>>>> git clean -xfd
>>>>> make -j2 (I get the below error while executing this command)
>>>>> sudo make install (did not execute this command)
>>>>>
>>>>>
>>>>>
>>>>> ERRORS :
>>>>>
>>>>>
>>>>>
>>>>> [LD] Linking /Users/anambia/Downloads/Softwares/grpc/libs/opt/
>>>>> libgrpc.dylib
>>>>> [LD] Linking /Users/anambia/Downloads/Softwares/grpc/libs/opt/
>>>>> libgrpc_cronet.dylib
>>>>> [AR] Creating /Users/anambia/Downloads/Softwares/grpc/libs/opt/
>>>>> libgrpc.a
>>>>> [AR] Creating /Users/anambia/Downloads/Softwares/grpc/libs/opt/
>>>>> libgrpc_cronet.a
>>>>> [HOSTLD] Linking /Users/anambia/Downloads/Softwares/grpc/bins/opt/
>>>>> grpc_cpp_plugin
>>>>> Undefined symbols for architecture x86_64:
>>>>>
>>>>> "google::protobuf::io::StringOutputStream::StringOutputStream(std::__1::basic_string<char,
>>>>>
>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >*)",
>>>>> referenced from:
>>>>> ProtoBufFile::CreatePrinter(std::__1::basic_string<char, std::
>>>>> __1::char_traits<char>, std::__1::allocator<char> >*) const in
>>>>> cpp_plugin.o
>>>>>
>>>>> "google::protobuf::io::Printer::Print(std::__1::map<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> >, std::__1::less<std::__1::basic_string<char,
>>>>> std::__1::char_traits<char>, std::__1::allocator<char> > >,
>>>>> std::__1::allocator<std::__1::pair<std::__1::basic_string<char,
>>>>> std::__1::char_traits<char>, std::__1::allocator<char> > const,
>>>>> std::__1::basic_string<char, std::__1::char_traits<char>,
>>>>> std::__1::allocator<char> > > > > const&, char const*)", referenced
>>>>> from:
>>>>> ProtoBufPrinter::Print(std::__1::map<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> >, std::__1::less<std::__1::basic_string<char, std::__1::
>>>>> char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<
>>>>> std::__1::pair<std::__1::basic_string<char, std::__1::char_traits
>>>>> <char>, std::__1::allocator<char> > const, std::__1::basic_string<char
>>>>> , std::__1::char_traits<char>, std::__1::allocator<char> > > > > const
>>>>> &, char const*) in cpp_plugin.o
>>>>>
>>>>> "google::protobuf::FileDescriptor::GetSourceLocation(std::__1::vector<int,
>>>>>
>>>>> std::__1::allocator<int> > const&, google::protobuf::SourceLocation*)
>>>>> const"
>>>>> , referenced from:
>>>>> void grpc_generator::GetComment<google::protobuf::FileDescriptor
>>>>> >(google::protobuf::FileDescriptor const*, grpc_generator::CommentType
>>>>> , 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 cpp_plugin.o
>>>>>
>>>>> "google::protobuf::compiler::CodeGenerator::GenerateAll(std::__1::vector<google::protobuf::FileDescriptor
>>>>>
>>>>> const*, std::__1::allocator<google::protobuf::FileDescriptor const*> >
>>>>> const&, std::__1::basic_string<char, std::__1::char_traits<char>,
>>>>> std::__1::allocator<char> > const&,
>>>>> google::protobuf::compiler::GeneratorContext*,
>>>>> std::__1::basic_string<char,
>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >*) const",
>>>>> referenced from:
>>>>> vtable for CppGrpcGenerator in cpp_plugin.o
>>>>> ld: symbol(s) not found for architecture x86_64
>>>>> clang: error: linker command failed with exit code 1 (use -v to see
>>>>> invocation)
>>>>> make: *** [/Users/anambia/Downloads/Softwares/grpc/bins/opt/
>>>>> grpc_cpp_plugin] Error 1
>>>>> make: *** Waiting for unfinished jobs....
>>>>>
>>>>>
>>>>>
>>>>> The gcc and g++ versions are :
>>>>>
>>>>> gcc --version
>>>>>
>>>>> gcc (GCC) 6.3.0
>>>>> Copyright (C) 2016 Free Software Foundation, Inc.
>>>>> This is free software; see the source for copying conditions. There
>>>>> is NO
>>>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>>>> PURPOSE.
>>>>>
>>>>>
>>>>> Please help me with this.
>>>>>
>>>>> --
>>>> 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/fa8d0c31-da74-4ee4-9f92-7a991ef12853%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/grpc-io/fa8d0c31-da74-4ee4-9f92-7a991ef12853%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 view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/c0246fee-3565-465f-b1d1-fa318b4d1bf6n%40googlegroups.com.