I don't like the hackneyed "My First Blog Post!!!" cheesy stuff. I jump right into the projects I'm working on, problems I run into, and my solutions.
So I've still been configuring my Arch Linux machine for development, specifically Ruby on Rails as of recent. Rails 4.0 defaults to sqlite3, which is in the official repositories.
If you’re familiar with Rails you know that it is intrinsically simple to get a running web application. In my opinion no other framework does more work for you.
For those of you that don’t know:
That's it; start a server with rails s and you have your working "Hello Rails" web app.
When I went to start the server I would get the error message:
require: no such file to load -- sqlite3/sqlite3_native (LoadError)
Ok, well this error is no stranger to anyone who is even a little familiar with Ruby. Again, if you're not this description is straight from Ruby's documentation
Raised when a file required (a Ruby script, extension library, ...) fails to load.
But wait I started fresh. I should have all the required gems because Rails does all that work for me. This leads us to believe that there are issues with the actual gem.
Let's travel to where the sqlite3 gem is and dig around a little. The directory is in the error message if you don't know where your gems are installed. Looking at lib/sqlite3 we see:
# support multiple ruby version (fat binaries under windows)
RUBY_VERSION =~ /(\d+\.\d+)/
Here's our issue. The paths in those require statements in the block are not correct. sqlite3_native is not in those locations.
So just change those paths and we should be good to go. Let's find where the actual sqlite3_native files are.
find ~/ -name sqlite3_native*
Now just change those paths in the require and leave off the .so extention. Similarly, you could copy the sqlite3_native.so files to the specified directories.
Problems may arise when we update this gem, however. This fix may not be as permanent as previously thought. If you have found something better, feel free to leave a comment.