Sqlite3 gem for Rails 3.1
Make sure you have the development headers for SQLite3 installed.
For example:
On Ubuntu, you can use apt-get install libsqlite3-dev
On Mac with homebrew installed: brew install sqlite
.
Rails 3.1 app can't install sqlite3 gem because libraries are out of date
You could compile a static library of the version of sqlite you require. Then install the sqlite3 gem with a reference to your new static library.
While I haven't tested this procedure, I could see the process being...
1. Download and extract the SQLite source in a new directory.
mkdir $HOME/sqlite3.7.7.1
cd $HOME/sqlite3.7.7.1
wget http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz
tar -zxvf sqlite-autoconf-3070701.tar.gz
cd sqlite-autoconf-3070701
2. Configure, compile, and install.
./configure --disable-shared --enable-static --prefix=$HOME/sqlite3.7.7.1
make && make install
3.A. (option1) Install the SQLite gem with a reference to your new static lib.
gem install sqlite3 --with-sqlite3-dir=$HOME/sqlite3.7.7.1
3.B. (option2) Install via bundler. *Assuming sqlite3 has already been added to the Gemfile (thanks to Lester)
bundle config build.sqlite3 \
--with-sqlite3-include=$HOME/sqlite3.7.7.1/include \
--with-sqlite3-lib=$HOME/sqlite3.7.7.1/lib \
--with-sqlite3-dir=$HOME/sqlite3.7.7.1/bin
bundle install
rails 3.1 'Symbol not found: _sqlite3_open_v2' sqlite3
Probably this is your solution. https://stackoverflow.com/a/8943110/153886
Having difficulties to add sqlite3 into gemfile
Got it working by updating gemfile.lock
Changed sqlite3 (1.4.0)
to sqlite3 (1.3.13)
.
Update:
Don't forget to specify your gem version in gemfile
.
Example: gem 'sqlite3', '~> 1.3.13'
, otherwise bundle update
command will return an error.
Related Topics
If 'Self' Is Always the Implied Receiver in Ruby, Why Doesn't 'Self.Puts' Work
How to Compare Private Attributes in Ruby
Single Quote String String Interpolation
Ruby on Rails Global Activerecord::Enum
Testing Rake Tasks with Rspec Is Not Accepting Arguments
How to Create All Possible Combinations with Two Arrays
Array#Rotate Equivalent in Ruby 1.8.7
Sending Array of Values to a SQL Query in Ruby
Callback for Active Storage File Upload
How to Assign a Has_Many/Belongs_To Relation Properly in Rails Activerecord
Rails - X-Sendfile + Temporary Files
Match Regex with Numeric Value and Decimal
Floating Point Precision in Ruby on Rails Model Validations
Ruby on Rails: Radio Buttons for Collection Select
Could Not Find Gem 'Logstash-Devutils (>= 0) Ruby' in Any of the Gem Sources
Triple Single Quote VS Triple Double Quote in Ruby
How to Call Methods Defined in Applicationcontroller in Models