rubyjs / mini_racer

Minimal embedded v8
MIT License
594 stars 93 forks source link

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

Closed nyoung-mdsol closed 2 weeks ago

nyoung-mdsol commented 1 year ago

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: https://github.com/rubyjs/mini_racer/issues/250 to no avail.

Here are the versions I am using:

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::Local)' 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::Local)': 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 "ZSt20throw_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 commented 1 year ago

Might be a similar problem to https://github.com/rubyjs/mini_racer/issues/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 commented 1 year ago

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 commented 5 months ago

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 commented 2 weeks ago

There have been many changes, since the issue was opened. I hope you could resolve the issue by now @nyoung-mdsol.