Install mini_racer gem on kali linux

AI-generated summary

The user Alavi1412 is unable to install the mini_racer gem on Kali Linux due to a missing libplatform/libplatform.h header file, which is required for building the native extension. The error occurs during both bundle install and direct gem install attempts. mpalmer suggests that the nodejs-dev package should provide the missing header, but Alavi1412 confirms they have it, though mpalmer suspects the version may be outdated or incorrectly installed. sam suggests trying gem install libv8, but this fails. Alavi1412 asks about manually adding the missing file, but mpalmer warns this won’t solve the underlying linking issue. The consensus is that this is a system-specific packaging problem with Kali Linux, not a Discourse issue, and further support may be needed from Kali Linux channels.

When I ran the bundle install I got the following error:

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

current directory:
/tmp/bundler20170628-4322-ghx9vzmini_racer-0.1.9/gems/mini_racer-0.1.9/ext/mini_racer_extension
/usr/bin/ruby2.3 -r ./siteconf20170628-4322-1czxn7a.rb extconf.rb
checking for main() in -lpthread... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/tmp/bundler20170628-4322-ghx9vzmini_racer-0.1.9/extensions/x86_64-linux/2.3.0/mini_racer-0.1.9/mkmf.log

current directory:
/tmp/bundler20170628-4322-ghx9vzmini_racer-0.1.9/gems/mini_racer-0.1.9/ext/mini_racer_extension
make "DESTDIR=" clean

current directory:
/tmp/bundler20170628-4322-ghx9vzmini_racer-0.1.9/gems/mini_racer-0.1.9/ext/mini_racer_extension
make "DESTDIR="
compiling mini_racer_extension.cc
mini_racer_extension.cc:5:37: fatal error: libplatform/libplatform.h: No such
file or directory
 #include <libplatform/libplatform.h>
                                     ^
compilation terminated.
Makefile:207: recipe for target 'mini_racer_extension.o' failed
make: *** [mini_racer_extension.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/tmp/bundler20170628-4322-ghx9vzmini_racer-0.1.9/gems/mini_racer-0.1.9 for
inspection.
Results logged to
/tmp/bundler20170628-4322-ghx9vzmini_racer-0.1.9/extensions/x86_64-linux/2.3.0/mini_racer-0.1.9/gem_make.out

An error occurred while installing mini_racer (0.1.9), and Bundler
cannot continue.
Make sure that `gem install mini_racer -v '0.1.9'` succeeds before bundling.

and when I use gem install mini_racer -v '0.1.9' to install the gem I got the following error:

Building native extensions.  This could take a while...
ERROR:  Error installing mini_racer:
	ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/mini_racer-0.1.9/ext/mini_racer_extension
/usr/bin/ruby2.3 -r ./siteconf20170628-4511-1jlgunl.rb extconf.rb
checking for main() in -lpthread... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mini_racer-0.1.9/mkmf.log

current directory: /var/lib/gems/2.3.0/gems/mini_racer-0.1.9/ext/mini_racer_extension
make "DESTDIR=" clean

current directory: /var/lib/gems/2.3.0/gems/mini_racer-0.1.9/ext/mini_racer_extension
make "DESTDIR="
compiling mini_racer_extension.cc
mini_racer_extension.cc:5:37: fatal error: libplatform/libplatform.h: No such file or directory
 #include <libplatform/libplatform.h>
                                     ^
compilation terminated.
Makefile:207: recipe for target 'mini_racer_extension.o' failed
make: *** [mini_racer_extension.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.3.0/gems/mini_racer-0.1.9 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mini_racer-0.1.9/gem_make.out

and this is the mkmf.log file.
how should I solve this probelm?
can I download this gem manually to avoid this error?

You need to install whatever provides libplatform/libplatform.h. Given that Kali is Debian-derived, apparently, that’s probably nodejs-dev.

I have that.
and I upgrade this by sudo apt-get upgrade nodejs-dev but the problem still exist.

Well, no, you don’t, because if you did, the compiler wouldn’t be complaining about

fatal error: libplatform/libplatform.h: No such file or directory

That’s not how you upgrade a single package.

Perhaps Kali doesn’t ship with a new enough version of nodejs-dev; if so, you’ll need to raise that on a Kali Linux-related support channel to obtain guidance on how to resolve that issue.

Hmmm is this a 32 bit kali linux or a 64 bit one?

Regardless try gem install libv8 if that does not work, raise an issue :arrow_forward: GitHub - rubyjs/libv8: Ruby gem binary distribution of the V8 JavaScript engine · GitHub

64bit kali.

no it doesn’t work

Is there any way to add ibplatform/libplatform.h to my system manually to avoid this error?

That’ll only get you past that specific error; the linker will then fail because it’s almost certain the library isn’t installed, either. This is not a Discourse-specific problem, it’s an issue with your distro.

This resolved the issue for me in another distro.