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

M1 build issue and fix #1827

Open
msaroufim opened this issue Dec 2, 2024 · 0 comments
Open

M1 build issue and fix #1827

msaroufim opened this issue Dec 2, 2024 · 0 comments

Comments

@msaroufim
Copy link
Member

msaroufim commented Dec 2, 2024

@cjyabraham and I have been running into a recent issue where building native (c++) gem extensions has been failing on M1 and we at first thought it was because of my PR #1816 but upon reverting we noticed the issue persisted

Fetching unf_ext 0.0.7.7
Installing unf_ext 0.0.7.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/cjyabraham/Sites/pytorch.github.io/vendor/bundler/ruby/2.7.0/gems/unf_ext-0.0.7.7/ext/unf_ext
/Users/cjyabraham/.asdf/installs/ruby/2.7.8/bin/ruby -I /Users/cjyabraham/.asdf/installs/ruby/2.7.8/lib/ruby/2.7.0 -r
./siteconf20241127-13764-141w4yo.rb extconf.rb
checking for -lstdc++... yes
creating Makefile

current directory: /Users/cjyabraham/Sites/pytorch.github.io/vendor/bundler/ruby/2.7.0/gems/unf_ext-0.0.7.7/ext/unf_ext
make "DESTDIR=" clean

current directory: /Users/cjyabraham/Sites/pytorch.github.io/vendor/bundler/ruby/2.7.0/gems/unf_ext-0.0.7.7/ext/unf_ext
make "DESTDIR="
compiling unf.cc
In file included from unf.cc:1:
./unf/normalizer.hh:4:10: fatal error: 'vector' file not found
    4 | #include <vector>
      |          ^~~~~~~~
1 error generated.
make[1]: *** [unf.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/cjyabraham/Sites/pytorch.github.io/vendor/bundler/ruby/2.7.0/gems/unf_ext-0.0.7.7 for inspection.
Results logged to
/Users/cjyabraham/Sites/pytorch.github.io/vendor/bundler/ruby/2.7.0/extensions/arm64-darwin-22/2.7.0/unf_ext-0.0.7.7/gem_make.out

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

In Gemfile:
  github-pages was resolved to 214, which depends on
    github-pages-health-check was resolved to 1.17.0, which depends on
      dnsruby was resolved to 1.61.5, which depends on
        simpleidn was resolved to 0.2.1, which depends on
          unf was resolved to 0.1.4, which depends on
            unf_ext
make: *** [install] Error 5

The problem is that custom gem extensions were failing and the fix was

softwareupdate --all --install --force
xcode-select --install
rbenv uninstall 3.1.2
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
cd "$(rbenv root)"/plugins/ruby-build && git pull
RUBY_CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 3.1.2
rbenv local 3.1.2
ruby -v

There might be a simpler solution but not sure what

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
gem install unf_ext -v '0.0.7.7'

Fetching unf_ext-0.0.7.7.gem
Building native extensions. This could take a while...
Successfully installed unf_ext-0.0.7.7
Parsing documentation for unf_ext-0.0.7.7
Installing ri documentation for unf_ext-0.0.7.7
Done installing documentation for unf_ext after 0 seconds
1 gem installed

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant