Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[install] Unable to complete bundle install - machine `arm64-apple' not recognized #2171

Closed
1 task done
mengqing opened this issue Jan 12, 2021 · 8 comments
Closed
1 task done
Labels
topic/installation Installation difficulties

Comments

@mengqing
Copy link

Have you read and followed the installation tutorial at http://www.nokogiri.org/tutorials/installing_nokogiri.html?

  • Yes!

What is the complete output of gem install or bundle install?

Installing nokogiri 1.11.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/ext/nokogiri
/Users/john/.rvm/rubies/ruby-3.0.0/bin/ruby -I /Users/john/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0 -r ./siteconf20210113-52105-71gqs4.rb extconf.rb
checking for whether -g is accepted as CFLAGS... yes
checking for whether -Winline is accepted as CFLAGS... yes
checking for whether -Wmissing-noreturn is accepted as CFLAGS... yes
checking for whether -Wno-error=unused-command-line-argument-hard-error-in-future is accepted as CFLAGS... no
Building nokogiri using packaged libraries.
Static linking is enabled.
Cross build is disabled.
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
Using mini_portile version 2.5.0
checking for iconv... yes
---------- IMPORTANT NOTICE ----------
Building Nokogiri with a packaged version of libxml2-2.9.10.
Configuration options: --host\=arm64-apple-darwin20 --enable-static --disable-shared
--libdir\=/Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/ports/arm64-apple-darwin20/libxml2/2.9.10/lib --with-iconv\=yes --without-python --without-readline --with-c14n
--with-debug --with-threads --disable-shared --enable-static RANLIB\=/usr/bin/ranlib AR\=/usr/bin/ar CFLAGS\=-O2\ -U_FORTIFY_SOURCE\ -g\ -fPIC
The following patches are being applied:
  - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
  - 0002-Remove-script-macro-support.patch
  - 0003-Update-entities-to-remove-handling-of-ssi.patch
  - 0004-libxml2.la-is-in-top_builddir.patch
  - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
  - 0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch
  - 0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch
  - 0008-use-glibc-strlen.patch
  - 0009-avoid-isnan-isinf.patch

The Nokogiri maintainers intend to provide timely security updates, but if
this is a concern for you and want to use your OS/distro system library
instead, then abort this installation process and install nokogiri as
instructed at:

  https://nokogiri.org/tutorials/installing_nokogiri.html#install-with-system-libraries

Note, however, that nokogiri cannot guarantee compatiblity with every
version of libxml2 that may be provided by OS/package vendors.

Extracting libxml2-2.9.10.tar.gz into tmp/arm64-apple-darwin20/ports/libxml2/2.9.10... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0002-Remove-script-macro-support.patch... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0008-use-glibc-strlen.patch... OK
Running git apply with /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/patches/libxml2/0009-avoid-isnan-isinf.patch... OK
Running 'configure' for libxml2 2.9.10... ERROR, review
'/Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1/ext/nokogiri/tmp/arm64-apple-darwin20/ports/libxml2/2.9.10/configure.log' to see what happened. Last lines are:
========================================================================
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... arm-apple-darwin20.2.0
checking host system type... Invalid configuration `arm64-apple-darwin20': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin20 failed
========================================================================
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/john/.rvm/rubies/ruby-3.0.0/bin/$(RUBY_BASE_NAME)
	--help
	--clean
	--prevent-strip
	--use-system-libraries
	--use-system-libraries
	--enable-static
	--disable-static
	--enable-cross-build
	--disable-cross-build
	--with-zlib-dir
	--without-zlib-dir
	--with-zlib-include
	--without-zlib-include=${zlib-dir}/include
	--with-zlib-lib
	--without-zlib-lib=${zlib-dir}/lib
	--with-iconv-dir
	--without-iconv-dir
	--with-iconv-include
	--without-iconv-include=${iconv-dir}/include
	--with-iconv-lib
	--without-iconv-lib=${iconv-dir}/lib
