Mini_racer installation issues on ubuntu vagrant (OSX)

@sam I’m consistenly getting this error when running bundle install after therubyracer was replaced with mini_racer.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.2 -r ./siteconf20160523-1400-1x811sw.rb extconf.rb
checking for main() in -lpthread... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling mini_racer_extension.cc
In file included from mini_racer_extension.cc:4:0:
/var/lib/gems/2.2.0/gems/libv8-5.0.71.48.3-x86-linux/vendor/v8/include/v8.h:341:1: error: expected unqualified-id before ‘using’
/var/lib/gems/2.2.0/gems/libv8-5.0.71.48.3-x86-linux/vendor/v8/include/v8.h:477:1: error: expected unqualified-id before ‘using’
/var/lib/gems/2.2.0/gems/libv8-5.0.71.48.3-x86-linux/vendor/v8/include/v8.h:871:1: error: expected unqualified-id before ‘using’
mini_racer_extension.cc:136:51: error: ‘Handle’ has not been declared
mini_racer_extension.cc:136:57: error: expected ‘,’ or ‘...’ before ‘<’ token
mini_racer_extension.cc: In function ‘VALUE convert_v8_to_ruby(v8::Isolate*, int)’:
mini_racer_extension.cc:140:9: error: ‘value’ was not declared in this scope
mini_racer_extension.cc:144:9: error: ‘value’ was not declared in this scope
mini_racer_extension.cc:148:9: error: ‘value’ was not declared in this scope
mini_racer_extension.cc:152:9: error: ‘value’ was not declared in this scope
mini_racer_extension.cc:156:9: error: ‘value’ was not declared in this scope
mini_racer_extension.cc:160:9: error: ‘value’ was not declared in this scope
mini_racer_extension.cc:165:55: error: cannot convert ‘v8::Local<v8::Value>’ to ‘int’ for argument ‘2’ to ‘VALUE convert_v8_to_ruby(v8::Isolate*, int)’
mini_racer_extension.cc:171:9: error: ‘value’ was not declared in this scope
mini_racer_extension.cc:175:9: error: ‘value’ was not declared in this scope
mini_racer_extension.cc:184:53: error: cannot convert ‘v8::Local<v8::Value>’ to ‘int’ for argument ‘2’ to ‘VALUE convert_v8_to_ruby(v8::Isolate*, int)’
mini_racer_extension.cc:186:57: error: cannot convert ‘v8::Local<v8::Value>’ to ‘int’ for argument ‘2’ to ‘VALUE convert_v8_to_ruby(v8::Isolate*, int)’
mini_racer_extension.cc:193:26: error: ‘value’ was not declared in this scope
mini_racer_extension.cc: At global scope:
mini_racer_extension.cc:197:8: error: ‘Handle’ does not name a type
mini_racer_extension.cc: In function ‘VALUE rb_context_eval_unsafe(VALUE, VALUE)’:
mini_racer_extension.cc:299:61: error: cannot convert ‘v8::Local<v8::Value>’ to ‘int’ for argument ‘2’ to ‘VALUE convert_v8_to_ruby(v8::Isolate*, int)’
mini_racer_extension.cc:306:63: error: cannot convert ‘v8::Local<v8::Value>’ to ‘int’ for argument ‘2’ to ‘VALUE convert_v8_to_ruby(v8::Isolate*, int)’
mini_racer_extension.cc:348:56: error: cannot convert ‘v8::Local<v8::Value>’ to ‘int’ for argument ‘2’ to ‘VALUE convert_v8_to_ruby(v8::Isolate*, int)’
mini_racer_extension.cc: In function ‘void* gvl_ruby_callback(void*)’:
mini_racer_extension.cc:396:2: error: ‘Handle’ was not declared in this scope
mini_racer_extension.cc:396:17: error: expected primary-expression before ‘>’ token
mini_racer_extension.cc:396:19: error: ‘external’ was not declared in this scope
mini_racer_extension.cc:396:45: error: expected primary-expression before ‘>’ token
mini_racer_extension.cc:396:46: error: ‘::Cast’ has not been declared
mini_racer_extension.cc:409:65: error: cannot convert ‘v8::Local<v8::Value>’ to ‘int’ for argument ‘2’ to ‘VALUE convert_v8_to_ruby(v8::Isolate*, int)’
mini_racer_extension.cc:430:2: error: ‘Handle’ was not declared in this scope
mini_racer_extension.cc:430:14: error: expected primary-expression before ‘>’ token
mini_racer_extension.cc:430:16: error: ‘v8_result’ was not declared in this scope
mini_racer_extension.cc:430:73: error: ‘convert_ruby_to_v8’ was not declared in this scope
make: *** [mini_racer_extension.o] Error 1

