After upgrading Ubuntu to 13.04(Raring Ringtail), I started having problems with bundle install and starting server, main concern was libxml2.
I managed to solve the issue using 'rvm pkg' and 'build.config'. Finally I thought of writing those steps used. The entire steps of installing rvm, ruby, libraries with some notes about the issues with lixml2.
Libraries required:
Assuming that user has an UBUNTU machine.
Install below given libraries. ex: $sudo apt-get install curl. Multiple libraries can be installed separated by spaces. You can skip those libraries that are not required. Below given list has most of the common libraries required.
$sudo apt-get install curl build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
mysql-server mysql-client libmysqlclient-dev libxml2-dev libxslt-dev imagemagick
$ sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev(required for curb)
$ sudo apt-get install graphicsmagick-libmagick-dev-compat (required for RMagick, libmagick9-dev doesn not exists any more)
$ sudo apt-get install libmagickcore-dev libmagickwand-dev (If you get ' wand/MAgickWand.h missing' error)
Installing RVM(https://rvm.io/rvm/install)
$ \curl -L https://get.rvm.io | bash -s stable
Folow instructions if any. I had instructions to add "source ~./profile" in to '~/home/shilesh/.bash_profile'
# making sure that it is loaded for the current instance also
$source ~/.profile
Close out your current shell or terminal session and open a new one (preferred). You may load RVM with the following command:
user$ source ~/.rvm/scripts/rvm
If installation and configuration were successful, RVM should now load whenever you open a new shell. This can be tested by executing the following command which should output 'rvm is a function' as shown below.
user$ type rvm | head -n 1
rvm is a function
Installing ruby
$ rvm list known #This will show the available ruby options.$ rvm install 1.8.7 # This will install Ruby 1.8.7
$ rvm use 1.8.7
$ rvm --default 1.8.7 # makes 1.8.7 as default ruby version.
$ ruby -v # should give you something like ruby 1.8.7
Source code from Git or ?.
You are expected to have ssh keys in .ssh folder of your profile (ex: /home/shilesh/.ssh/id_rsa. And it should have 066 permissions).
$ git clone git@github.com:<project>/<name>.git
# using https will promt for user name and password for each pull and push.
$ git checkout <some_branch> # move to development branch, if not master.
# Edit the values in database.yml with your local mysql server details. If you do not have server ready, update yml file with a user name and password which you will give to the server.
Installing Gems using bundler
Install ruby gems from "http://rubygems.org/pages/download" and install.$gem -v # This might give you 2.0.6 or greater.
If you did not get the correct version to download, use
$ gem update --system 1.3.7 # This will update the gem to 1.3.7 version
$ gem install bundler # Installing Bundler gem
We are ready to install all the gems, this might take some time based on your gems.
$bundle install --local
Database
$ bundle exec rake db:create # This will create database for development
$bundle exec rake db:migrate # Creates schema
$bundle exec rake db:seed # Load default values.
Server
$ bundle exec script/server # Your server should be up now on 3000 port.
Errors:
Failed undefined method "source index for module"
$ gem update --system
# gem install rubygems-update -v 1.3.7
There were cases where installing libxml-ruby fails as,
Installing libxml-ruby (1.1.3)Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/shilesh/.rvm/rubies/ruby-1.8.7-p374/bin/ruby extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... yes
checking for atan() in -lm... no
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -llibiconv... no
checking for iconv_open() in -llibiconv... no
checking for iconv_open() in -lc... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /home/shilesh/.rvm/rubies/ruby-1.8.7-p374/include,/home/shilesh/.rvm/rubies/ruby-1.8.7-p374/include/libxml2,/opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... yes
creating extconf.h
creating Makefile
And then, even after bundler successfully installed all gems, server might fail as,
$ bundle exec script/server=> Booting WEBrick
=> Rails 2.3.17 application starting on http://0.0.0.0:3000
/home/shilesh/.rvm/gems/ruby-1.8.7-p374@izone-1.8.7/gems/nokogiri-1.5.6/lib/nokogiri/nokogiri.so: /usr/lib/i386-linux-gnu/libxslt.so.1: symbol xmlBufUse, version LIBXML2_2.9.0 not defined in file libxml2.so.2 with link time reference - /home/shilesh/.rvm/gems/ruby-1.8.7-p374@izone-1.8.7/gems/nokogiri-1.5.6/lib/nokogiri/nokogiri.so (LoadError)
from /home/shilesh/.rvm/gems/ruby-1.8.7-p374@izone-1.8.7/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
In that case, try to specify the library after getting them with in rvm.
$ rvm pkg install libxml2 --verify-downloads 1
$ bundle config build.libxml-ruby --with-xml2-lib=${HOME}/.rvm/usr/lib --with-xml2-include=${HOME}/.rvm/usr/include/libxml2
$ bundle config build.nokogiri --with-xml2-lib=${HOME}/.rvm/usr/lib --with-xml2-include=${HOME}/.rvm/usr/include/libxml2
Then it is better to re-install all the gems using bundler. I deleted my gemset and created this again. After that installed bundler gem. Did the configurations as mentioned above, then ran bundler.
Everything was working fine then.
Installing libxml-ruby (1.1.3)
ReplyDeleteGem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/shilesh/.rvm/rubies/ruby-1.8.7-p374/bin/ruby extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... yes
checking for atan() in -lm... no
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -llibiconv... no
checking for iconv_open() in -llibiconv... no
checking for iconv_open() in -lc... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /home/shilesh/.rvm/rubies/ruby-1.8.7-p374/include,/home/shilesh/.rvm/rubies/ruby-1.8.7-p374/include/libxml2,/opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... yes
creating extconf.h
creating Makefile
--
$ bundle exec script/server
=> Booting WEBrick
=> Rails 2.3.17 application starting on http://0.0.0.0:3000
/home/shilesh/.rvm/gems/ruby-1.8.7-p374@izone-1.8.7/gems/nokogiri-1.5.6/lib/nokogiri/nokogiri.so: /usr/lib/i386-linux-gnu/libxslt.so.1: symbol xmlBufUse, version LIBXML2_2.9.0 not defined in file libxml2.so.2 with link time reference - /home/shilesh/.rvm/gems/ruby-1.8.7-p374@izone-1.8.7/gems/nokogiri-1.5.6/lib/nokogiri/nokogiri.so (LoadError)
from /home/shilesh/.rvm/gems/ruby-1.8.7-p374@izone-1.8.7/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
update your bundle as
rvm pkg install libxml2 --verify-downloads 1
bundle config build.libxml-ruby --with-xml2-lib=${HOME}/.rvm/usr/lib --with-xml2-include=${HOME}/.rvm/usr/include/libxml2
shilesh@shilesh-ubuntu:~/projects/rev$ bundle config build.nokogiri --with-xml2-lib=${HOME}/.rvm/usr/lib --with-xml2-include=${HOME}/.rvm/usr/include/libxml2
Then bundle install again
Gr8 post, I often refer it.
ReplyDeleteTry this command and then install mysql2 gem **sudo apt-get install libmysql-ruby libmysqlclient-dev**
ReplyDeleteFor windows, check for the solution in the following link
http://teknosrc.com/ruby-on-rails-error-installing-mysql2-failed-to-build-gem-native-extension-ubuntu-linux/
INTERNATIONAL CONCEPT OF WORK FROM HOME
ReplyDeleteWork from home theory is fast gaining popularity because of the freedom and flexibility that comes with it. Since one is not bound by fixed working hours, they can schedule their work at the time when they feel most productive and convenient to them. Women & Men benefit a lot from this concept of work since they can balance their home and work perfectly. People mostly find that in this situation, their productivity is higher and stress levels lower. Those who like isolation and a tranquil work environment also tend to prefer this way of working. Today, with the kind of communication networks available, millions of people worldwide are considering this option.
Women & Men who want to be independent but cannot afford to leave their responsibilities at home aside will benefit a lot from this concept of work. It makes it easier to maintain a healthy balance between home and work. The family doesn't get neglected and you can get your work done too. You can thus effectively juggle home responsibilities with your career. Working from home is definitely a viable option but it also needs a lot of hard work and discipline. You have to make a time schedule for yourself and stick to it. There will be a time frame of course for any job you take up and you have to fulfill that project within that time frame.
There are many things that can be done working from home. A few of them is listed below that will give you a general idea about the benefits of this concept.
Baby-sitting
This is the most common and highly preferred job that Women & Men like doing. Since in today's competitive world both the parents have to work they need a secure place to leave behind their children who will take care of them and parents can also relax without being worried all the time. In this job you don't require any degree or qualifications. You only have to know how to take care of children. Parents are happy to pay handsome salary and you can also earn a lot without putting too much of an effort.
Nursery
For those who have a garden or an open space at your disposal and are also interested in gardening can go for this method of earning money. If given proper time and efforts nursery business can flourish very well and you will earn handsomely. But just as all jobs establishing it will be a bit difficult but the end results are outstanding.
Freelance
Freelance can be in different wings. Either you can be a freelance reporter or a freelance photographer. You can also do designing or be in the advertising field doing project on your own. Being independent and working independently will depend on your field of work and the availability of its worth in the market. If you like doing jewellery designing you can do that at home totally independently. You can also work on freelancing as a marketing executive working from home. Wanna know more, email us on workfromhome.otr214423@gmail.com and we will send you information on how you can actually work as a marketing freelancer.
Internet related work
This is a very vast field and here sky is the limit. All you need is a computer and Internet facility. Whatever field you are into work at home is perfect match in the software field. You can match your time according to your convenience and complete whatever projects you get. To learn more about how to work from home, contact us today on workfromhome.otr214423@gmail.comand our team will get you started on some excellent work from home projects.
Diet food
Since now a days Women & Men are more conscious of the food that they eat hence they prefer to have homemade low cal food and if you can start supplying low cal food to various offices then it will be a very good source of income and not too much of efforts. You can hire a few ladies who will help you out and this can be a good business.
Thus think over this concept and go ahead.
awesome post presented by you..your writing style is fabulous and keep update with your blogs Ruby on Rails Online Training India
ReplyDeleteAppreciating the persistence you put into your blog and detailed information you provide.
ReplyDeleteDevops Course Training in Chennai |Best Devops Training Institute in Chennai
Selenium Course Training in Chennai |Best Selenium Training Institute in Chennai
Java Course Training in Chennai | Best Java Training Institute in Chennai
mmorpg
ReplyDeleteİNSTAGRAM TAKİPCİ SATİN AL
TİKTOK JETON HİLESİ
tiktok jeton hilesi
antalya saç ekimi
referans kimliği nedir
instagram takipçi satın al
mt2 pvp serverler
Takipci satın al
SMM PANEL
ReplyDeleteSmm Panel
is ilanlari
instagram takipçi satın al
hirdavatci burada
Beyazesyateknikservisi.com.tr
Servis
Jeton hilesi