/Users/john/.rvm/gems/ruby-3.0.0@test/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:405:in `block in execute': Failed to complete configure task (RuntimeError)
	from /Users/john/.rvm/gems/ruby-3.0.0@test/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:376:in `chdir'
	from /Users/john/.rvm/gems/ruby-3.0.0@test/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:376:in `execute'
	from /Users/john/.rvm/gems/ruby-3.0.0@test/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:110:in `configure'
	from /Users/john/.rvm/gems/ruby-3.0.0@test/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:153:in `cook'
	from extconf.rb:452:in `block (2 levels) in process_recipe'
	from extconf.rb:229:in `block in chdir_for_build'
	from extconf.rb:228:in `chdir'
	from extconf.rb:228:in `chdir_for_build'
	from extconf.rb:451:in `block in process_recipe'
	from <internal:kernel>:90:in `tap'
	from extconf.rb:354:in `process_recipe'
	from extconf.rb:676:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/john/.rvm/gems/ruby-3.0.0@test/extensions/arm64-darwin-20/3.0.0/nokogiri-1.11.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1 for inspection.
Results logged to /Users/john/.rvm/gems/ruby-3.0.0@test/extensions/arm64-darwin-20/3.0.0/nokogiri-1.11.1/gem_make.out

An error occurred while installing nokogiri (1.11.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.11.1' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  apollo_upload_server was resolved to 2.0.3, which depends on
    rails was resolved to 6.1.1, which depends on
      actioncable was resolved to 6.1.1, which depends on
        actionpack was resolved to 6.1.1, which depends on
          actionview was resolved to 6.1.1, which depends on
            rails-dom-testing was resolved to 2.0.3, which depends on
              nokogiri

If installation completed but is broken, what is the complete output from nokogiri -v?

# Nokogiri (1.11.1)
    ---
    warnings: []
    nokogiri:
      version: 1.11.1
      cppflags:
      - "-I/Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1-arm64-darwin/ext/nokogiri"
      - "-I/Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1-arm64-darwin/ext/nokogiri/include"
      - "-I/Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1-arm64-darwin/ext/nokogiri/include/libxml2"
    ruby:
      version: 3.0.0
      platform: arm64-darwin20
      gem_platform: arm64-darwin-20
      description: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]
      engine: ruby
    libxml:
      source: packaged
      precompiled: true
      patches:
      - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
      - 0002-Remove-script-macro-support.patch
      - 0003-Update-entities-to-remove-handling-of-ssi.patch
      - 0004-libxml2.la-is-in-top_builddir.patch
      - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
      - 0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch
      - 0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch
      - '0008-use-glibc-strlen.patch'
      - '0009-avoid-isnan-isinf.patch'
      libxml2_path: "/Users/john/.rvm/gems/ruby-3.0.0@test/gems/nokogiri-1.11.1-arm64-darwin/ext/nokogiri"
      iconv_enabled: true
      compiled: 2.9.10
      loaded: 2.9.10
    libxslt:
      source: packaged
      precompiled: true
      patches: []
      compiled: 1.1.34
      loaded: 1.1.34
    other_libraries:
      zlib: 1.2.11
      libiconv: '1.15'

If installation failed during compilation, what are the complete contents of the mkmf.log file generated during the failed installation?

block in append_cflags: checking for whether -g is accepted as CFLAGS... -------------------- yes

"gcc -fdeclspec -o conftest -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe conftest.c  -L. -L/Users/john/.rvm/rubies/ruby-3.0.0/lib -L. -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -fstack-protector-strong -L/usr/local/lib  -m64   -lruby.3.0   "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

"gcc -fdeclspec -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe -m64 -g -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

--------------------

block in append_cflags: checking for whether -Winline is accepted as CFLAGS... -------------------- yes

"gcc -fdeclspec -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe -g -m64 -Winline -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

--------------------