make failed, exit code 2

Gem files will remain installed in /tmp/bundler20160523-1400-1fbh6n7/mini_racer-0.1.3/gems/mini_racer-0.1.3 for inspection.
Results logged to /tmp/bundler20160523-1400-1fbh6n7/mini_racer-0.1.3/extensions/x86-linux/2.2.0/mini_racer-0.1.3/gem_make.out
An error occurred while installing mini_racer (0.1.3), and Bundler cannot continue.
Make sure that `gem install mini_racer -v '0.1.3'` succeeds before bundling.
3 Likes

Do you use homebrew? I would suggest the same trick for therubyracer:

It’s for native OS X environment without vagrant:

brew install v8
gem uninstall libv8
gem install libv8 -v '5.0.71.48.3' -- --with-system-v8
2 Likes

@fantasticfears Thanks for the suggestion, but uninstalling and re-installing libv8 hasn’t fixed it. Note that this is actually a virtual ubuntu environment.

2 Likes

Er, sorry, missed that. That could be a little tricky. Ubuntu doesn’t deliver a new v8. Some PPA offers 5.1 but it doesn’t match libv8 version. Compiler errors might be some flags or gcc version issues.

But libv8 has binary distributions. The command in below should help. x86_64-linux or x86-linux depends on ubuntu installation.
gem install libv8 -v '5.0.71.48.3' --platform=x86_64-linux

1 Like

Thanks.

Updating the virtual Ubuntu env from Precise to Trusty fixes the issue.

The discourse virtual box in s3 may need to be updated from Precise to Trusty. cp. updated travis config.

cc @sam

6 Likes

Oh my god , don’t get me started on vagrant, this may be the straw that breaks my back and gets me to delete it from the repo

Precise is ending its life early next year we are just about to ship xenial to all our customers, our developers get precise which is 8 releases behind

Which is why we should never ship dev environments we do not actively use

8 Likes

@angus how did you get it to work? I tried changing config.vm.box = 'discourse/discourse-1.3.0' to config.vm.box = 'ubuntu/trusty64' and removing config.vm.box_url, but then ran into authentication problems on vagrant up.

what’s the “preferred” method for developing Discourse on OSX?

When I develop on OSX I use rbenv Postgres app and brew based redis

2 Likes

I just ran do-release-upgrade in the virtual ubuntu environment. It takes you through the upgrade to Trusty.

6 Likes

What alternative to Vagrant would you suggest? i.e. instead of

Windows / GitHub / VirtualBox / Vagrant

I use vmware, virtualbox should do the trick or the built in virtualization.

2 Likes

Ok, stopped being the lazy I am and set up a properly development environment, without vagrant shenanigans, and my god it’s fast.

And it’s way easier than I anticipated.

4 Likes

On what OS? Did you follow one of our howto topics, did that work OK?

2 Likes

Just formated one of my disks, using Gnome Ubuntu 16.04.

After that it’s more or less following this.

Just:

  • changing ruby version (2.0.0-turbo → 2.3.1)
  • postgresql verison (9.3 → 9.5)
  • creating the databases with my user as owner
  • using a ppa for redis
  • and installing image_optim dependencies as described here so that pesky warnings disappear from running the specs.
5 Likes

Should we update that? Can you PR changes and I will add them?

3 Likes

Yes for sure! This is way better than vagrant!

4 Likes

I’m in the process of setting up a dev environment on a new system and ran across this thread after a problem with mini_racer - I’m using GNU/Linux.

While I agree with @Falco that developing natively is faster, I think the advantages of Vagrant are huge and should be preserved.

I’m in the process of making an image that uses Ubuntu 16.04 (based on 16.04 Server iso) and has a few steps fixed. I’ll submit it when done.

Also, I am modifying the Vagrantfile with the following:

The end result will be a fully functional discourse when the person first types vagrant up.

I’ll submit it as a PR when ready. I’ll upload the image to a public dropbox, though obviously it would be better if somebody from discourse uploaded it where the old image is.

7 Likes

You could also check Docker image file for provisioning right version as Vagrant is meant to uniform production & dev env :slight_smile:

Your not the only one that has had issues so welcome this :slight_smile:

Currently working my way through this one

1 Like