I have this test code :
require 'mkmf'
puts have_header("iostream.h")
this code throws an error in Jruby like this :
checking for iostream.h... RuntimeError: The compiler failed to generate an executable file. You have to install development tools first.
try_do at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:456 try_cpp at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:587
block in have_header at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:1091
block in checking_for at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:942 block in postpone at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:350 open at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:320 block in postpone at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:350 open at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:320 postpone at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:346 checking_for at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:941 have_header at /home/abd/.rvm/rubies/jruby-9.1.6.0/lib/ruby/stdlib/mkmf.rb:1090 at test.rb:3
I have no idea what does it mean by development tools and I searched the internet without finding anything about this.
I installed Jruby 9.1.6.0 through rvm, this is my java version :
[abd@abd testruby]$ java -version
openjdk version "1.8.0_112"
OpenJDK Runtime Environment (build 1.8.0_112-b15)
OpenJDK 64-Bit Server VM (build 25.112-b15, mixed mode)
I'm using Arch linux here.
The real reason behind my question is that I tried installing gmp gem and native extensions wouldn't build because of the same error, I know the gem is unmaintained but I want to resolve this issue anyway because the above message suggests that my installation is lacking.
By the way I have the jdk, not just the jre.
JRuby C extensions have been deprecated [and possibly removed already but I'm a bit out of the loop].
Since you're running on the JVM, have you considered the alternatives? i.e. either use Java's
BigInteger
orBigDecimal
if the performance is adequate for your needs, or wrap GMP using JNI / JNA- it looks like somebody has tried already. Check out this SO question for a few more Java alternatives.