block in append_cflags: checking for whether -Wmissing-noreturn is accepted as CFLAGS... -------------------- yes

"gcc -fdeclspec -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe -g -Winline -m64 -Wmissing-noreturn -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

--------------------

block in append_cflags: checking for whether -Wno-error=unused-command-line-argument-hard-error-in-future is accepted as CFLAGS... -------------------- no

"gcc -fdeclspec -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe -g -Winline -Wmissing-noreturn -m64 -Wno-error=unused-command-line-argument-hard-error-in-future -Werror -c conftest.c"
error: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Werror,-Wunknown-warning-option]
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

--------------------

have_header: checking for iconv.h... -------------------- yes

"gcc -E -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe -g -Winline -Wmissing-noreturn  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <iconv.h>
/* end */

--------------------

have_library: checking for gzdopen() in -lz... -------------------- yes

"gcc -fdeclspec -o conftest -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe -g -Winline -Wmissing-noreturn conftest.c  -L. -L/Users/john/.rvm/rubies/ruby-3.0.0/lib -L. -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -fstack-protector-strong -L/usr/local/lib  -m64   -lruby.3.0 -lz   "
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <zlib.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     int (* volatile tp)(void)=(int (*)(void))&t;
11:     printf("%d", (*tp)());
12:   }
13: 
14:   return !!argv[argc];
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((*)()))gzdopen; return !p; }
/* end */

--------------------

try_link_iconv: checking for iconv... -------------------- yes

"gcc -fdeclspec -o conftest -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe -g -Winline -Wmissing-noreturn conftest.c  -L. -L/Users/john/.rvm/rubies/ruby-3.0.0/lib -L. -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -fstack-protector-strong -L/usr/local/lib  -m64   -lruby.3.0   "
Undefined symbols for architecture arm64:
  "_iconv", referenced from:
      _main in conftest-2e2e4d.o
  "_iconv_open", referenced from:
      _main in conftest-2e2e4d.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <stdlib.h>
 4: #include <iconv.h>
 5: int main(void)
 6: {
 7:     iconv_t cd = iconv_open("", "");
 8:     iconv(cd, NULL, NULL, NULL, NULL);
 9:     return EXIT_SUCCESS;
10: }
/* end */

"gcc -fdeclspec -o conftest -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/arm64-darwin20 -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/john/.rvm/rubies/ruby-3.0.0/include/ruby-3.0.0 -I. -I/opt/homebrew/opt/libffi/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -I/opt/homebrew/opt/libyaml/include -I/opt/homebrew/opt/libksba/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openssl@1.1/include -fno-common -pipe -g -Winline -Wmissing-noreturn conftest.c  -L. -L/Users/john/.rvm/rubies/ruby-3.0.0/lib -L. -L/opt/homebrew/opt/libyaml/lib -L/opt/homebrew/opt/libksba/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openssl@1.1/lib -fstack-protector-strong -L/usr/local/lib  -m64   -lruby.3.0 -liconv  "
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <stdlib.h>
 4: #include <iconv.h>
 5: int main(void)
 6: {
 7:     iconv_t cd = iconv_open("", "");
 8:     iconv(cd, NULL, NULL, NULL, NULL);
 9:     return EXIT_SUCCESS;
10: }
/* end */

--------------------

Tell us about your system!

What is the output from ruby -v? ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]

What is the output from gem -v? 3.2.3

What is the output from gem env?

