Because you said
And you also said
This makes me believe you are instaling Rails from the repositories. You're using Rails 2.x which is very old
but just so happens to be the current version in the Wheezy repos. You also say you installed gem. I don't know of any place you can possilby install Gems standalone anymore other than the Debian repos. This make me think you have two versions of Ruby running, one from the repos and one from source.
Now, I may be wrong and you may have meant you used gem to install rails
but you just again said:
I'm sure you know there is a huge difference between installing software from the repos and compiling it yourself. That's why it doesn't make sense when you say you followed the same procedure
because it's really quite different.
Ruby 2.0 and Rails 4.0 work great together, I was just using them on a Wheezy system a few minutes ago.
Anyway, moving on,
That's good. I'm assuming you are sure that whatever app server you're using to run the Rails app has the same PATH as your terminal.
Let's assume that's all good, let's look at this error:
/usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
So you've got the sqlite3 gem installed, looks like it's part of Ruby 2.0's gems, and looks like it's the version required by Rails 4. Great. But it's missing what appears to be a natively compiled part of the gem (to make it fast). When you ran bundle install, did you get any error messages? Usually you'll get an error message if you can't compile a native extension at that point. Usually that error will be because you didn't install the dev package (libsqlite3-dev). You said you have build-essential so you should be compiling fine. Did you have the libsqlite3-dev package installed before or after you ran bundle install? If it was after then you may not have been able to compile the native extension and that's why it's not there. Perhaps you tried to compile it, there was an error, you installed the dev package and tried again with success (no errors) but some other issue came up as a result.
Have you tried to just make a new Rails app in a different directory to see if something in yours might be corrupt?
Unlike whatever language you know, Ruby development (including gems) moves very fast and backwards compatability is often sacrificed for innovation. That's why we have special tools in this community to handle that speed by maintaining an environment. RVM and rbenv are those tools.
This is a problem that can be solved, the question is not technical, it's one of will. The bottom line is you have a problem you can't fix right now. And so you can choose to solve the problem the hard way: fixing something you don't understand, or the easy way: redoing it the Ruby way that works for so many other people, many whom do not have the skills you have. Hopefully I can help you or someone else can help you but if you take the attitude that you refuse the easy way and you're willing to walk away if the hard way doesn't work then I don't think anyone can really help you in the end.
But if you do decide on something else, Laravel is pretty hot this month, and it's even closer to Rails than Yii (RIP). But it's just another Rails clone (or maybe a Sinatra clone) and it will never be as good as the real thing. Good luck.
Hi, thanks for you long answer
So, maybe I didn't explain it properly:
1) I installed the libraries build-essential, sqlite3 and libsqlite3-dev from the Wheezy repo (apt-get install), before install anything else.
2) I installed Ruby from source code, compiling, make, make install.
3) I installed the gem as said on the official ruby on rails website (ruby setup.rb)
4) I installed rails gem by "gem install rails"
5) I installed sqlite3 gem by "gem install sqlite3"
I used the same steps to install rails 2.3 some months ago, in another computer, and that worked.
If i run "bundle install" I don't get any error, but this:
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Using atomic (1.1.13)
Using thread_safe (0.1.2)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.24)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.0)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using libv8 (220.127.116.11)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using ref (1.0.5)
Using sass (3.2.10)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using sqlite3 (1.3.7)
Using therubyracer (0.11.4)
Using turbolinks (1.3.0)
Using uglifier (2.1.2)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
I also create a new rails app in another location, but I get the same error.