td icon indicating copy to clipboard operation
td copied to clipboard

Undefined symbols error

Open vladbara705 opened this issue 1 year ago • 1 comments

Hello. I received error, when run my application: MacOs M2 14.4.1 (23E224)

func main() {
	tdlib.SetLogVerbosityLevel(1)
	tdlib.SetFilePath("./errors.txt")
}

Error:

ld: Undefined symbols:
  td::verbosity_mtproto, referenced from:
      l_constinit in libtdcore.a[131](Logging.cpp.o)
  td::verbosity_raw_mtproto, referenced from:
      l_constinit in libtdcore.a[131](Logging.cpp.o)
  td::mtproto::DhHandshake::run_checks(bool, td::mtproto::DhCallback*), referenced from:
      td::CallActor::do_update_call(td::telegram_api::phoneCallAccepted const&) in libtdcore.a[34](CallActor.cpp.o)
      td::CallActor::do_update_call(td::telegram_api::phoneCall const&) in libtdcore.a[34](CallActor.cpp.o)
      td::SecretChatActor::run_auth() in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_update_chat(td::telegram_api::encryptedChat&) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_inbound_action(td::secret_api::decryptedMessageActionRequestKey&) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_inbound_action(td::secret_api::decryptedMessageActionAcceptKey&) in libtdcore.a[224](SecretChatActor.cpp.o)
  td::mtproto::DhHandshake::set_config(int, td::Slice), referenced from:
      td::CallActor::try_send_request_query() in libtdcore.a[34](CallActor.cpp.o)
      td::CallActor::try_send_accept_query() in libtdcore.a[34](CallActor.cpp.o)
      td::SecretChatActor::request_new_key() in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_dh_config(td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_inbound_action(td::secret_api::decryptedMessageActionRequestKey&) in libtdcore.a[224](SecretChatActor.cpp.o)
  td::mtproto::DhHandshake::calc_key_id(td::Slice), referenced from:
      td::DeviceTokenManager::register_device(td::tl::unique_ptr<td::td_api::DeviceToken>, std::__1::vector<td::UserId, std::__1::allocator<td::UserId>> const&, td::Promise<td::tl::unique_ptr<td::td_api::pushReceiverId>>) in libtdcore.a[51](DeviceTokenManager.cpp.o)
  td::mtproto::DhHandshake::check_config(int, td::Slice, td::mtproto::DhCallback*), referenced from:
      td::CallActor::on_dh_config(td::Result<std::__1::shared_ptr<td::DhConfig>>, bool) in libtdcore.a[34](CallActor.cpp.o)
      td::PasswordManager::calc_password_srp_hash(td::Slice, td::Slice, td::Slice, int, td::Slice) in libtdcore.a[193](PasswordManager.cpp.o)
      td::PasswordManager::get_input_check_password(td::Slice, td::Slice, td::Slice, int, td::Slice, td::Slice, long long) in libtdcore.a[193](PasswordManager.cpp.o)
      td::SecretChatActor::on_dh_config(td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a[224](SecretChatActor.cpp.o)
  td::mtproto::DhHandshake::set_g_a_hash(td::Slice), referenced from:
      td::CallActor::do_update_call(td::telegram_api::phoneCallRequested const&) in libtdcore.a[34](CallActor.cpp.o)
  td::mtproto::DhHandshake::gen_key(), referenced from:
      td::CallActor::do_update_call(td::telegram_api::phoneCallAccepted const&) in libtdcore.a[34](CallActor.cpp.o)
      td::CallActor::do_update_call(td::telegram_api::phoneCall const&) in libtdcore.a[34](CallActor.cpp.o)
      td::SecretChatActor::run_auth() in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_update_chat(td::telegram_api::encryptedChat&) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_inbound_action(td::secret_api::decryptedMessageActionRequestKey&) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_inbound_action(td::secret_api::decryptedMessageActionAcceptKey&) in libtdcore.a[224](SecretChatActor.cpp.o)
  td::mtproto::DhHandshake::set_g_a(td::Slice), referenced from:
      td::CallActor::do_update_call(td::telegram_api::phoneCallAccepted const&) in libtdcore.a[34](CallActor.cpp.o)
      td::CallActor::do_update_call(td::telegram_api::phoneCall const&) in libtdcore.a[34](CallActor.cpp.o)
      td::SecretChatActor::on_update_chat(td::telegram_api::encryptedChatRequested&) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_update_chat(td::telegram_api::encryptedChat&) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_inbound_action(td::secret_api::decryptedMessageActionRequestKey&) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::on_inbound_action(td::secret_api::decryptedMessageActionAcceptKey&) in libtdcore.a[224](SecretChatActor.cpp.o)
  td::mtproto::ProxySecret::from_binary(td::Slice, bool), referenced from:
      td::DcOption::DcOption(td::DcId, td::telegram_api::IpPort const&) in libtdcore.a[44](ConfigManager.cpp.o)
      td::DcOption::DcOption(td::DcId, td::telegram_api::IpPort const&) in libtdcore.a[44](ConfigManager.cpp.o)
      td::DcOption::DcOption(td::telegram_api::dcOption const&) in libtdcore.a[44](ConfigManager.cpp.o)
  td::mtproto::ProxySecret::from_link(td::Slice, bool), referenced from:
      td::LinkManager::parse_tg_link_query(td::Slice, bool) in libtdcore.a[128](LinkManager.cpp.o)
      td::LinkManager::parse_t_me_link_query(td::Slice, bool) in libtdcore.a[128](LinkManager.cpp.o)
      void td::Proxy::parse<td::log_event::LogEventParser>(td::log_event::LogEventParser&) in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::Proxy::create_proxy(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int, td::td_api::ProxyType const*) in libtdcore.a[174](Proxy.cpp.o)
  td::mtproto::RawConnection::create(td::IPAddress, td::BufferedFd<td::SocketFd>, td::mtproto::TransportType, td::unique_ptr<td::mtproto::RawConnection::StatsCallback>), referenced from:
      td::ConnectionCreator::ping_proxy_buffered_socket_fd(td::IPAddress, td::BufferedFd<td::SocketFd>, td::mtproto::TransportType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, td::Promise<double>) in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::ConnectionCreator::on_test_proxy_connection_data(unsigned long long, td::Result<td::ConnectionCreator::ConnectionData>) in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::ConnectionCreator::client_create_raw_connection(td::Result<td::ConnectionCreator::ConnectionData>, bool, td::mtproto::TransportType, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, unsigned int) in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::ConnectionCreator::request_raw_connection_by_ip(td::IPAddress, td::mtproto::TransportType, td::Promise<td::unique_ptr<td::mtproto::RawConnection>>)::$_11::operator()(td::Result<td::ConnectionCreator::ConnectionData>) in libtdcore.a[162](ConnectionCreator.cpp.o)
  td::mtproto::HandshakeActor::close(), referenced from:
      td::detail::GenAuthKeyActor::on_network(unsigned int) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::HandshakeActor::HandshakeActor(td::unique_ptr<td::mtproto::AuthKeyHandshake>, td::unique_ptr<td::mtproto::RawConnection>, td::unique_ptr<td::mtproto::AuthKeyHandshakeContext>, double, td::Promise<td::unique_ptr<td::mtproto::RawConnection>>, td::Promise<td::unique_ptr<td::mtproto::AuthKeyHandshake>>), referenced from:
      td::ConnectionCreator::on_test_proxy_connection_data(unsigned long long, td::Result<td::ConnectionCreator::ConnectionData>) in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::ActorOwn<td::mtproto::HandshakeActor> td::Scheduler::create_actor_on_scheduler<td::mtproto::HandshakeActor, td::unique_ptr<td::mtproto::AuthKeyHandshake>, td::unique_ptr<td::mtproto::RawConnection>, td::unique_ptr<td::mtproto::AuthKeyHandshakeContext>, int, td::Promise<td::unique_ptr<td::mtproto::RawConnection>>, td::Promise<td::unique_ptr<td::mtproto::AuthKeyHandshake>>>(td::Slice, int, td::unique_ptr<td::mtproto::AuthKeyHandshake>&&, td::unique_ptr<td::mtproto::RawConnection>&&, td::unique_ptr<td::mtproto::AuthKeyHandshakeContext>&&, int&&, td::Promise<td::unique_ptr<td::mtproto::RawConnection>>&&, td::Promise<td::unique_ptr<td::mtproto::AuthKeyHandshake>>&&) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::AuthKeyHandshake::AuthKeyHandshake(int, int), referenced from:
      td::ConnectionCreator::on_test_proxy_connection_data(unsigned long long, td::Result<td::ConnectionCreator::ConnectionData>) in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::Session::create_gen_auth_key_actor(td::Session::HandshakeId) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::ConnectionManager::dec_connect(), referenced from:
      td::mtproto::ConnectionManager::ConnectionToken::reset() in libtdcore.a[162](ConnectionCreator.cpp.o)
  td::mtproto::ConnectionManager::connection_impl(td::ActorId<td::mtproto::ConnectionManager>, int), referenced from:
      td::ConnectionCreator::prepare_connection(td::IPAddress, td::SocketFd, td::Proxy const&, td::IPAddress const&, td::mtproto::TransportType const&, td::Slice, td::Slice, td::unique_ptr<td::mtproto::RawConnection::StatsCallback>, td::ActorShared<td::Actor>, bool, td::Promise<td::ConnectionCreator::ConnectionData>)::Callback::on_connected() in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::Session::on_connected() in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::send_query(td::BufferSlice, bool, td::mtproto::MessageId, std::__1::vector<td::mtproto::MessageId, std::__1::allocator<td::mtproto::MessageId>>, bool), referenced from:
      td::Session::connection_send_query(td::Session::ConnectionInfo*, td::ObjectPool<td::NetQuery>::OwnerPtr&&, td::mtproto::MessageId) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::set_online(bool, bool), referenced from:
      td::Session::connection_online_update(double, bool) in libtdcore.a[178](Session.cpp.o)
      td::Session::connection_online_update(double, bool) in libtdcore.a[178](Session.cpp.o)
      td::Session::connection_open_finish(td::Session::ConnectionInfo*, td::Result<td::unique_ptr<td::mtproto::RawConnection>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::destroy_key(), referenced from:
      td::Session::connection_open_finish(td::Session::ConnectionInfo*, td::Result<td::unique_ptr<td::mtproto::RawConnection>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::force_close(td::mtproto::SessionConnection::Callback*), referenced from:
      td::Session::on_network(bool, unsigned int) in libtdcore.a[178](Session.cpp.o)
      td::Session::on_network(bool, unsigned int) in libtdcore.a[178](Session.cpp.o)
      td::Session::connection_close(td::Session::ConnectionInfo*) in libtdcore.a[178](Session.cpp.o)
      td::Session::on_bind_result(td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a[178](Session.cpp.o)
      td::Session::on_bind_result(td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a[178](Session.cpp.o)
      td::Session::on_check_key_result(td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a[178](Session.cpp.o)
      td::Session::on_check_key_result(td::ObjectPool<td::NetQuery>::OwnerPtr) in libtdcore.a[178](Session.cpp.o)
      ...
  td::mtproto::SessionConnection::cancel_answer(td::mtproto::MessageId), referenced from:
      td::Session::raw_event(td::Event::Raw const&) in libtdcore.a[178](Session.cpp.o)
      td::Session::connection_open_finish(td::Session::ConnectionInfo*, td::Result<td::unique_ptr<td::mtproto::RawConnection>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::get_poll_info(), referenced from:
      td::Session::connection_open_finish(td::Session::ConnectionInfo*, td::Result<td::unique_ptr<td::mtproto::RawConnection>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::resend_answer(td::mtproto::MessageId), referenced from:
      td::Session::on_message_info(td::mtproto::MessageId, int, td::mtproto::MessageId, int, int) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::encrypted_bind(long long, long long, int), referenced from:
      td::Session::connection_send_bind_key(td::Session::ConnectionInfo*) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::get_state_info(td::mtproto::MessageId), referenced from:
      td::Session::connection_open_finish(td::Session::ConnectionInfo*, td::Result<td::unique_ptr<td::mtproto::RawConnection>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::move_as_raw_connection(), referenced from:
      td::Session::on_closed(td::Status) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::flush(td::mtproto::SessionConnection::Callback*), referenced from:
      td::Session::loop() in libtdcore.a[178](Session.cpp.o)
      td::Session::loop() in libtdcore.a[178](Session.cpp.o)
      td::Session::connection_flush(td::Session::ConnectionInfo*) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::force_ack(), referenced from:
      td::Session::on_message_result_error(td::mtproto::MessageId, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::SessionConnection::SessionConnection(td::mtproto::SessionConnection::Mode, td::unique_ptr<td::mtproto::RawConnection>, td::mtproto::AuthData*), referenced from:
      td::Session::connection_open_finish(td::Session::ConnectionInfo*, td::Result<td::unique_ptr<td::mtproto::RawConnection>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::create_ping_actor(td::Slice, td::unique_ptr<td::mtproto::RawConnection>, td::unique_ptr<td::mtproto::AuthData>, td::Promise<td::unique_ptr<td::mtproto::RawConnection>>, td::ActorShared<td::Actor>), referenced from:
      td::ConnectionCreator::ping_proxy_buffered_socket_fd(td::IPAddress, td::BufferedFd<td::SocketFd>, td::mtproto::TransportType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, td::Promise<double>) in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::ConnectionCreator::client_create_raw_connection(td::Result<td::ConnectionCreator::ConnectionData>, bool, td::mtproto::TransportType, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, unsigned int) in libtdcore.a[162](ConnectionCreator.cpp.o)
  td::mtproto::RSA::from_pem_public_key(td::Slice), referenced from:
      td::decode_config(td::Slice) in libtdcore.a[44](ConfigManager.cpp.o)
      td::PublicRsaKeySharedMain::create(bool)::$_0::operator()(std::__1::vector<td::mtproto::PublicRsaKeyInterface::RsaKey, std::__1::allocator<td::mtproto::PublicRsaKeyInterface::RsaKey>>&, td::CSlice) const in libtdcore.a[176](PublicRsaKeySharedMain.cpp.o)
      td::PublicRsaKeyWatchdog::sync_key(std::__1::shared_ptr<td::PublicRsaKeySharedCdn>&) in libtdcore.a[177](PublicRsaKeyWatchdog.cpp.o)
  td::mtproto::AuthData::set_future_salts(std::__1::vector<td::mtproto::ServerSalt, std::__1::allocator<td::mtproto::ServerSalt>> const&, double), referenced from:
      td::Session::Session(td::unique_ptr<td::Session::Callback>, std::__1::shared_ptr<td::AuthDataShared>, int, int, bool, bool, bool, bool, bool, bool, td::mtproto::AuthKey const&, std::__1::vector<td::mtproto::ServerSalt, std::__1::allocator<td::mtproto::ServerSalt>> const&) in libtdcore.a[178](Session.cpp.o)
      td::Session::Session(td::unique_ptr<td::Session::Callback>, std::__1::shared_ptr<td::AuthDataShared>, int, int, bool, bool, bool, bool, bool, bool, td::mtproto::AuthKey const&, std::__1::vector<td::mtproto::ServerSalt, std::__1::allocator<td::mtproto::ServerSalt>> const&) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::AuthData::reset_server_time_difference(double), referenced from:
      td::Session::Session(td::unique_ptr<td::Session::Callback>, std::__1::shared_ptr<td::AuthDataShared>, int, int, bool, bool, bool, bool, bool, bool, td::mtproto::AuthKey const&, std::__1::vector<td::mtproto::ServerSalt, std::__1::allocator<td::mtproto::ServerSalt>> const&) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::AuthData::update_server_time_difference(double), referenced from:
      td::Session::on_handshake_ready(td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::AuthData::is_ready(double), referenced from:
      td::Session::loop() in libtdcore.a[178](Session.cpp.o)
  td::mtproto::AuthData::AuthData(), referenced from:
      td::Session::Session(td::unique_ptr<td::Session::Callback>, std::__1::shared_ptr<td::AuthDataShared>, int, int, bool, bool, bool, bool, bool, bool, td::mtproto::AuthKey const&, std::__1::vector<td::mtproto::ServerSalt, std::__1::allocator<td::mtproto::ServerSalt>> const&) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::Transport::read_auth_key_id(td::Slice), referenced from:
      td::SecretChatActor::decrypt(td::BufferSlice&) in libtdcore.a[224](SecretChatActor.cpp.o)
  td::mtproto::Transport::read(td::MutableSlice, td::mtproto::AuthKey const&, td::mtproto::PacketInfo*), referenced from:
      td::NotificationManager::decrypt_push_payload(long long, 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>>) in libtdcore.a[184](NotificationManager.cpp.o)
      td::SecretChatActor::decrypt(td::BufferSlice&) in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::decrypt(td::BufferSlice&) in libtdcore.a[224](SecretChatActor.cpp.o)
  td::mtproto::Transport::write(td::Storer const&, td::mtproto::AuthKey const&, td::mtproto::PacketInfo*, unsigned long, unsigned long), referenced from:
      td::SecretChatActor::create_encrypted_message(int, int, td::tl::unique_ptr<td::secret_api::DecryptedMessage>&) in libtdcore.a[224](SecretChatActor.cpp.o)
  td::mtproto::DhHandshake::get_g_b_hash() const, referenced from:
      td::CallActor::try_send_request_query() in libtdcore.a[34](CallActor.cpp.o)
  td::mtproto::DhHandshake::get_g_a() const, referenced from:
      td::CallActor::do_update_call(td::telegram_api::phoneCall const&) in libtdcore.a[34](CallActor.cpp.o)
  td::mtproto::DhHandshake::get_g_b() const, referenced from:
      td::CallActor::do_update_call(td::telegram_api::phoneCall const&) in libtdcore.a[34](CallActor.cpp.o)
      td::CallActor::try_send_accept_query() in libtdcore.a[34](CallActor.cpp.o)
      td::CallActor::try_send_confirm_query() in libtdcore.a[34](CallActor.cpp.o)
      td::SecretChatActor::run_auth() in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::run_auth() in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::run_pfs() in libtdcore.a[224](SecretChatActor.cpp.o)
      td::SecretChatActor::run_pfs() in libtdcore.a[224](SecretChatActor.cpp.o)
      ...
  td::mtproto::ProxySecret::get_encoded_secret() const, referenced from:
      td::LinkManager::parse_tg_link_query(td::Slice, bool) in libtdcore.a[128](LinkManager.cpp.o)
      td::LinkManager::parse_t_me_link_query(td::Slice, bool) in libtdcore.a[128](LinkManager.cpp.o)
      td::LinkManager::get_proxy_link(td::Proxy const&, bool) in libtdcore.a[128](LinkManager.cpp.o)
      td::ConnectionCreator::get_proxy_object(int) const in libtdcore.a[162](ConnectionCreator.cpp.o)
      void td::Proxy::store<td::log_event::LogEventStorerCalcLength>(td::log_event::LogEventStorerCalcLength&) const in libtdcore.a[162](ConnectionCreator.cpp.o)
      void td::Proxy::store<td::log_event::LogEventStorerUnsafe>(td::log_event::LogEventStorerUnsafe&) const in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::operator<<(td::StringBuilder&, td::Proxy const&) in libtdcore.a[174](Proxy.cpp.o)
      ...
  td::mtproto::AuthKeyHandshake::is_ready_for_finish() const, referenced from:
      td::ConnectionCreator::on_test_proxy_handshake(unsigned long long, td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>>) in libtdcore.a[162](ConnectionCreator.cpp.o)
      td::Session::on_handshake_ready(td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>>) in libtdcore.a[178](Session.cpp.o)
  td::mtproto::RSA::get_fingerprint() const, referenced from:
      td::PublicRsaKeySharedCdn::add_rsa(td::mtproto::RSA) in libtdcore.a[175](PublicRsaKeySharedCdn.cpp.o)
      td::PublicRsaKeySharedMain::create(bool)::$_0::operator()(std::__1::vector<td::mtproto::PublicRsaKeyInterface::RsaKey, std::__1::allocator<td::mtproto::PublicRsaKeyInterface::RsaKey>>&, td::CSlice) const in libtdcore.a[176](PublicRsaKeySharedMain.cpp.o)
      td::PublicRsaKeyWatchdog::sync_key(std::__1::shared_ptr<td::PublicRsaKeySharedCdn>&) in libtdcore.a[177](PublicRsaKeyWatchdog.cpp.o)
  td::mtproto::RSA::decrypt_signature(td::Slice, td::MutableSlice) const, referenced from:
      td::decode_config(td::Slice) in libtdcore.a[44](ConfigManager.cpp.o)
  td::mtproto::RSA::clone() const, referenced from:
      td::PublicRsaKeySharedCdn::get_rsa_key(std::__1::vector<long long, std::__1::allocator<long long>> const&) in libtdcore.a[175](PublicRsaKeySharedCdn.cpp.o)
      td::PublicRsaKeySharedMain::get_rsa_key(std::__1::vector<long long, std::__1::allocator<long long>> const&) in libtdcore.a[176](PublicRsaKeySharedMain.cpp.o)
  td::mtproto::AuthData::get_future_salts() const, referenced from:
      td::Session::on_server_salt_updated() in libtdcore.a[178](Session.cpp.o)
      td::Session::on_server_salt_updated() in libtdcore.a[178](Session.cpp.o)
      non-virtual thunk to td::Session::on_server_salt_updated() in libtdcore.a[178](Session.cpp.o)
      non-virtual thunk to td::Session::on_server_salt_updated() in libtdcore.a[178](Session.cpp.o)
      td::Session::on_handshake_ready(td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>>) in libtdcore.a[178](Session.cpp.o)
      td::Session::on_handshake_ready(td::Result<td::unique_ptr<td::mtproto::AuthKeyHandshake>>) in libtdcore.a[178](Session.cpp.o)
  vtable for td::mtproto::TlsInit, referenced from:
      td::mtproto::TlsInit::TlsInit(td::SocketFd, 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>>, td::unique_ptr<td::TransparentProxy::Callback>, td::ActorShared<td::Actor>, double) in libtdcore.a[162](ConnectionCreator.cpp.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

vladbara705 avatar Sep 05 '24 17:09 vladbara705

See https://github.com/tdlib/td/issues/2935.

levlam avatar Sep 05 '24 19:09 levlam

Hi @levlam, first of all thank you for this amazing library, but can you elaborate more on how to fix this when building for iOS?

In #2935, you said that we "need to link with tdmtproto after tdcore" but how would i actually do that when building for iOS?

I'm following example/ios guide for building a tdjson folder for iOS and iOS simulator, then copied the .h files and .a files to make 2 new folders like this:

📦 
├─ iOS
│  └─ include
│     ├─ td
│     │  └─ telegram
│     │     ├─ Client.h
│     │     ├─ Log.h
│     │     ├─ td_api.h
│     │     ├─ td_api.hpp
│     │     ├─ td_json_client.h
│     │     ├─ td_log.h
│     │     └─ tdjson_export.h
│     └─ lib
│        ├─ libcrypto.a         (from third_party/openssl/iOS/lib)
│        ├─ libssl.a            (from third_party/openssl/iOS/lib)
│        ├─ libtdactor.a        (from build/install-iOS/lib)
│        ├─ libtdapi.a          (from build/install-iOS/lib)
│        ├─ libtdclient.a       (from build/install-iOS/lib)
│        ├─ libtdcore.a         (from build/install-iOS/lib)
│        ├─ libtddb.a           (from build/install-iOS/lib)
│        ├─ libtde2e.a          (from build/install-iOS/lib)
│        ├─ libtdjson_private.a (from build/install-iOS/lib)
│        ├─ libtdjson_static.a  (from build/install-iOS/lib)
│        ├─ libtdmtproto.a      (from build/install-iOS/lib)
│        ├─ libtdnet.a          (from build/install-iOS/lib)
│        ├─ libtdsqlite.a       (from build/install-iOS/lib)
│        └─ libtdutils.a        (from build/install-iOS/lib)
└─ iOS-simulator
   └─ basically the same as iOS, but with files taken from third_party/openssl/iOS-simulator/lib and build/install-iOS-simulator/lib instead

Which already includes the libtdmtproto.a which is for MTProto, so i'm not sure how else I need to link it when building.

Then i used this script from tdlib-swift to build a static .xcframework:

# iOS devices
xcodebuild archive \
    -scheme iOS \
    -archivePath "./build/ios.xcarchive" \
    -sdk iphoneos \
    -configuration Release \
    SKIP_INSTALL=NO

# iOS simulator
xcodebuild archive \
    -scheme iOS-simulator \
    -archivePath "./build/ios_sim.xcarchive" \
    -sdk iphonesimulator \
    -configuration Release \
    SKIP_INSTALL=NO

# make framework
xcodebuild -create-xcframework \
    -framework "./build/ios.xcarchive/Products/Library/Frameworks/TdLib.framework" \
    -framework "./build/ios_sim.xcarchive/Products/Library/Frameworks/TdLib.framework" \
    -output "./build/TdLib.xcframework"

Which results in a static TdLib.xcframework folder that i then pasted into my Expo Module native iOS folder like this:

📦 modules
└─ tdlib-json-wrapper
   ├─ android (don't need to care about this, android side is working fine)
   └─ ios
      ├─ Frameworks
      │  └─ TdLib.xcframework (pasted here)
      │     ├─ ios-arm64
      │     │  └─ TdLib.framework
      │     │     ├─ Headers
      │     │     │  ├─ td_json_client.h
      │     │     │  ├─ td_log.h
      │     │     │  ├─ td.h
      │     │     │  └─ tdjson_export.h
      │     │     ├─ Modules
      │     │     │  └─ module.modulemap
      │     │     ├─ Info.plist
      │     │     └─ TdLib (just a single file with no extension, i don't know what it's for)
      │     └─ ios-arm64_x86_64-simulator
      │        └─ basically the same as ios-arm64
      ├─ src
      │  └─ TdlibJsonWrapperModule.swift
      └─ TdlibJsonWrapper.podspec

Also add the framework in the module podspec file, as per instruction from the Expo website:

Pod::Spec.new do |s|
  s.name           = 'TdlibJsonWrapper'
  s.version        = '1.0.0'
  s.summary        = 'A sample project summary'
  s.description    = 'A sample project description'
  s.author         = ''
  s.homepage       = 'https://docs.expo.dev/modules/'
  s.platforms      = {
    :ios => '18.4',
  }
  s.source         = { git: '' }
  s.static_framework = false

  s.dependency 'ExpoModulesCore'
  s.vendored_frameworks = "Frameworks/TdLib.xcframework"

  # Swift/Objective-C compatibility
  s.pod_target_xcconfig = {
    'DEFINES_MODULE' => 'YES',
  }

  s.source_files = "src/**/*.{h,m,mm,swift,hpp,cpp}"
end

Then i run npx expo prebuild --clean, works fine

Then i run npx expo run:ios, after a while it fails with some warnings and errors:

⚠️  ld: ignoring duplicate libraries: '-lc++'
⚠️  ld: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
⚠️  ld: Could not parse or use implicit file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it
❌  Undefined symbols for architecture arm64
┌─ Symbol: td::verbosity_mtproto
└─ Referenced from: l_constinit in TdLib[arm64][1117](Logging.cpp.o)


❌  ld: symbol(s) not found for architecture arm64



❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)


    Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')

› 3 error(s), and 6 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.

It has the same error that this post mentions, so do you have any pointers for fixing this? Maybe i'm building it the wrong way and there's a better way to build a static framework for Swift? My only goal is to be able to use the TDJSON methods (td_create_client_id, td_receive, td_send, td_execute) in my native Swift module. Any help would be greatly appreciated. Thank you in advance.

EDIT: Nevermind, I figured it out. For anyone encountering the same problem when using tdlib-swift, we just need to open tdlib-swift/td-xcframework/td.xcodeproj in Xcode, select the Project, then add libtdmtproto.a and libtde2e.a to the "Frameworks and Libraries" section in the "General" tab

buitrbao222 avatar May 28 '25 19:05 buitrbao222