RubyGems Environment:
  - RUBYGEMS VERSION: 3.2.3
  - RUBY VERSION: 3.0.0 (2020-12-25 patchlevel 0) [arm64-darwin20]
  - INSTALLATION DIRECTORY: /Users/john/.rvm/gems/ruby-3.0.0@test
  - USER INSTALLATION DIRECTORY: /Users/john/.gem/ruby/3.0.0
  - RUBY EXECUTABLE: /Users/john/.rvm/rubies/ruby-3.0.0/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /Users/john/.rvm/gems/ruby-3.0.0@test/bin
  - SPEC CACHE DIRECTORY: /Users/john/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/john/.rvm/rubies/ruby-3.0.0/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - arm64-darwin-20
  - GEM PATHS:
     - /Users/john/.rvm/gems/ruby-3.0.0@test
     - /Users/john/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/john/.rvm/gems/ruby-3.0.0@test/bin
     - /Users/john/.rvm/gems/ruby-3.0.0@global/bin
     - /Users/john/.rvm/rubies/ruby-3.0.0/bin
     - /Users/john/.rvm/bin
     - /Users/john/.nvm/versions/node/v14.15.4/bin
     - /usr/local/homebrew/opt/elasticsearch@6/bin
     - /opt/homebrew/bin
     - /opt/homebrew/sbin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin

If you're using Bundler:

  • what is the output from bundle version? Bundler version 2.2.3 (2021-01-12 commit unknown)
  • what is the output from bundle config? (Take care to redact any credentials)
Set for the current user (/Users/john/.bundle/config): "--global jobs 8"

If you're on MacOS, please note:

  • the version of XCode you have installed (if you know) Version 12.3 (12C33)
  • the output of gcc -v or clang -v Apple clang version 12.0.0 (clang-1200.0.32.28)

If Linux or a BSD variant, please note:

  • the distro you're using
  • the output of uname -a
  • the contents of /etc/lsb-release.

If Windows, please note:

  • whether you're installing the precompiled gems, or compiling yourself with DevKit
  • the version of RubyInstaller you've installed
  • or if you're not using RubyInstaller, how did you install Ruby?
@mengqing mengqing added the topic/installation Installation difficulties label Jan 12, 2021
@mengqing mengqing changed the title [install] Unable to complete bundle install [install] Unable to complete bundle install - Invalid configuration arm64-apple-darwin20': machine arm64-apple' not recognized Jan 12, 2021
@mengqing mengqing changed the title [install] Unable to complete bundle install - Invalid configuration arm64-apple-darwin20': machine arm64-apple' not recognized [install] Unable to complete bundle install - machine `arm64-apple' not recognized Jan 12, 2021
@mengqing
Copy link
Author

I'm able to install nokogiri fine

gem install nokogiri
Successfully installed nokogiri-1.11.1-arm64-darwin
Parsing documentation for nokogiri-1.11.1-arm64-darwin
Done installing documentation for nokogiri after 0 seconds
1 gem installed

However I'm not able to complete bundle install

@flavorjones
Copy link
Member

@mengqing Thanks for reporting. The root cause of this is upstream in libxml2's build files.

However, bundler should be installing the native precompiled gem for you (like gem install does). Can you please double-check your bundler config? Is it possible that at some point in the past you configured bundler to install nokogiri with --use-system-libraries?

@flavorjones
Copy link
Member

@mengqing I hate to pass this problem off, but I'm not sure how to help if gem install is working, and I'd like to involve the Bundler team in the conversation.

Would you be willing to open a bundler-related issue at the rubygems project? Here's a link to do so: https://github.com/rubygems/rubygems/issues/new?assignees=&labels=Bundler&template=bundler-related-issue.md&title=

@mengqing
Copy link
Author

@flavorjones Thanks Mike, after a few hours of fiddling, I was able to finish bundle install after setting the bundle config following this section https://nokogiri.org/tutorials/installing_nokogiri.html#installing-using-standard-system-libraries

bundle config build.nokogiri --use-system-libraries.

I'm not sure why though, could it be that the version packaged with Nokogiri isn't compatible? Anyway I'm closing this issue now

@milosivanovic
Copy link

I've had issues with outdated config.sub files causing this very stubborn error all over the place when using Big Sur on arm64 (M1). It's not at all confined to nokogiri's bundled use of libxml2 but is happening all over the ecosystem: rvm, ruby gems, python packages, etc.

In this case, for nokogiri:

Running 'configure' for libxml2 2.9.10... ERROR, review '/Users/milos/.rvm/gems/ruby-2.6.6@learn-rails/gems/nokogiri-1.11.2/ext/nokogiri/tmp/aarch64-apple-darwin20.3.0/ports/libxml2/2.9.10/configure.log' to see what happened. Last lines
are:
========================================================================
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... Invalid configuration `arm64-apple-darwin20.3.0': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin20.3.0 failed
========================================================================

