ianks / mini_phone

A fast phone number parser, validator and formatter for Ruby. This gem binds to Google's C++ libphonenumber for spec-compliance and performance.
MIT License
160 stars 8 forks source link

Ruby >3.1.2 issue #13

Closed espen closed 1 year ago

espen commented 1 year ago

Not sure if there are any changes in Ruby 3.1.3 but I am unable to install mini_phone in Ruby 3.1.3 and higher.

gem install mini_phone
Building native extensions. This could take a while...
ERROR:  Error installing mini_phone:
  ERROR: Failed to build gem native extension.

    current directory: /Users/espen/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/mini_phone-1.1.8/ext/mini_phone
/Users/espen/.asdf/installs/ruby/3.1.3/bin/ruby -I /Users/espen/.asdf/installs/ruby/3.1.3/lib/ruby/site_ruby/3.1.0 extconf.rb
checking for -lphonenumber... yes
creating Makefile

current directory: /Users/espen/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/mini_phone-1.1.8/ext/mini_phone
make DESTDIR\= sitearchdir\=./.gem.20230105-58078-6ghzqg sitelibdir\=./.gem.20230105-58078-6ghzqg clean

current directory: /Users/espen/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/mini_phone-1.1.8/ext/mini_phone
make DESTDIR\= sitearchdir\=./.gem.20230105-58078-6ghzqg sitelibdir\=./.gem.20230105-58078-6ghzqg
compiling mini_phone.cc
linking shared-object mini_phone/mini_phone.bundle
Undefined symbols for architecture arm64:
  "google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)", referenced from:
      void google::protobuf::internal::RepeatedPtrFieldBase::MergeFrom<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::internal::RepeatedPtrFieldBase const&) in mini_phone.o
  "google::protobuf::internal::LogMessage::~LogMessage()", referenced from:
      void google::protobuf::internal::RepeatedPtrFieldBase::MergeFrom<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::internal::RepeatedPtrFieldBase const&) in mini_phone.o
  "google::protobuf::internal::LogMessage::operator<<(char const*)", referenced from:
      void google::protobuf::internal::RepeatedPtrFieldBase::MergeFrom<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::internal::RepeatedPtrFieldBase const&) in mini_phone.o
  "google::protobuf::internal::GenericSwap(google::protobuf::MessageLite*, google::protobuf::MessageLite*)", referenced from:
      i18n::phonenumbers::PhoneNumber::Swap(i18n::phonenumbers::PhoneNumber*) in mini_phone.o
  "google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)", referenced from:
      void google::protobuf::internal::RepeatedPtrFieldBase::MergeFrom<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::internal::RepeatedPtrFieldBase const&) in mini_phone.o
  "google::protobuf::internal::ArenaStringPtr::Set(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::Arena*)", referenced from:
      google::protobuf::internal::ArenaStringPtr::Set(char const*, google::protobuf::Arena*) in mini_phone.o
  "google::protobuf::internal::RepeatedPtrFieldBase::DestroyProtos()", referenced from:
      google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::~RepeatedPtrField() in mini_phone.o
  "google::protobuf::internal::RepeatedPtrFieldBase::InternalExtend(int)", referenced from:
      google::protobuf::internal::RepeatedPtrFieldBase::MergeFromInternal(google::protobuf::internal::RepeatedPtrFieldBase const&, void (google::protobuf::internal::RepeatedPtrFieldBase::*)(void**, void**, int, int)) in mini_phone.o
  "google::protobuf::internal::RepeatedPtrFieldBase::AddOutOfLineHelper(void*)", referenced from:
      google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler::Type const*) in mini_phone.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mini_phone.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/espen/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/mini_phone-1.1.8 for inspection.
Results logged to /Users/espen/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/extensions/arm64-darwin-22/3.1.0/mini_phone-1.1.8/gem_make.out

I get this with Ruby 3.1.3 and 3.2.0. It works on 3.1.2.

dougperez commented 1 year ago

Same issue with my install, output incase it helps.

% ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin22]
% gem install mini_phone
Building native extensions. This could take a while...
ERROR:  Error installing mini_phone:
  ERROR: Failed to build gem native extension.

    current directory: /Users/doug/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/mini_phone-1.1.8/ext/mini_phone
/Users/doug/.rbenv/versions/3.0.2/bin/ruby -I /Users/doug/.rbenv/versions/3.0.2/lib/ruby/3.0.0 -r ./siteconf20230216-28612-dh4tko.rb extconf.rb
checking for -lphonenumber... yes
creating Makefile

current directory: /Users/doug/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/mini_phone-1.1.8/ext/mini_phone
make DESTDIR\= clean

current directory: /Users/doug/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/mini_phone-1.1.8/ext/mini_phone
make DESTDIR\=
compiling mini_phone.cc
linking shared-object mini_phone/mini_phone.bundle
Undefined symbols for architecture arm64:
  "google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)", referenced from:
      void google::protobuf::internal::RepeatedPtrFieldBase::MergeFrom<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::internal::RepeatedPtrFieldBase const&) in mini_phone.o
  "google::protobuf::internal::LogMessage::~LogMessage()", referenced from:
      void google::protobuf::internal::RepeatedPtrFieldBase::MergeFrom<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::internal::RepeatedPtrFieldBase const&) in mini_phone.o
  "google::protobuf::internal::LogMessage::operator<<(char const*)", referenced from:
      void google::protobuf::internal::RepeatedPtrFieldBase::MergeFrom<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::internal::RepeatedPtrFieldBase const&) in mini_phone.o
  "google::protobuf::internal::GenericSwap(google::protobuf::MessageLite*, google::protobuf::MessageLite*)", referenced from:
      i18n::phonenumbers::PhoneNumber::Swap(i18n::phonenumbers::PhoneNumber*) in mini_phone.o
  "google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)", referenced from:
      void google::protobuf::internal::RepeatedPtrFieldBase::MergeFrom<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::internal::RepeatedPtrFieldBase const&) in mini_phone.o
  "google::protobuf::internal::ArenaStringPtr::Set(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::Arena*)", referenced from:
      google::protobuf::internal::ArenaStringPtr::Set(char const*, google::protobuf::Arena*) in mini_phone.o
  "google::protobuf::internal::RepeatedPtrFieldBase::DestroyProtos()", referenced from:
      google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::~RepeatedPtrField() in mini_phone.o
  "google::protobuf::internal::RepeatedPtrFieldBase::InternalExtend(int)", referenced from:
      google::protobuf::internal::RepeatedPtrFieldBase::MergeFromInternal(google::protobuf::internal::RepeatedPtrFieldBase const&, void (google::protobuf::internal::RepeatedPtrFieldBase::*)(void**, void**, int, int)) in mini_phone.o
  "google::protobuf::internal::RepeatedPtrFieldBase::AddOutOfLineHelper(void*)", referenced from:
      google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler>(google::protobuf::RepeatedPtrField<i18n::phonenumbers::NumberFormat>::TypeHandler::Type const*) in mini_phone.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mini_phone.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/doug/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/mini_phone-1.1.8 for inspection.
Results logged to /Users/doug/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/extensions/arm64-darwin-22/3.0.0/mini_phone-1.1.8/gem_make.out

macOS: Ventura 13.2 (M2 Pro Chip) mini_phone: 1.1.8 Ruby: 3.0.2

Tried to use 3.1.2 as mentioned above but that did not work for me.

Using 3.0.5 works fine.

ianks commented 1 year ago

Should be fixed in v1.2.0 ❤️