akihikodaki / cld3-ruby

cld3-ruby is an interface of Compact Language Detector v3 (CLD3) for Ruby.
Apache License 2.0
77 stars 22 forks source link

Dependency install fails beacuse of protobuf #30

Closed lfuelling closed 2 years ago

lfuelling commented 2 years ago

I am trying to install cld3 on an Apple Silicon MacBook running macOS 12.1:

I have tried installing protobuf from source, via homebrew (stable) and via homebrew (from git), always the same error when installing.

Google is of no help.

Build log of bundle install:

Installing cld3 3.4.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/lerk/.rvm/gems/ruby-3.0.3/gems/cld3-3.4.3/ext/cld3
/Users/lerk/.rvm/rubies/ruby-3.0.3/bin/ruby -I /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0 -r
./siteconf20211221-97073-qu4a2e.rb extconf.rb
creating Makefile

current directory: /Users/lerk/.rvm/gems/ruby-3.0.3/gems/cld3-3.4.3/ext/cld3
make DESTDIR\= clean

current directory: /Users/lerk/.rvm/gems/ruby-3.0.3/gems/cld3-3.4.3/ext/cld3
make DESTDIR\=
compiling base.cc
compiling embedding_feature_extractor.cc
In file included from embedding_feature_extractor.cc:16:
In file included from ./embedding_feature_extractor.h:23:
In file included from ./feature_extractor.h:45:
./cld_3/protos/feature_extractor.pb.h:17:2: error: This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
./cld_3/protos/feature_extractor.pb.h:18:2: error: incompatible with your Protocol Buffer headers. Please
#error incompatible with your Protocol Buffer headers. Please
 ^
./cld_3/protos/feature_extractor.pb.h:19:2: error: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
 ^
