rubys / nokogumbo

A Nokogiri interface to the Gumbo HTML5 parser.
Apache License 2.0
186 stars 114 forks source link

Unable to install nokogumbo on mac m1 v12.6 #183

Closed Clemsx closed 1 year ago

Clemsx commented 1 year ago

Hello, i'm trying to install nokogumbo but I have this error

    current directory: /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/nokogumbo-2.0.5/ext/nokogumbo
/Users/clementx/.rbenv/versions/2.7.4/bin/ruby -I /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0 extconf.rb
WARNING: Nokogiri was built against LibXML version 2.10.3, but has dynamically loaded 2.9.4
checking for xmlNewDoc() in -lxml2... yes
checking for nokogiri.h... no
checking for nokogiri.h in /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/nokogiri-1.10.10/ext/nokogiri... yes
creating Makefile

current directory: /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/nokogumbo-2.0.5/ext/nokogumbo
make DESTDIR\= sitearchdir\=./.gem.20221022-50010-15fn3mi sitelibdir\=./.gem.20221022-50010-15fn3mi clean

current directory: /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/nokogumbo-2.0.5/ext/nokogumbo
make DESTDIR\= sitearchdir\=./.gem.20221022-50010-15fn3mi sitelibdir\=./.gem.20221022-50010-15fn3mi
compiling nokogumbo.c
In file included from nokogumbo.c:53:
/Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/nokogiri-1.10.10/ext/nokogiri/nokogiri.h:13:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
#define _GNU_SOURCE
        ^
/Users/clementx/.rbenv/versions/2.7.4/include/ruby-2.7.0/arm64-darwin21/ruby/config.h:16:9: note: previous definition is here
#define _GNU_SOURCE 1
        ^
1 warning generated.
compiling ./../../gumbo-parser/src/string_buffer.c
compiling ./../../gumbo-parser/src/svg_attrs.c
compiling ./../../gumbo-parser/src/ascii.c
compiling ./../../gumbo-parser/src/util.c
compiling ./../../gumbo-parser/src/svg_tags.c
compiling ./../../gumbo-parser/src/vector.c
compiling ./../../gumbo-parser/src/attribute.c
compiling ./../../gumbo-parser/src/token_buffer.c
compiling ./../../gumbo-parser/src/char_ref.c
compiling ./../../gumbo-parser/src/utf8.c
compiling ./../../gumbo-parser/src/error.c
./../../gumbo-parser/src/error.c:99:20: warning: cast to smaller integer type 'GumboTag' from 'void *' [-Wvoid-pointer-to-enum-cast]
    GumboTag tag = (GumboTag) error->tag_stack.data[i];
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
compiling ./../../gumbo-parser/src/tag.c
compiling ./../../gumbo-parser/src/parser.c
./../../gumbo-parser/src/parser.c:540:10: warning: cast to smaller integer type 'GumboInsertionMode' from 'void *' [-Wvoid-pointer-to-enum-cast]
  return (GumboInsertionMode) modes->data[(modes->length - 1)];
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
compiling ./../../gumbo-parser/src/foreign_attrs.c
compiling ./../../gumbo-parser/src/tokenizer.c
compiling ./../../gumbo-parser/src/string_piece.c
compiling ./../../gumbo-parser/src/tag_lookup.c
linking shared-object nokogumbo/nokogumbo.bundle
Undefined symbols for architecture arm64:
  "_Nokogiri_wrap_xml_document", referenced from:
      _parse_continue in nokogumbo.o
  "_cNokogiriXmlSyntaxError", referenced from:
      _add_errors in nokogumbo.o
  "_mNokogiri", referenced from:
      _Init_nokogumbo in nokogumbo.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [nokogumbo.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/nokogumbo-2.0.5 for inspection.
Results logged to /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/nokogumbo-2.0.5/gem_make.out

  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:102:in `run'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:51:in `block in make'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:43:in `each'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:43:in `make'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:171:in `build_extension'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:205:in `block in build_extensions'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:202:in `each'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:202:in `build_extensions'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/site_ruby/2.7.0/rubygems/installer.rb:843:in `build_extensions'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/rubygems_gem_installer.rb:71:in `build_extensions'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/source/rubygems.rb:204:in `install'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/installer/gem_installer.rb:54:in `install'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/worker.rb:62:in `apply_func'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/worker.rb:57:in `block in process_queue'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/worker.rb:54:in `loop'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/worker.rb:54:in `process_queue'
  /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing nokogumbo (2.0.5), and Bundler cannot continue.

Output of gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 3.3.24
  - RUBY VERSION: 2.7.4 (2021-07-07 patchlevel 191) [arm64-darwin21]
  - INSTALLATION DIRECTORY: /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
  - USER INSTALLATION DIRECTORY: /Users/clementx/.gem/ruby/2.7.0
  - RUBY EXECUTABLE: /Users/clementx/.rbenv/versions/2.7.4/bin/ruby
  - GIT EXECUTABLE: /opt/homebrew/bin/git
  - EXECUTABLE DIRECTORY: /Users/clementx/.rbenv/versions/2.7.4/bin
  - SPEC CACHE DIRECTORY: /Users/clementx/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/clementx/.rbenv/versions/2.7.4/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - arm64-darwin-21
  - GEM PATHS:
     - /Users/clementx/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
     - /Users/clementx/.gem/ruby/2.7.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/clementx/.rbenv/versions/2.7.4/bin
     - /opt/homebrew/Cellar/rbenv/1.2.0/libexec
     - /opt/homebrew/opt/openssl@3/bin
     - /Users/clementx/.rbenv/shims
     - /opt/homebrew/bin
     - /opt/homebrew/sbin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Library/Apple/usr/bin

Output of nokogiri -v:

WARNING: Nokogiri was built against LibXML version 2.10.3, but has dynamically loaded 2.9.4
# Nokogiri (1.10.10)
    ---
    warnings:
    - Nokogiri was built against LibXML version 2.10.3, but has dynamically loaded 2.9.4
    nokogiri: 1.10.10
    ruby:
      version: 2.7.4
      platform: arm64-darwin21
      description: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [arm64-darwin21]
      engine: ruby
    libxml:
      binding: extension
      source: system
      compiled: 2.10.3
      loaded: 2.9.4

Can someone help pls ?

flavorjones commented 1 year ago

Hi! Nokogumbo was merged into Nokogiri and we're not really supporting it as a separate gem at this point.

One of the reasons Nokogumbo was merged into Nokogiri is because it was challenging for many users to install. We've worked hard on recent versions of Nokogiri to make installation easy.

You should be able to update your dependency to be on Nokogiri >= 1.12.0 and drop Nokogumbo as a dependency.