Or, rvm -- even pre-3.0 version of RUBY fail to compile for the same reason:

milos@air:~$ rvm install ruby-2.6
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/11.2/arm64/ruby-2.6.6.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/milos/.rvm/rubies/ruby-2.6.6, this may take a while depending on your cpu(s)...
ruby-2.6.6 - #downloading ruby-2.6.6, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.4M  100 13.4M    0     0  2881k      0  0:00:04  0:00:04 --:--:-- 3060k
ruby-2.6.6 - #extracting ruby-2.6.6 to /Users/milos/.rvm/src/ruby-2.6.6.....
ruby-2.6.6 - #configuring.
Error running './configure --prefix=/Users/milos/.rvm/rubies/ruby-2.6.6 --with-opt-dir=/opt/homebrew/opt/libyaml:/opt/homebrew/opt/libksba:/opt/homebrew/opt/readline:/opt/homebrew/opt/zlib:/opt/homebrew/opt/openssl@1.1 --disable-install-d
oc --enable-shared',
please read /Users/milos/.rvm/log/1617283064_ruby-2.6.6/configure.log
There has been an error while running configure. Halting the installation.

and the log file contains:

[2021-04-02 02:17:45] ./configure
current path: /Users/milos/.rvm/src/ruby-2.6.6
GEM_PATH=/Users/milos/.rvm/gems/ruby-3.0.0@learn-rails:/Users/milos/.rvm/gems/ruby-3.0.0@global
GEM_HOME=/Users/milos/.rvm/gems/ruby-3.0.0@learn-rails
PATH=/opt/homebrew/opt/coreutils/bin:/opt/homebrew/opt/pkg-config/bin:/opt/homebrew/opt/libtool/bin:/opt/homebrew/opt/automake/bin:/opt/homebrew/opt/autoconf/bin:/Users/milos/.rvm/gems/ruby-3.0.0@learn-rails/bin:/Users/milos/.rvm/gems/ru>
command(5): ./configure --prefix=/Users/milos/.rvm/rubies/ruby-2.6.6 --with-opt-dir=/opt/homebrew/opt/libyaml:/opt/homebrew/opt/libksba:/opt/homebrew/opt/readline:/opt/homebrew/opt/zlib:/opt/homebrew/opt/openssl@1.1 --disable-install-doc>
checking for ruby... /Users/milos/.rvm/rubies/ruby-3.0.0/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... Invalid configuration `arm64-apple-darwin20.3.0': machine `arm64-apple' not recognized
configure: error: /bin/sh tool/config.sub arm64-apple-darwin20.3.0 failed

It's just insane. This is such a stubborn error that has such a simple fix but it has to be done every single time, in every place where outdated config.sub files exist.

I wish rvm/gem/bundle let you easily edit the extracted source prior to starting the standard compilation step because a simple echo 'echo arm64-apple-darwin' > config.sub at the offending location will immediately resolve this -- once again, stubborn -- issue, albeit only that one time. It is a completely pointless and frustrating error that I wish autoconf could have avoided in its design. It is not future-proof if every time a new architecture is designed we have to update hardcoded entries in a text file. I guess there is probably a reason for needing all of this -> http://git.savannah.gnu.org/cgit/config.git/tree/config.sub but it's clearly not critically required to build when you can infer it from your particular system, i.e. arm64-apple-darwin in this case...