./cld_3/protos/feature_extractor.pb.h:140:33: error: non-virtual member function marked 'final' hides virtual member function
  inline Parameter* New() const final {
                                ^
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/message_lite.h:188:24: note: hidden overloaded virtual
function 'google::protobuf::MessageLite::New' declared here: different number of parameters (1 vs 0)
  virtual MessageLite* New(Arena* arena) const = 0;
                       ^
In file included from embedding_feature_extractor.cc:16:
In file included from ./embedding_feature_extractor.h:23:
In file included from ./feature_extractor.h:45:
./cld_3/protos/feature_extractor.pb.h:197:3: error: unknown type name 'PROTOBUF_MUST_USE_RESULT'
  PROTOBUF_MUST_USE_RESULT std::string* release_name();
  ^
./cld_3/protos/feature_extractor.pb.h:197:33: error: non-friend class member 'string' cannot have a qualified name
  PROTOBUF_MUST_USE_RESULT std::string* release_name();
                           ~~~~~^
./cld_3/protos/feature_extractor.pb.h:197:39: error: expected ';' at end of declaration list
  PROTOBUF_MUST_USE_RESULT std::string* release_name();
                                      ^
                                      ;
./cld_3/protos/feature_extractor.pb.h:215:3: error: unknown type name 'PROTOBUF_MUST_USE_RESULT'
  PROTOBUF_MUST_USE_RESULT std::string* release_value();
  ^
./cld_3/protos/feature_extractor.pb.h:215:33: error: non-friend class member 'string' cannot have a qualified name
  PROTOBUF_MUST_USE_RESULT std::string* release_value();
                           ~~~~~^
./cld_3/protos/feature_extractor.pb.h:215:33: error: duplicate member 'string'
./cld_3/protos/feature_extractor.pb.h:197:33: note: previous declaration is here
  PROTOBUF_MUST_USE_RESULT std::string* release_name();
                                ^
./cld_3/protos/feature_extractor.pb.h:215:39: error: expected ';' at end of declaration list
  PROTOBUF_MUST_USE_RESULT std::string* release_value();
                                      ^
                                      ;
./cld_3/protos/feature_extractor.pb.h:92:9: error: cannot initialize object parameter of type 'const
google::protobuf::MessageLite' with an expression of type 'chrome_lang_id::Parameter'
    if (GetOwningArena() == from.GetOwningArena()
        ^~~~~~~~~~~~~~
./cld_3/protos/feature_extractor.pb.h:92:29: error: cannot initialize object parameter of type 'const
google::protobuf::MessageLite' with an expression of type 'chrome_lang_id::Parameter'
    if (GetOwningArena() == from.GetOwningArena()
                            ^~~~
./cld_3/protos/feature_extractor.pb.h:126:9: error: cannot initialize object parameter of type 'const
google::protobuf::MessageLite' with an expression of type 'chrome_lang_id::Parameter'
    if (GetOwningArena() == other->GetOwningArena()) {
        ^~~~~~~~~~~~~~
./cld_3/protos/feature_extractor.pb.h:126:29: error: cannot initialize object parameter of type 'const
google::protobuf::MessageLite' with an expression of type 'chrome_lang_id::Parameter'
    if (GetOwningArena() == other->GetOwningArena()) {
                            ^~~~~
./cld_3/protos/feature_extractor.pb.h:129:7: error: no matching function for call to 'GenericSwap'
      ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/generated_message_util.h:163:22: note: candidate function
not viable: no known conversion from 'chrome_lang_id::Parameter *' to 'google::protobuf::MessageLite *' for 1st argument
PROTOBUF_EXPORT void GenericSwap(MessageLite* m1, MessageLite* m2);
                     ^
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/generated_message_util.h:165:22: note: candidate function
not viable: no known conversion from 'chrome_lang_id::Parameter *' to 'google::protobuf::Message *' for 1st argument
PROTOBUF_EXPORT void GenericSwap(Message* m1, Message* m2);
                     ^
In file included from embedding_feature_extractor.cc:16:
In file included from ./embedding_feature_extractor.h:23:
In file included from ./feature_extractor.h:45:
./cld_3/protos/feature_extractor.pb.h:134:19: error: cannot initialize object parameter of type 'const
google::protobuf::MessageLite' with an expression of type 'chrome_lang_id::Parameter'
    GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
                  ^~~~~~~~~~~~~~
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/stubs/logging.h:192:26: note: expanded from macro
'GOOGLE_DCHECK'
#define GOOGLE_DCHECK    GOOGLE_CHECK
                         ^
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/stubs/logging.h:152:26: note: expanded from macro
'GOOGLE_CHECK'
  GOOGLE_LOG_IF(FATAL, !(EXPRESSION)) << "CHECK failed: " #EXPRESSION ": "
                         ^~~~~~~~~~
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/stubs/logging.h:149:5: note: expanded from macro
'GOOGLE_LOG_IF'
  !(CONDITION) ? (void)0 : GOOGLE_LOG(LEVEL)
    ^~~~~~~~~
In file included from embedding_feature_extractor.cc:16:
In file included from ./embedding_feature_extractor.h:23:
In file included from ./feature_extractor.h:45:
./cld_3/protos/feature_extractor.pb.h:134:39: error: cannot initialize object parameter of type 'const
google::protobuf::MessageLite' with an expression of type 'chrome_lang_id::Parameter'
    GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
                                      ^~~~~
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/stubs/logging.h:192:26: note: expanded from macro
'GOOGLE_DCHECK'
#define GOOGLE_DCHECK    GOOGLE_CHECK
                         ^
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/stubs/logging.h:152:26: note: expanded from macro
'GOOGLE_CHECK'
  GOOGLE_LOG_IF(FATAL, !(EXPRESSION)) << "CHECK failed: " #EXPRESSION ": "
                         ^~~~~~~~~~
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/stubs/logging.h:149:5: note: expanded from macro
'GOOGLE_LOG_IF'
  !(CONDITION) ? (void)0 : GOOGLE_LOG(LEVEL)
    ^~~~~~~~~
In file included from embedding_feature_extractor.cc:16:
In file included from ./embedding_feature_extractor.h:23:
In file included from ./feature_extractor.h:45:
./cld_3/protos/feature_extractor.pb.h:305:49: error: non-virtual member function marked 'final' hides virtual member function
  inline FeatureFunctionDescriptor* New() const final {
                                                ^
/opt/homebrew/Cellar/protobuf/HEAD-b360b9e_1/include/google/protobuf/message_lite.h:188:24: note: hidden overloaded virtual
function 'google::protobuf::MessageLite::New' declared here: different number of parameters (1 vs 0)
  virtual MessageLite* New(Arena* arena) const = 0;
                       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [embedding_feature_extractor.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/lerk/.rvm/gems/ruby-3.0.3/gems/cld3-3.4.3 for inspection.
Results logged to /Users/lerk/.rvm/gems/ruby-3.0.3/extensions/arm64-darwin-21/3.0.0/cld3-3.4.3/gem_make.out

  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:93:in `run'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:44:in `block in make'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:36:in `each'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:36:in `make'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:63:in `block in build'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:159:in `build_extension'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:193:in `block in build_extensions'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:190:in `each'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/ext/builder.rb:190:in `build_extensions'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/installer.rb:845:in `build_extensions'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/rubygems_gem_installer.rb:71:in `build_extensions'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/source/rubygems.rb:200:in `install'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/installer/gem_installer.rb:54:in `install'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/installer/parallel_installer.rb:186:in `do_install'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/worker.rb:62:in `apply_func'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/worker.rb:57:in `block in process_queue'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/worker.rb:54:in `loop'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/worker.rb:54:in `process_queue'
  /Users/lerk/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/bundler/worker.rb:91:in `block (2 levels) in create_threads'
lfuelling commented 2 years ago

I'm not really sure why but downgrading bundler from 2.3.0 to 2.2.33 fixed the issue, so it's probably not a bug with this library.