-
Notifications
You must be signed in to change notification settings - Fork 120
Unable To Install libv8/therubyracer on M1 Macbook Pro (Apple Silicon) #312
Comments
try out below.. did work for me brew install [email protected] |
I have tried this out already and it didn't work on Apple SIlicon Laptop. I have also mentioned this in the logs already in the issue description. |
did you resolve it? I have the same issue. `brew install --build-from-source [email protected] Do not report this issue to Homebrew/brew or Homebrew/core! ` |
This issue is still unsolved. |
I was able to get this installed on my M1 MacBook Pro using
Should just need to put your version in instead. Hope this helps. |
Unfortunately it did not work at M1 BigSur. But this solution works for intel platform and Catalina v10.15.7 |
Sorry I should have mentioned, this is working on my M1 MacBook on BigSur 11.2 using the steps I provided. |
I am able to install theruby racer using @joedarc's instructions but I get the following when I start my server:
anyone know how to fix this? |
Same here. But as soon as I start the server, i get the same |
@lfrancarj let me know if you find a work around or a solution, I'm still stuck 😕 |
This is a simplified solution for M1 macs https://gist.github.com/fernandoaleman/868b64cd60ab2d51ab24e7bf384da1ca#gistcomment-3723625 |
Hello I search and referred to many links from Google but it didn't work for me. Still, I'm facing the same issue while installing therubyracer gem. I'm using macOS Big Sur version: 11.3.1 (M1) Whenever I install therubyracer gem, I'm getting the following error. @vishalaher@Vishals-MacBook-Air ro-ec % gem install therubyracer Building native extensions. This could take a while... current directory: /Users/vishalaher/.rvm/gems/ruby-2.4.1@ro-ec/gems/libv8-3.16.14.19/ext/libv8 extconf failed, exit code 1 Gem files will remain installed in /Users/vishalaher/.rvm/gems/ruby-2.4.1@ro-ec/gems/libv8-3.16.14.19 for inspection. Can anyone help me to solve this issue? |
Hi @VishalAher0108, while I can't help you directly with that problem since we never got therubyracer to build properly, I can say that swapping in |
You might be interested in libv8-node which has such binaries. |
Has anyone figured out a solution to these issues? |
I've noticed that homebrew on M1 will install in Also |
@professor if you go to the link I provided in my original answer you'll see why, the solution that worked for me required two installations of homebrew. The normal installation will be located at |
anyone having answer for rake commands are not working?. |
#312 (comment) |
@ VparkalauMY, Did you get any working solution for this issue? because I'm facing the same issue and I'm able to install v8 using ibrew, then installed rubyracer using this command. gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/[email protected] But new whenever starting the puma server this error occure. rails s from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in register' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/rmagick-4.2.4/lib/rmagick.rb:1:in 'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in register' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/2.6.0/bundler/runtime.rb:81:in block (2 levels) in require'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/2.6.0/bundler/runtime.rb:76:in each' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/2.6.0/bundler/runtime.rb:76:in block in require'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/2.6.0/bundler/runtime.rb:65:in each' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/2.6.0/bundler/runtime.rb:65:in require'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/2.6.0/bundler.rb:114:in require' from /Users/abhishekverma/Desktop/galaxy/config/application.rb:9:in 'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in register' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:133:in block in perform'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in tap' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in perform'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in run' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in dispatch' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/railties-5.1.7/lib/rails/command/base.rb:63:in perform'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/railties-5.1.7/lib/rails/command.rb:44:in invoke' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/railties-5.1.7/lib/rails/commands.rb:16:in 'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in block in require_with_bootsnap_lfi'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in register' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require_with_bootsnap_lfi'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in require' from /Users/abhishekverma/Desktop/galaxy/bin/rails:9:in <top (required)>'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in load' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in call'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in call' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in run'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in <top (required)>' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in load'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in <top (required)>' from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require'from /Users/abhishekverma/.rbenv/versions/2.6.9/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' from /Users/abhishekverma/Desktop/galaxy/bin/spring:15:in <top (required)>'from bin/rails:3:in load' from bin/rails:3:in '
|
It looks like you have a conflict related to ruby version. Also i think you can try to change the gems version . |
2022 and I still can't get |
This issue is still open for both M1 and non-M1 machines. libv8 does not work |
Related comment over on #318: #318 (comment) |
This work for me. I still don't think we have native m1 solution for this. |
You're not going to, the first libv8 version that supports M1 is V8 9.something, and therubyracer is stuck at V8 3.x. Switch to mini_racer if you can, and encourage projects to move to it if you have such transient dependencies. |
after bundle install. running the server
anyone has the same problem? I'm using M1. |
Yeah we are still having this issue.
…On Thu, Jan 27, 2022 at 4:10 PM aRtoo ***@***.***> wrote:
after bundle install. running the server bin/rails s I get an error:
/Users/raphaelgako/.rvm/gems/ruby-2.3.6/gems/therubyracer-0.12.3/lib/v8.rb:4:in `require': dlopen(/Users/raphaelgako/.rvm/gems/ruby-2.3.6/gems/therubyracer-0.12.3/lib/v8/init.bundle, 0x0009): symbol not found in flat namespace '__ZN2v810ScriptData10PreCompileEPKci' - /Users/raphaelgako/.rvm/gems/ruby-2.3.6/gems/therubyracer-0.12.3/lib/v8/init.bundle (LoadError)
from /Users/raphaelgako/.rvm/gems/ruby-2.3.6/gems/therubyracer-0.12.3/lib/v8.rb:4:in `<top (required)>'
from /Users/raphaelgako/.rvm/gems/ruby-2.3.6/gems/therubyracer-0.12.3/lib/therubyracer.rb:1:in `require'
from /Users/raphaelgako/.rvm/gems/ruby-2.3.6/gems/therubyracer-0.12.3/lib/therubyracer.rb:1:in `<top (required)>'
from /Users/raphaelgako/.rvm/rubies/ruby-2.3.6/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:81:in `require'
anyone has the same problem? I'm using M1.
—
Reply to this email directly, view it on GitHub
<#312 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWBBVHX2ZJ4PO654WMZEQUDUYCZS5ANCNFSM4WKV5HLQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
@samsmata do you think this will be resolve anytime soon? Just wondering because if not im going to return the laptop. We have legacy code at my work and we are using ruby 2.3.6 and wont upgrade it, do you think this will be a problem on this specific ruby version? thank you for your response and I appreciate it. |
My operating system is $ ibrew tap homebrew/core
$ ibrew install [email protected]
$ bundle config --local build.libv8 --with-system-v8
$ bundle config --local build.therubyracer --with-v8-dir=/usr/local/opt/[email protected]
|
What does the:
do here? |
While trying to install
And somewhere I read they have been migrated to |
it will cause other problems $ rake routes
rake aborted!
LoadError: Could not open library '/opt/homebrew/Cellar/rbenv/1.2.0/versions/2.5.5/lib/ruby/gems/2.5.0/gems/cld-0.8.0/ext/cld/lib/cld.so': dlopen(/opt/homebrew/Cellar/rbenv/1.2.0/versions/2.5.5/lib/ruby/gems/2.5.0/gems/cld-0.8.0/ext/cld/lib/cld.so, 0x0005): tried: '/opt/homebrew/Cellar/rbenv/1.2.0/versions/2.5.5/lib/ruby/gems/2.5.0/gems/cld-0.8.0/ext/cld/lib/cld.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/cld.so' (no such file), '/usr/lib/cld.so' (no such file), '/opt/homebrew/Cellar/rbenv/1.2.0/versions/2.5.5/lib/ruby/gems/2.5.0/gems/cld-0.8.0/ext/cld/lib/cld.0.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/cld.0.so' (no such file), '/usr/lib/cld.0.so' (no such file)
/Users/bdu/workspace/appen/make/config/application.rb:12:in `<top (required)>'
/Users/bdu/workspace/appen/make/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
$ rake -T
rake aborted!
LoadError: Could not open library '/opt/homebrew/Cellar/rbenv/1.2.0/versions/2.5.5/lib/ruby/gems/2.5.0/gems/cld-0.8.0/ext/cld/lib/cld.so': dlopen(/opt/homebrew/Cellar/rbenv/1.2.0/versions/2.5.5/lib/ruby/gems/2.5.0/gems/cld-0.8.0/ext/cld/lib/cld.so, 0x0005): tried: '/opt/homebrew/Cellar/rbenv/1.2.0/versions/2.5.5/lib/ruby/gems/2.5.0/gems/cld-0.8.0/ext/cld/lib/cld.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/cld.so' (no such file), '/usr/lib/cld.so' (no such file), '/opt/homebrew/Cellar/rbenv/1.2.0/versions/2.5.5/lib/ruby/gems/2.5.0/gems/cld-0.8.0/ext/cld/lib/cld.0.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/cld.0.so' (no such file), '/usr/lib/cld.0.so' (no such file)
/Users/bdu/workspace/appen/make/config/application.rb:12:in `<top (required)>'
/Users/bdu/workspace/appen/make/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace) |
@TorvaldsDB, You can once try Rosette Terminal for your whole development setup. follow here It has saved me a lot of hours of being stuck at various issues. |
Thanks @amitk-vmware I'm not sure whether it works, but it looks too hacker. I have to use the terminal instead of the iTerm2 or original terminal. Maybe I will have a try it finally, but I wish there were a better way to fix it. |
Hey ya'll, I've dealt with every iteration of this problem possible while trying to install Quick disclaimer: My terminal emulator is not using Rosetta mode. First you'll need to make sure you have a C/C++ compiler that v8 is compatible with. Libv8 recommends GCCv4.4 or higher, so I just opted to use clang++. This is what mine looks like:
Next, I just install [email protected] and the gems individually:
This method uses a compatible C/C++ compiler which solves this issue, and having both |
Thank you @joedarc!!!! You saved me tons of time. Thank you!!!!! |
A. I'm using macOS Monterey version 12.5 (maybe the macOS latest version). And all 5 below solutions didn't work for me. Any other suggestion?
Notes:
is deprecated. And you could search v8 by this command:
B. Here is my Mac information:
|
I tried all suggested solution in this post but no one worked for me. I'm using the latest macOS version: Monterey 12.5 and Apple M1 Pro chip. |
None of these suggestions work with Apple M1 Pro, Monterrey 12.4. |
Here's my catch-all solution to this fiasco in # M1 Macs must use mini_racer. therubyracer is broken: https://github.com/rubyjs/libv8/issues/312
# Intel Macs may use either - but therubyracer requires `brew install [email protected]` and `bundle config build.therubyracer --with-v8-dir=$(brew --prefix)/opt/[email protected]`, while mini_racer works out of the box.
# New Linuxes may use either.
# Old Linuxes must use therubyracer, as mini_racer requires GCC 8+.
is_mac = RUBY_PLATFORM.include?('darwin')
gem 'mini_racer', install_if: is_mac
gem 'therubyracer', install_if: !is_mac
gem 'libv8-node', '16.10.0.0' Please note that if you use Rails 4.x and, by definition, Bundler 1.x, you'll experience problems with musl version of libv8-node being forced by Bundler, which then causes an error, because one doesn't exist. You'll need to
And when you deploy with Capistrano to Linux, you'll need to do the equivalent on the server before every deploy: desc 'Install libv8-node and mini_racer before bundle install'
task :pre_bundler_install do
on roles(:all) do
execute <<~EOF
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
export GEM_PATH=""
export GEM_HOME="#{shared_path}/bundle/ruby/#{rbenv_ruby_version_major}"
cd #{release_path}
for lib in libv8-node mini_racer; do
VERSION=$(grep -Po "(?<=$lib\', \').*" Gemfile | tr -d "'")
REQUEST_VERSION=${VERSION:+-v $VERSION}
rbenv exec gem install --conservative "$lib" $REQUEST_VERSION
done
EOF
end
end Please note this is a knowledge dump from me. Use this information as you please, but I won't be answering questions or debugging your situation. |
I was able to get a successful installation on an M1 macbook running macOS 12.5 by adding the following to my Gemfile: gem 'libv8-node', '16.10.0.0'
gem 'mini_racer' Without the libv8-node gem in the gemfile, libv8-node was just being added as a dependency of mini_racer and always pulling the |
@dojutsu-user TL/DR
I am not sure if last point is really necessary but it worked for me after many hours of pain. What I did was:
Key is to install brew, ruby & everything in rosetta terminal. Command Then installation is normal:
After this step brew will tell you what exports you need. Copy paste them in terminal or therubyracer installation will fail.
Rest is easy.
|
Thanks @marko-avlijas. What is the result of this? Is this effectively installing homebrew and running everything over x86? What do you do for apps/packages that you actually want to install via homebrew but using |
Yes.
Without this I was getting errors like symbol not found in flat namespace when running rails server.
I have seen online that you can setup 2 brews, one for arm and other for x86_64, but that didn't work for me out of the box.
IMO it's not worth it to compile anything using arm if that means I am going to have problems.
|
@marko-avlijas Thanks for this extra information export LDFLAGS="-L/usr/local/something" These two flags are very IMPORTANT |
Yes it did. |
Make sure to replace something with your real path. Also read the error
message where gem said it was
|
Setup a new terminal running on rosetta 2 Here is how to: link
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install rbenv
(takes a while)
brew install [email protected] Brew tells you to do these export LDFLAGS="-L/usr/local/something" Last step: gem install libv8 -v '3.16.14.19' -- --with-system-v8 |
Results logged to
/Users/drew/.gem/extensions/universal-darwin-21/2.6.0/therubyracer-0.12.3/gem_make.out```
You have to read this.
|
Can confirm this worked for me (M1 Monterey 12.5.1 with ruby v 2.3.3) after days of troubleshooting. Other guides have mentioned to install things normally on arm64 and then install libv8 and therubyracer on i386 (rosetta terminal) but this caused problems. Installing everything solely on i386 works great. If you do a fresh install for i386, make sure you really clean out all of the old paths from the arm64 installations and use the new paths from the i386 install. You don't want to be mixing paths from different brew installs. |
@Drewberrysteph What is output of each of these commands?
|
After seeing so many people struggle with https://www.rubyonmac.dev/how-to-install-therubyracer-on-m1-m2-apple-silicon-mac |
Compiler didnt find v8. You didn't export correctly.
|
Thanks a lot. It work for me. |
Re 3.16.14.19: read this, move to mini_racer. @monfresh thanks for the article, I'm sure it helped people! That said you should not rely on v8 under Rosetta 2, v8 does wonky stuff with its JIT that trips it up on odd corner cases (not even counting that downgrading your whole stack to x86_64 is suboptimal and comes with its won set of complexities). We cannot stress enough moving to mini_racer + libv8-node, which supports Apple Silicon. Closing. |
I am using M1 Macbook Pro and wants to install therubyracer and libv8 for a rails webapp. But I am unable to do so because of the errors described below. There are several solutions available on the internet but none of them is working for me.
Operating System:
macOS Big Sur v11.1
.It would be very helpful if someone can help me with this.
Log:
The text was updated successfully, but these errors were encountered: