I have a remote linux server, it does not have internet and its behind firewall. Its does not have gcc compiler. So I cant install or compile .
The linux server has got the rvm installed with ruby 1.9.3
Usually , I would install the gem on my local Mac OSX and then copy the gems to the linux server i.e ( xxxx.gem file from cache directory and xxx folder from gem directory of the ruby). So far it has been working fine. As part of the new test, I installed sqlite3 gem and copied its .gem file to the linux server and did a gem install sqlite on the linux server. It did work and got the below error
gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
checking for sqlite3.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
from extconf.rb:34:in `<main>'
Gem files will remain installed in /ngs/app/athenat/.rvm/gems/ruby-1.9.3-p374#11.4.0-1/gems/sqlite3-1.3.8 for inspection.
Results logged to /ngs/app/athenat/.rvm/gems/ruby-1.9.3-p374#11.4.0-1/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out
I googled and saw many have suggested to install apt-get install libsqlite3-dev. I can't do this on my remote linux server.
Can anyone please suggest how to resolve this.
I followed few of the suggestion posted in the below post but it did not work.
Problem installing sqlite3-ruby!
sqlite3 gem fails to install
Not having a compiler is going to make this sort of thing nearly impossible.
You can't just compile for OS X and sling those binaries over to Linux. They're not the same format.
You may be able to create an environment compatible with your Linux target using a virtual environment in VMWare Fusion or VirtualBox, such as when using Vagrant, to compile for your target OS and architecture and them ship those binaries over. This is usually a last resort, as you will have to link against exactly the same libraries you have available on the remote system. To do this correctly could take a lot of time.
Related
Use root user installed rubygems.
# yum install rubygems -y
When check ruby's version, got
# ruby -v
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
Gem's version:
# gem -v
2.7.6.3
When install a gem, got
# gem install fluent-plugin-kinesis
Building native extensions. This could take a while...
ERROR: Error installing fluent-plugin-kinesis:
ERROR: Failed to build gem native extension.
current directory: /usr/local/share/gems/gems/msgpack-1.4.2/ext/msgpack
/usr/bin/ruby -r ./siteconf20210825-20925-17fyw57.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /usr/local/share/gems/gems/msgpack-1.4.2 for inspection.
Results logged to /usr/local/lib64/gems/ruby/msgpack-1.4.2/gem_make.out
Should I install a high version ruby? It's the default one on the system.
update
I installed ruby-devel
# yum install ruby-devel.x86_64
Run install fluent-plugin-kinesis gem again
# gem install fluent-plugin-kinesis
Building native extensions. This could take a while...
ERROR: Error installing fluent-plugin-kinesis:
ERROR: Failed to build gem native extension.
current directory: /usr/local/share/gems/gems/msgpack-1.4.2/ext/msgpack
/usr/bin/ruby -r ./siteconf20210826-11878-18i9eps.rb extconf.rb
checking for ruby/st.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:590:in `try_cpp'
from /usr/share/ruby/mkmf.rb:1098:in `block in have_header'
from /usr/share/ruby/mkmf.rb:948:in `block in checking_for'
from /usr/share/ruby/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/share/ruby/mkmf.rb:320:in `open'
from /usr/share/ruby/mkmf.rb:350:in `block in postpone'
from /usr/share/ruby/mkmf.rb:320:in `open'
from /usr/share/ruby/mkmf.rb:346:in `postpone'
from /usr/share/ruby/mkmf.rb:947:in `checking_for'
from /usr/share/ruby/mkmf.rb:1097:in `have_header'
from extconf.rb:3:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib64/gems/ruby/msgpack-1.4.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/share/gems/gems/msgpack-1.4.2 for inspection.
Results logged to /usr/local/lib64/gems/ruby/msgpack-1.4.2/gem_make.out
For other gems works well.
Take a look at the docs or this answer.
Install Ruby >= 2.4 on your local environment. In addition, install ruby-dev package via Package Manager to build native extension gems.
I believe in CentOS ruby-dev equivalent is ruby-devel. You can confirm it by running yum search ruby-dev
You'll find 2 packages, one i686 and another x86_64. You can find which one you need by running lscpu | grep Arch.
Then simply download the package, and rerun gem install
Ruby version 2.2.4p230
RubyGem version 2.7.2
Ruby-devel and lib64ffi-devel installed.
64-bit OpenMandriva 3.0, urpmi and rpmdrake used.
Goal: to install compass, but the gem ffi is needed first.
I have scoured the internet so hard for the last two days and I'm so stumped... It's impossible for me to install an earlier version of ruby because of the dependency for an older ncurses. I feel like replacing ncurses would open a can of nasty worms.
However... I am also completely open to a compass alternative, where the config.rb project files could be somehow ported / copied so both compass and this other sass compiler could operate. (this is for work and we're not changing the sass builder any time soon).
/usr/share/gems/gems/ffi-1.9.18/ext/ffi_c totally exists, there is an ffi.c file in that directory but can't find any ffi.h file in the vicinity. In a moment of desperation I touched ffi.h in that dir and when I ran gem install it removed it. ;) I would try taking a copy of someone else's libs to see if that works.
Basically any way to get this working without breaking the rest of my packages. I don't use ruby for anything else, just compass.
Here is the output:
# sudo gem install ffi
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
current directory: /usr/share/gems/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby -r ./siteconf20171110-17988-1lodsok.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib64
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:587:in `try_cpp'
from /usr/share/ruby/mkmf.rb:1060:in `block in have_header'
from /usr/share/ruby/mkmf.rb:911:in `block in checking_for'
from /usr/share/ruby/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/share/ruby/mkmf.rb:321:in `open'
from /usr/share/ruby/mkmf.rb:351:in `block in postpone'
from /usr/share/ruby/mkmf.rb:321:in `open'
from /usr/share/ruby/mkmf.rb:347:in `postpone'
from /usr/share/ruby/mkmf.rb:910:in `checking_for'
from /usr/share/ruby/mkmf.rb:1059:in `have_header'
from extconf.rb:16:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/lib64/gems/ruby/ffi-1.9.18/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/share/gems/gems/ffi-1.9.18 for inspection.
Results logged to /usr/lib64/gems/ruby/ffi-1.9.18/gem_make.out
Any help appreciated!
Your error message shows:
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
And that's how you can solve it:
xcode-select --install
(but make sure beforehand that xcode-select -p is returning the path to a stable Xcode version, like Xcode 10)
See also https://github.com/ffi/ffi/issues/647.
I'm having some trouble installing jekyll. Can't quite figure out how to patch the missing link.
Heres the full post:
root#cherob:~# gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby2.1
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /usr/lib/ruby/2.1.0/mkmf.rb:1067:in `block in have_header'
from /usr/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /usr/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /usr/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /usr/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /usr/lib/ruby/2.1.0/mkmf.rb:1066:in `have_header'
from extconf.rb:16:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/ffi-1.9.18 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0
/ffi-1.9.18/gem_make.outstrong text
Ruby is installed:
root#cherob:~# ruby -v
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
Debain 8 is installed
-
Apache2 is installed:
root#cherob:~# apache2 -v
Server version: Apache/2.4.10 (Debian)
Server built: Sep 20 2017 04:37:43
If you have an idea I would be glad if you forward me it.
Other thanks already times in advance
Robin
Such error usually means that you don't have build tools installed.
As far as I understood you are using linux, so you can run something like
apt-get install build-essential
This command is for deb-bases distros. So you can use something similar if you use a different distro.
I had the same error while installing. You will have to install des Ruby dev packacke:
sudo apt-get install ruby2.4-dev
This will install the developement package for 2.4. You should install 2.1 as you are using this version. I had the problem, that the package could not be found in the repositories. So I used the following PPA:
$ sudo apt-add-repository ppa:brightbox/ruby-ng
$ sudo apt-get update
https://launchpad.net/~brightbox/+archive/ubuntu/ruby-ng
Version 2.1 is also available in this repository.
I searched for this issue and kept finding resources related to a PC.
Every time I try to install EventMachine I get this error:
Building native extensions. This
could take a while... ERROR: Error
installing eventmachine: ERROR:
Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for rb_trap_immediate in
ruby.h,rubysig.h... *** extconf.rb
failed *** Could not create Makefile
due to some reason, probably lack of
necessary libraries and/or headers.
Check the mkmf.log file for more
details. You may need configuration
options.
Provided configuration options:
--with-opt-dir --without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog --without-make-prog
--srcdir=. --curdir
--ruby=/usr/local/bin/ruby
/usr/local/lib/ruby/1.9.1/mkmf.rb:368:in
`try_do': The complier failed to
generate an executable file.
(RuntimeError) You have to install
development tools first. from
/usr/local/lib/ruby/1.9.1/mkmf.rb:446:in
`try_compile' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:568:in
`try_var' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:816:in
`block in have_var' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:693:in
`block in checking_for' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:280:in
`block (2 levels) in postpone' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:254:in
`open' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:280:in
`block in postpone' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:254:in
`open' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:276:in
`postpone' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:692:in
`checking_for' from
/usr/local/lib/ruby/1.9.1/mkmf.rb:815:in
`have_var' from extconf.rb:16:in
`<main>'
Gem files will remain installed in
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10
for inspection. Results logged to
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.out
It seems to break while building C extensions. I've tried various solutions like "Mac OS X Leopard installing the ruby gem eventmachine" but had no luck.
You will need to have XCode 3.2 or 4 installed in order for extensions like this to compile. The XCode package is an optional install and comes on either the main install DVD for a retail package of the OS or as a supplemental disc with a new system.
You can download it from the App Store for 10.7 or later.
Your problem might be because you haven't installed the Developer Tools for Xcode 4.2/4.3.
With Xcode 4.2.x and 4.3.x, you need to install the command-line tools separately by:
Launching Xcode, then opening the "Preferences" menu from the "Xcode" menu on the menu bar.
Select the "Downloads" tab (icon).
Click the "Install" button for "Command Line Tools".
If correctly installed, then running cc --version should output:
% cc --version
Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
Or if you are using Ruby 1.9.3, there are known issues with EventMachine. See http://isitruby19.com/eventmachine. I suggest you downgrade to 1.9.2 for projects needing EventMachine using RVM or rbenv.
The solution here worked for me. I just had to install command line tools from https://developer.apple.com/downloads/index.action
See "getting eventmachine gem to compile on OSX Lion 10.8.2 with xcode 4.5.1" for more information.
I had the same problem. Opening up the mkmf.log file and running the command narrowed down the problem to the gmp library. The gmp library was in a different directory and LD_LIBRARY_PATH was not set.
I set LD_LIBRARY_PATH to the location gmp was in and then it installed properly.
I am trying to install hpricot using the command:
>gem install hpricot -v 0.8.2
Building native extensions. This could take a while...
ERROR: Error installing hpricot:
ERROR: Failed to build gem native extension.
C:/Ruby19/bin/ruby.exe extconf.rb
checking for stdio.h... * extconf.rb failed *
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby19/bin/ruby
C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:362:in try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:431:intry_cpp'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:809:in block in have_header'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:668:inblock in checking_for'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:274:in block (2 levels) in postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:248:inopen'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:274:in block in postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:248:inopen'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:270:in postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:667:inchecking_for'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:808:in have_header'
from extconf.rb:2:in'
Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2/ext/fast_xs/gem_make.out
it mentions I need to install "development tools" but I have no idea what that refers to. Any suggestions?
Try:
gem install hpricot --platform=mswin32
Install the devkit at rubyinstaller.org/downloads
Execute below command and it works:
gem install hpricot --platform=mswin32
An additional note that others may find useful, from my recent attempt to install on Windows using the Ruby devkit:
To install the devkit, you extract the bin and devkit directories to your Ruby directory which will place a few files in your Ruby bin and a devkit directory in your Ruby directory. Then, per the instructions, you set the proper location for mingw in the fstab file.
In my case, some gems, namely Hpricot and Ruby-Debug19, would not install on my system even with the devkit installed properly because of an error creating the makefile. I ended up installing the latest version of mingw separately from SourceForge, then changed the fstab file within the "ruby19/devkit/msys/1.0.11/etc" directory to point to the directory where I installed mingw. Both gems then installed correctly.
Execute the following command:
gem install hpricot