akihikodaki / cld3-ruby

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

Building gem fails on mac os #41

Open j-manu opened 1 year ago

j-manu commented 1 year ago

I forked this gem to have a compatible branch for ruby 3.2 but building from source and installing it fails on Mac OS (Intel)

❯ gem install ./cld3-3.5.0.gem
Building native extensions. This could take a while...
ERROR:  Error installing ./cld3-3.5.0.gem:
    ERROR: Failed to build gem native extension.

    current directory: /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/cld3-3.5.0/ext/cld3
/Users/manu/.asdf/installs/ruby/3.2.1/bin/ruby -I /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0 extconf.rb
creating Makefile

current directory: /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/cld3-3.5.0/ext/cld3
make DESTDIR\= sitearchdir\=./.gem.20230220-22477-6v5sf9 sitelibdir\=./.gem.20230220-22477-6v5sf9 clean

current directory: /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/cld3-3.5.0/ext/cld3
make DESTDIR\= sitearchdir\=./.gem.20230220-22477-6v5sf9 sitelibdir\=./.gem.20230220-22477-6v5sf9
compiling nnet_language_identifier_c.cc
nnet_language_identifier_c.cc:21:10: fatal error: 'nnet_language_identifier.h' file not found
#include "nnet_language_identifier.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [nnet_language_identifier_c.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/cld3-3.5.0 for inspection.
Results logged to /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/extensions/x86_64-darwin-21/3.2.0/cld3-3.5.0/gem_make.out
j-manu commented 1 year ago

gem install cld3 works. Only building from source fails

akihikodaki commented 1 year ago

I suspect you didn't clone submodule. Run git submodule update --init and please tell me if it works.

j-manu commented 1 year ago

Doing that gives a different error for ruby 3.2

❯ gem install ./cld3-3.5.0.gem
ERROR:  Error installing ./cld3-3.5.0.gem:
    ERROR: Failed to build gem native extension.

    current directory: /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/cld3-3.5.0/ext/cld3
/Users/manu/.asdf/installs/ruby/3.2.1/bin/ruby -I /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0 extconf.rb
/Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:2290:in `initialize': No such file or directory @ rb_sysopen - fixunicodevalue.h (Errno::ENOENT)
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:2290:in `open'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:2290:in `copy_file'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:1088:in `copy_file'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:887:in `block in cp'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:2481:in `block in fu_each_src_dest'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:2497:in `fu_each_src_dest0'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:2479:in `fu_each_src_dest'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:886:in `cp'
    from extconf.rb:25:in `rescue in rescue in ln_fallback'
    from extconf.rb:22:in `rescue in ln_fallback'
    from extconf.rb:19:in `ln_fallback'
    from extconf.rb:46:in `block in <main>'
    from extconf.rb:45:in `each'
    from extconf.rb:45:in `<main>'
/Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:722:in `symlink': File exists @ syserr_fail2_in - script_span/fixunicodevalue.h (Errno::EEXIST)
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:722:in `block in ln_s'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:2497:in `fu_each_src_dest0'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:720:in `ln_s'
    from extconf.rb:23:in `rescue in ln_fallback'
    from extconf.rb:19:in `ln_fallback'
    from extconf.rb:46:in `block in <main>'
    from extconf.rb:45:in `each'
    from extconf.rb:45:in `<main>'
/Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:527:in `link': No such file or directory @ rb_file_s_link - (fixunicodevalue.h, script_span/fixunicodevalue.h) (Errno::ENOENT)
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:527:in `block in ln'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:2497:in `fu_each_src_dest0'
    from /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/fileutils.rb:525:in `ln'
    from extconf.rb:20:in `ln_fallback'
    from extconf.rb:46:in `block in <main>'
    from extconf.rb:45:in `each'
    from extconf.rb:45:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/cld3-3.5.0 for inspection.
Results logged to /Users/manu/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/extensions/x86_64-darwin-21/3.2.0/cld3-3.5.0/gem_make.out