0

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

Community
  • 1
  • 1
sudhan rao
  • 49
  • 8
  • Why can't you install those libraries? Do you not have `sudo` privileges? – zeantsoi Sep 11 '13 at 15:32
  • Edited my post. No I don't have the sudo provileges but I have the rvm installed. And I am not finding this gem "gem install libsqlite3-dev" – sudhan rao Sep 11 '13 at 15:40
  • If you can't run `apt-get` I'd suggest getting a server on which you can. There will be very little you can do about this otherwise. – Zach Kemp Sep 11 '13 at 15:47
  • Talk to the server admin and see if they are willing to install that package for you. Otherwise, extract the files from the package yourself, put them somewhere in your home folder, and point to the directory using the optional argument when you install the gem. – Teddy Sep 11 '13 at 16:02

1 Answers1

0

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.

tadman
  • 208,517
  • 23
  • 234
  • 262