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

Gem::Ext::BuildError: ERROR: Failed to build gem native extension (Ruby 2.7.4) #275

Open
nyoung-mdsol opened this issue Apr 7, 2023 · 3 comments

Comments

@nyoung-mdsol
Copy link

I am facing this issue still and I have followed all of the advice listed under: https://github.com/rubyjs/mini_racer#troubleshooting and in this issue: #250 to no avail.

Here are the versions I am using:

  • OS: macOS Monterey ver. 12.5 (M1 Pro)
  • Ruby version 2.7.4 (managed by asdf)
  • RubyGems 3.4.10
  • Bundler 2.4.10
  • Gcc clang version 14
  • Miniracer version 0.6.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/nyoung/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
/Users/nyoung/.asdf/installs/ruby/2.7.4/bin/ruby extconf.rb
checking for -lpthread... yes
checking for -lobjc... yes
checking for whether -Wl,--exclude-libs=ALL  is accepted as LDFLAGS... no
creating Makefile

current directory: /Users/nyoung/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make DESTDIR\= sitearchdir\=./.gem.20230407-71543-1b7tmmw sitelibdir\=./.gem.20230407-71543-1b7tmmw clean

current directory: /Users/nyoung/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/mini_racer-0.6.3/ext/mini_racer_extension
make DESTDIR\= sitearchdir\=./.gem.20230407-71543-1b7tmmw sitelibdir\=./.gem.20230407-71543-1b7tmmw
compiling mini_racer_extension.cc
In file included from /Users/nyoung/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/libv8-node-16.10.0.0-arm64-darwin/vendor/v8/include/v8.h:30,
                 from mini_racer_extension.cc:6:
In static member function 'static void v8::internal::Internals::SetEmbedderData(v8::Isolate*, uint32_t, void*)',
    inlined from 'void v8::Isolate::SetData(uint32_t, void*)' at /Users/nyoung/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/libv8-node-16.10.0.0-arm64-darwin/vendor/v8/include/v8.h:12544:21,
    inlined from 'static void IsolateData::Set(v8::Isolate*, Flag, uintptr_t)' at mini_racer_extension.cc:190:25,
    inlined from 'void StackCounter::IncDepth(int)' at mini_racer_extension.cc:284:25,
    inlined from 'StackCounter::~StackCounter()' at mini_racer_extension.cc:266:27,
    inlined from 'StackCounter::~StackCounter()' at mini_racer_extension.cc:264:5,
    inlined from 'VALUE convert_v8_to_ruby(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>)' at mini_racer_extension.cc:676:1:
/Users/nyoung/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/libv8-node-16.10.0.0-arm64-darwin/vendor/v8/include/v8-internal.h:356:37: warning: 'stackCounter.StackCounter::isolate' may be used uninitialized [-Wmaybe-uninitialized]
  356 |     *reinterpret_cast<void**>(addr) = data;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
mini_racer_extension.cc: In function 'VALUE convert_v8_to_ruby(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>)':
mini_racer_extension.cc:569:18: note: 'stackCounter.StackCounter::isolate' was declared here
  569 |     StackCounter stackCounter(isolate);
      |                  ^~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option '-Wno-reserved-user-defined-literal' may have been intended to silence earlier diagnostics
linking shared-object mini_racer_extension.bundle
Undefined symbols for architecture arm64:
  "__ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingESt10unique_ptrINS_17TracingControllerESt14default_deleteIS4_EE", referenced from:
      __ZL7init_v8v in mini_racer_extension.o
  "__ZN2v88platform32NewSingleThreadedDefaultPlatformENS0_15IdleTaskSupportENS0_21InProcessStackDumpingESt10unique_ptrINS_17TracingControllerESt14default_deleteIS4_EE", referenced from:
      __ZL7init_v8v in mini_racer_extension.o
  "__ZSt20__throw_system_errori", referenced from:
      __ZL27rb_platform_set_flag_as_strmm in mini_racer_extension.o
      __ZL7init_v8v in mini_racer_extension.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make: *** [mini_racer_extension.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/nyoung/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/mini_racer-0.6.3 for inspection.
Results logged to /Users/nyoung/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/mini_racer-0.6.3/gem_make.out

I have also tried targeting different platforms such as arm64-darwin with Bundler and that doesn't seem to have any effect.

@tisba
Copy link
Collaborator

tisba commented May 23, 2023

Might be a similar problem to #251

Ruby 2.7.4 is technically EOL since March, but it should still work. I don't have access currently to an arm Mac on Monterey to investigate this further :(

@tisba
Copy link
Collaborator

tisba commented May 26, 2023

Can you try again with 0.6.4, @nyoung-mdsol? I don't have macOS 12.5 around. 12.6.6 in a VM worked as expected for me.

PS: 2.7.4 is EOL, but there has been a last 2.7 release in March. So maybe you can check out Ruby 2.7.8?

@amigobg
Copy link

amigobg commented May 7, 2024

In linux I fix that with
bundle update mini_racer
which updated the libv8-node
from:

 libv8-node (16.10.0.0-x86_64-darwin)
  libv8-node (16.10.0.0-x86_64-linux)

to:

  libv8-node (16.19.0.1-x86_64-darwin)
  libv8-node (16.19.0.1-x86_64-linux)

@tisba tisba changed the title Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Gem::Ext::BuildError: ERROR: Failed to build gem native extension (Ruby 2.7.4) May 7, 2024
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

3 participants