Quickstart for Google Cardboard for Unity

https://developers.google.com/cardboard/develop/unity/quickstart

Unity ver.2020.3.38

Mac ver.12.6

Xcode ver.14.0.1

Google Cardboard のデモを iOS 用にビルドしたら以下のエラー

Showing Recent Messages
Undefined symbol: google::protobuf::MessageLite::ParseFromArray(void const*, int)
Undefined symbol: google::protobuf::RepeatedField<float>::InternalSwap(google::protobuf::RepeatedField<float>*)
Undefined symbol: google::protobuf::RepeatedField<float>::Add(float const&)
Undefined symbol: google::protobuf::RepeatedField<float>::Clear()
Undefined symbol: google::protobuf::RepeatedField<float>::MergeFrom(google::protobuf::RepeatedField<float> const&)
Undefined symbol: google::protobuf::RepeatedField<float>::RepeatedField(google::protobuf::Arena*)
Undefined symbol: google::protobuf::RepeatedField<float>::RepeatedField(google::protobuf::RepeatedField<float> const&)
Undefined symbol: google::protobuf::RepeatedField<float>::~RepeatedField()
Undefined symbol: google::protobuf::stringpiece_internal::StringPiece::LogFatalSizeTooBig(unsigned long, char const*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::WriteRawFallback(void const*, int, unsigned char*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::EnsureSpaceFallback(unsigned char*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::WriteStringMaybeAliasedOutline(unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned char*)
Undefined symbol: google::protobuf::Arena::AllocateAlignedWithHook(unsigned long, std::type_info const*)
Undefined symbol: google::protobuf::Arena::AllocateAlignedWithCleanup(unsigned long, std::type_info const*)
Undefined symbol: google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)
Undefined symbol: google::protobuf::internal::LogMessage::~LogMessage()
Undefined symbol: google::protobuf::internal::LogMessage::operator<<(char const*)
Undefined symbol: google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)
Undefined symbol: google::protobuf::internal::WriteVarint(unsigned int, unsigned long long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)
Undefined symbol: google::protobuf::internal::ArenaStringPtr::DestroyNoArenaSlowPath()
Undefined symbol: google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::Arena*)
Undefined symbol: google::protobuf::internal::ArenaStringPtr::Mutable(google::protobuf::internal::ArenaStringPtr::EmptyDefault, google::protobuf::Arena*)
Undefined symbol: google::protobuf::internal::LookUpEnumName(google::protobuf::internal::EnumEntry const*, int const*, unsigned long, int)
Undefined symbol: google::protobuf::internal::LookUpEnumValue(google::protobuf::internal::EnumEntry const*, unsigned long, google::protobuf::stringpiece_internal::StringPiece, int*)
Undefined symbol: google::protobuf::internal::ReadTagFallback(char const*, unsigned int)
Undefined symbol: google::protobuf::internal::ThreadSafeArena::~ThreadSafeArena()
Undefined symbol: void google::protobuf::internal::InternalMetadata::DoMergeFrom<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&)
Undefined symbol: void google::protobuf::internal::InternalMetadata::DoClear<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >()
Undefined symbol: google::protobuf::internal::PackedFloatParser(void*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::UnknownFieldParse(unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::VarintParseSlow64(char const*, unsigned int)
Undefined symbol: google::protobuf::internal::EpsCopyInputStream::DoneFallback(int, int)
Undefined symbol: google::protobuf::internal::InitializeEnumStrings(google::protobuf::internal::EnumEntry const*, int const*, unsigned long, google::protobuf::internal::ExplicitlyConstructed<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >*)
Undefined symbol: google::protobuf::internal::InitProtobufDefaultsSlow()
Undefined symbol: google::protobuf::internal::InlineGreedyStringParser(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::fixed_address_empty_string
Undefined symbol: google::protobuf::internal::init_protobuf_defaults_state
Undefined symbol: google::protobuf::MessageLite::InitializationErrorString() const
Undefined symbol: google::protobuf::RepeatedField<float>::Get(int) const
Undefined symbol: google::protobuf::RepeatedField<float>::data() const
Undefined symbol: google::protobuf::RepeatedField<float>::size() const
Undefined symbol: typeinfo for google::protobuf::MessageLite
Undefined symbol: vtable for google::protobuf::MessageLite

google::protobuf が見つからない

対応としては、iOS 用のビルドフォルダに移動

pod init
pod install

podfile を以下に変更

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Unity-iPhone' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Unity-iPhone

  target 'Unity-iPhone Tests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'UnityFramework' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  # add
  pod 'Protobuf-C++', '3.18.0'

  # Pods for UnityFramework

end

# add
post_install do |installer|
  installer.pods_project.targets.each do |target|
    # print "target=", target, "\n"
    if target.name == "Protobuf-C++"
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = '$(SRCROOT)/Protobuf-C++/src'
      end
    end
  end
end

xcworkspace が作成されるので以下のコマンドで open

pod update
open Unity-iPhone.xcworkspace

あとは、署名してビルド

 

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

© 2024 Falco Tech Blog Suffusion theme by Sayontan Sinha