I don't know enough about autoconf's use of config.sub but there must be a better way to resovle this in bulk without falling back to rosetta2/x86_64 (which config.sub has known about for decades so has no issues compiling against). This outdated config.sub problem blocks an insane amount of packages from being able to be natively compiled without modification, and unfortunately many managers like rvm/pip make it difficult to interrupt the conventional process so that the source code can be modified to rectify the outdated config.sub prior to proceeding.

Right now the very latest version of libxml2, 2.9.10, released October 2019, with an outdated config.sub timestamped 2018-08-29 (https://fossies.org/diffs/libxml2/2.9.9_vs_2.9.10/config.sub-diff.html), will of course fail to compile on arm64 systems:

milos@air:~/d/libs$ wget http://xmlsoft.org/sources/libxml2-2.9.10.tar.gz
milos@air:~/d/libs$ tar xf libxml2-2.9.10.tar.gz
milos@air:~/d/libs$ cd libxml2-2.9.10
milos@air:~/d/libs/libxml2-2.9.10$ ./configure
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... Invalid configuration `arm64-apple-darwin20.3.0': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin20.3.0 failed

and after a simple echo 'echo arm64-apple-darwin' > config.sub (or replacing config.sub with the newer version from http://git.savannah.gnu.org/cgit/config.git/tree/config.sub):

milos@air:~/d/libs/libxml2-2.9.10$ ./configure
checking whether to enable maintainer-specific portions of Makefiles... yes
checking build system type... arm64-apple-darwin
checking host system type... arm64-apple-darwin
checking for a BSD-compatible install... /opt/homebrew/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/homebrew/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
...
(completes successfully)

This fix applies to literally every instance of this error on Apple's arm64 hardware.

The problem is, even if we ask all of these package maintainers to update their config.sub files, the older versions will still fail to compile and in many cases you actually must use the older version, so this seems like an incredibly challenging issue to resolve without some kind of bulk solution that hijacks the "checking build system type..." configure step to somehow inject arm64-apple-darwin.

@flavorjones
Copy link
Member

@milosivanovic Hi! Thanks for your comment. I can see you're frustrated. There's lots to unpack in your comment, but I'll try to be brief and give you some things you might want to try next.

You're commenting at length on an issue that's been closed for many months, on a repo that is unrelated to the underlying issue of config.sub. I'm not sure what to say about that except to encourage you to either:

A) open a new issue to get help installing Nokogiri, or
B) open a new issue about the broader goal of patching libxml2 in Nokogiri's packaged source code to enable M1 compilation, or
C) submit this comment upstream to libxml2, or else

For (A), Nokogiri ships precompiled binaries for M1 / arm64 architecture. It seems like you're not using this native gem, and it's not clear why. It's also not clear from your comment what command you're running or what your system config is. Please open a new issue and fill out the "Installation problem" template if you'd like to get help.

For (B), assuming you truly don't want the precompiled version for some reason, Nokogiri can (and does) patch libxml2 at installation/compilation. In fact, we've even done something similar in the past for ppc64le architecture, see #1280 and #1326. I'm only asking for someone to spend a few minutes pairing with me on it, and testing compilation of a branch to verify the solution on M1 hardware.

For (C), it's not totally clear whether libxml2 will take responsibility since this issue is really in automake versions less than 1.11.4. If the next packaged release of libxml2 is done on a system with an up-to-date automake, then this problem will be solved there.

So, once again, please pick one:

  • Provide enough information to get help installing Nokogiri on your system
  • Offer some of your time to help test a permanent fix for compiling Nokogiri's packaged libxml2 on M1
  • Comment upstream

Thanks for reading, and sorry that you're having trouble.

@sparklemotion sparklemotion locked as resolved and limited conversation to collaborators Apr 2, 2021
@flavorjones
Copy link
Member

Also see #2214 which I just opened to try to fix this. I need help testing.

@flavorjones
Copy link
Member

#2214 has been merged and should be fixed in the next release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/installation Installation difficulties
Projects
None yet
Development

No branches or pull requests

3 participants