debase gem is exploading in my face on install - ruby-on-rails

So I'm trying to install debase in my gemfile and explosions are happening. Here's what the output looks like...
(Ok so there was a bunch of stuff here that I removed cause it got fixed. Now I have only this remaining error)
UPDATE 2:
...installing ruby-debug19 helped to install vm_core.h (thank you to Alter Lagos for recommending that). Now I have a new error message...
Fetching debase 0.2.1
Installing debase 0.2.1 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/fonso/.rbenv/versions/1.9.3-p551/bin/ruby extconf.rb
checking for vm_core.h... yes
creating Makefile
make
compiling breakpoint.c
In file included from breakpoint.c:1:0:
./debase_internals.h:5:24: fatal error: ruby/debug.h: No such file or directory
compilation terminated.
make: *** [breakpoint.o] Error 1
Gem files will remain installed in /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/debase-0.2.1 for inspection.
Results logged to /home/fonso/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/debase-0.2.1/ext/gem_make.out
An error occurred while installing debase (0.2.1), and Bundler cannot continue.
Make sure that `gem install debase -v '0.2.1' --source 'http://rubygems.org/'` succeeds before bundling.
In Gemfile:
debase
Anyone know how to solve this mystery?

"Failed to build gem native extension" means your computer had to compile a C extension to install the gem. This is actually common. Many gems like pg include C extensions. It's also common for people to encounter this error message. It just means your operating system lacks a certain package that would provide the C files needed to compile the extension.
The errors can be tricky to solve though because it's not a matter of changing what you're doing. You're installing the gem just fine. It's your environment that needs to be changed. You need to know which packages to install for your operating system for that version of the Gem.
Many tutorials include lists of packages you should install. For example, https://gorails.com/setup/ubuntu/18.04 tells you that, if you're installing the latest version of Ruby right now (3.0.1), you install: git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
These instructions are meant for Ubuntu 18.04. It would be different if you were using a different version of Ubuntu or a different operating system like MacOS. Also, your question shows you using a very old version of Ruby, 1.9.3. If you must use this old version, this could make this even harder for you, because there's no guarantee you'll find system packages that would work with the C extension that version of that gem wants to compile. I'd suggest using a recent version of Ruby if you can.

Annnnnd the answer is...For old apps using ruby 1.9.x use
gem 'ruby-debug-base19x', '~> 0.11.32'
instead of
gem debase
in your Gemfile per the readme for ruby-debug-ide https://github.com/ruby-debug/ruby-debug-ide
Now the gems install fine.
rdebug-ide command is not working tho', I've posted that question here... ruby-debu-ide command exploading in my face

Related

gem "mysql2" instalation errors

I have hard time to configure a dev environement for rails getting some errors
I have install ruby & rails with this tutorial https://parsun.com/2017/09/23/how-to-install-ruby-on-rails-on-raspberry-pi-3/
but i have some error when i launch a project
An error occurred while installing mysql2 (0.5.2), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds before bundling.
i have tried to launch :
gem install mysql2
but i get that ...
https://pastebin.com/8CxsVzMQ
You need to install mysql first, the log contains
mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.
The documentation page of the mysql2 gem contains:
This gem links against MySQL's libmysqlclient library or Connector/C library, and compatible alternatives such as MariaDB. You may need to install a package such as libmysqlclient-dev, mysql-devel, or other appropriate package for your system. See below for system-specific instructions.
By default, the mysql2 gem will try to find a copy of MySQL in this order:
* Option --with-mysql-dir, if provided (see below).
* Option --with-mysql-config, if provided (see below).
* Several typical paths for mysql_config (default for the majority of users).
* The directory /usr/local.
Try to install mysql or the mentioned libs and try again to install the gem.
The messages do not seem to reflect reality, try this instead of the mentioned package:
sudo apt-get install default-libmysqlclient-dev
Then, your next error clearly shows what is wrong
/home/pi/.rvm/gems/ruby-2.6.3/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
The GH page says:
ExecJS lets you run JavaScript code from Ruby. It automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Ruby object.
Install one of the javascript runtimes, listed here in the readme, e.g. nodejs (https://nodejs.org/en/download/), therubyracer, etc.

An error occurred while installing ruby-opencv (0.0.14)

I'm facing gem ruby-opencv installation issue
Gem files will remain installed in /home/k2/.rvm/gems/ruby-2.1.2#rails4/gems/ruby-opencv-0.0.14 for inspection.Results logged to /home/k2/.rvm/gems/ruby-2.1.2#rails4/extensions/x86_64-linux/2.1.0/ruby-opencv-0.0.14/gem_make.out
An error occurred while installing ruby-opencv (0.0.14), and Bundler cannot continue.
Make sure that `gem install ruby-opencv -v '0.0.14'` succeeds before bundling.
I tried below one also
gem install ruby-opencv -v '0.0.14'
ruby -v => 2.1.2
You need to download the opencv package from
https://github.com/Itseez/opencv/tree/master using,
git clone https://github.com/Itseez/opencv.git
or clicking on download button in that same page.
And install the above package using http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html
And then start to install the gem as below
gem install ruby-opencv -- --with-opencv-dir=/usr/local.
Now it will work.
Typically the Ruby opencv gem needs to compile native extensions, including the opencv tools, the sqlite database, the python language, openssl networking, and possibly access to your system's compiler such as gcc.
These extensions are generally easiest to diagnose by using sudo.
Try this if you can:
sudo gem install ruby-opencv -v '0.0.14'
Also, you may want to try changing from using rvm to using ruby-build.
Can you please edit your question, and add the results of the log file?
cat /home/k2/.rvm/gems/ruby-2.1.2#rails4/extensions/x86_64-linux/2.1.0/ruby-opencv-0.0.14/gem_make.out
Have you already installed OpenCV successfully on its own?
You can install OpenCV with these instructions: http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html
If you can install OpenCV, that may help verify you have most of the pieces you need for the Ruby gem.

bundle install / update: libv8 (therubyracer) installation fails (with native extensions)

I recently wanted to update my gem bundle but ran into installation problems with libv8 (requirement for therubyracer):
Installing libv8 (3.3.10.3) with native extensions /usr/local/rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed
to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb
Checking for Python...*** 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.
I have found the issue report on therubyracer github site and it suggests to uninstall and reinstall libv8, but this does not work on my Ubuntu 11.04 machine. Any ideas - or am I stuck with the old version for a while?
Try that one for a little while:
gem 'therubyracer'
gem 'libv8', '3.16.14.3'
Should help.
Also it's better with a new bundler: gem install bundler --pre
I had a similar issue on my good old Ubuntu 10.04 (x64)
After I updated the project Gemfile had those gems
gem 'libv8', '~> 3.11.8'
gem "therubyracer", '>= 0.11.0beta1', :require => 'v8'
But when I ran 'bundle install' I got an error
Installing therubyracer (0.11.0beta1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/sseletskyy/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for main() in -lpthread... yes
creating Makefile
make
compiling array.cc
compiling script.cc
compiling object.cc
compiling constants.cc
compiling signature.cc
compiling value.cc
compiling locker.cc
compiling init.cc
compiling heap.cc
compiling date.cc
compiling message.cc
compiling accessor.cc
compiling context.cc
compiling exception.cc
compiling backref.cc
compiling trycatch.cc
compiling gc.cc
compiling handles.cc
compiling stack.cc
compiling template.cc
compiling function.cc
compiling primitive.cc
compiling rr.cc
compiling v8.cc
compiling invocation.cc
compiling string.cc
compiling external.cc
compiling constraints.cc
linking shared-object v8/init.so
/home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.2-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: No such file or directory
collect2: ld returned 1 exit status
make: *** [init.so] Error 1
Gem files will remain installed in /home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.11.0beta1 for inspection.
Results logged to /home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.11.0beta1/ext/v8/gem_make.out
An error occured while installing therubyracer (0.11.0beta1), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.11.0beta1'` succeeds before bundling.
Here's a list of steps which worked for me to solve that block quickly
Uninstall all versions of gems 'libv8' and 'therubyracer'
> gem uninstall therubyracer
> gem uninstall libv8
Install therubyracer manually
> gem install therubyracer
Fetching: libv8-3.3.10.4-x86_64-linux.gem (100%)
Fetching: therubyracer-0.10.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed libv8-3.3.10.4-x86_64-linux
Successfully installed therubyracer-0.10.1
2 gems installed
Installing ri documentation for libv8-3.3.10.4-x86_64-linux...
Installing ri documentation for therubyracer-0.10.1...
Installing RDoc documentation for libv8-3.3.10.4-x86_64-linux...
Installing RDoc documentation for therubyracer-0.10.1...
Check versions of installed gems
> gem list | grep libv
libv8 (3.3.10.4 x86_64-linux)
> gem list | grep therubyracer
therubyracer (0.10.1)
Set those versions in Gemfile and run
> bundle install
Summary. Well I understand that in my case I used not the latest versions and it could be bad for compatibility sake. But at least I could continue development.
Ubuntu 11.04
gem "therubyracer", '0.11.1'
gem 'libv8'
Uninstall therubyracer and libv8 gem
Update the bundler gem version
Install lib8-dev package
sudo apt-get install libv8-dev
Then run this
sudo apt-get install 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 subversion imagemagick graphicsmagick libmagickcore-dev libmagickwand-dev
Now install therubyracer manually
gem install therubyracer
It will install therubyracer and libv8 for you.
Now run bundle install
All above steps solved my problem :)
I've run into the same issue recently. Here is a bit of helpful information from the RoR.org 'Getting Started with Rails' Guide:
Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the absence of a runtime will give you an execjs error. Usually Mac OS X and Windows come with a JavaScript runtime installed. Rails adds the therubyracer gem to Gemfile in a commented line for new apps and you can uncomment if you need it. therubyrhino is the recommended runtime for JRuby users and is added by default to Gemfile in apps generated under JRuby. You can investigate about all the supported runtimes at ExecJS.
Based on what I've read elsewhere it seems that Windows support for the therubyracer gem is not there in the '3.3.10.4' version (possibly there in a more recent version, didn't read in that far though). I've installed python 2.7 and got it to compile but you still get errors later during the environment setup process.
So it comes down to this. Check out therubyracer documentation here. 'therubyracer' provides these features (:
Evaluate Javascript from with in Ruby
Embed your Ruby objects into the Javascript world
Manipulate JavaScript objects and call JavaScript functions from Ruby
API compatible with the The Ruby Rhino (for JRuby: http://github.com/cowboyd/therubyrhino)
If you ABSOLUTELY REQUIRE those features then you should switch to *nix and drop Windows for a development/production environment. Otherwise you can do what I did and choose not to install 'therubyracer' or 'libv8' (removed from my Gemfile). I don't rely heavily on JavaScript with the site I'm experiencing this problem with, so I just ignored both gems and all seems well (so far).
Hope this helps someone else in need!
Ubuntu 12.04
gem 'libv8', '3.11.8.3'
gem 'therubyracer', '0.11.0beta5'
Specifying the versions above solved my problem with therubyracer.
Also as someone above suggested, I used the latest bundler:
gem install bundler --pre
Be sure to reference ruby in your Gemfile
gem 'therubyracer', :platform => :ruby
and then run bundle update.
Using these terminal commands fixed it for me on Ubuntu 16.04
sudo apt-get install g++
sudo apt-get install build-essential

Nokogiri installation fails -libxml2 is missing

I always worked my way around Nokogiri installation issues by following the documentation in the "Installing Nokogiri" tutorial.
But this time, even after installing all the dependencies, Nokogiri hasn't been installed. I get the following error:
libxml2 is missing. please visit <http://nokogiri.org/tutorials/installing_nokogiri.html>
I tried installing it by specifying the libxml2 and libxslt directories:
sudo gem install nokogiri -- --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib --with-xslt-dir=/usr/
but it returned the same error.
I followed all the other related Stack Overflow articles and none helped. Does anyone have a solution?
You may actually need to install both of these packages
sudo apt-get install libxslt-dev libxml2-dev
First, install the dependencies:
sudo apt-get install libxslt-dev libxml2-dev
If you still receive the error, you may be missing a compiler toolchain:
sudo apt-get install build-essential
You'll get the "libxml2 is missing" error if you're missing a build toolchain (at least I ran into this issue on Debian Lenny).
The Nokogiri build test-compiles a libxml2 header file to verify that it is present, however, it doesn't differentiate between "libxml2 is missing" and "a compiler to test libxml2 is missing".
In Mac OS X (Mavericks), installing the libraries with brew and setting NOKOGIRI_USE_SYSTEM_LIBRARIES=1 before installing the gem did the trick for me.
Summarising:
If previously installed, uninstall the gem:
gem uninstall nokogiri
Use Homebrew to install libxml2, libxslt and libiconv:
brew install libxml2 libxslt libiconv
Install the gem specifying the paths to the libraries to be linked against:
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install nokogiri -- --use-system-libraries --with-iconv-dir="$(brew --prefix libiconv)" --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config" --with-xslt-config="$(brew --prefix libxslt)/bin/xslt-config"
I just had the same issue on Fedora 13. After a frustrating and unsuccessful search to make
gem install nokogiri
work for me, I was able to install it and get around the libxml2 error via yum.
Simply install the gem via yum instead of the gem command:
su
yum search rubygem-nokogiri #this find the proper package name
yum install rubygem-nokogiri.i686
This helped me find the right answer for Fedora and, as I am using RVM for Ruby package management,
yum install rubygem-nokogiri
will pull in all the Ruby gems and dependencies into the system, not into my RVM environment, and in my experience that leads to a very frustrating and humbling experience.
So, taking your find of the Nokogiri yum gem you can use:
yum provides rubygem-nokogiri
and get a list of the dependencies for rubygem-Nokogiri which showed me the libraries that were missing. After that I ran:
yum install libxml2-devel libxslt libxslt-devel
Now Nokogiri compiles in Fedora and Nokogiri installs. D'oh!, we need the headers to compile Nokogiri from the devel libraries.
In Mac OS X (Mavericks) if none of these solutions work, try:
ARCHFLAGS="-arch x86_64" gem install nokogiri
or
ARCHFLAGS="-arch i386" gem install nokogiri
depending on your system's architecture.
You usually need development files for building gems. Try:
sudo apt-get install libxslt-dev libxml2-dev
(I just saw that Eric suggested the same in a comment.)
I was able to get this installed with Chocolatey, Windows 8.1 x64, and DevKit x64.
cinst libxml2
cinst libxslt
cinst libiconv
gem install nokogiri --
--with-xml2-include=C:\Chocolatey\lib\libxml2.2.7.8.7\build\native\include
--with-xml2-lib=C:\Chocolatey\lib\libxml2.redist.2.7.8.7\build\native\bin\v110\x64\Release\dynamic\cdecl
--with-iconv-include=C:\Chocolatey\lib\libiconv.1.14.0.11\build\native\include
--with-iconv-lib=C:\Chocolatey\lib\libiconv.redist.1.14.0.11\build\native\bin\v110\x64\Release\dynamic\cdecl
--with-xslt-include=C:\Chocolatey\lib\libxslt.1.1.28.0\build\native\include
--with-xslt-lib=C:\Chocolatey\lib\libxslt.redist.1.1.28.0\build\native\bin\v110\x64\Release\dynamic
You'll have to verify the version number in the paths are correct.
You may possibly need to add Microsoft's NuGet repository:
-Source "https://go.microsoft.com/fwlink/?LinkID=230477"
It will be:
sudo yum install -y libxml2 libxml2-devel
on RHEL servers.
At macOS none of above/below had really worked for me until I explicitly provided XCode libxml2 path to --with-xml2-include.
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2 --use-system-libraries
I was able to install Nokogiri 1.6.5 on Fedora 20 by doing:
export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
Then running:
gem install nokogiri
For anyone else experiencing this issue, I solved it by running this command within the project directory
gem install nokogiri -- --use-system-libraries
Update: I ran into this again and tried just updating the gem which worked for me...
gem update nokogiri
Have you tried installing libxml2? Not from rubygems, but via the standard install process for your operating system. On Ubuntu/Debian for example:
sudo apt-get install libxml2
On any recent version of OS X it should already be installed.
For OSX users, if you've had success installing Nokogiri before, yet are getting errors installing it on, say, using a new version of Ruby that you've added and that error that includes a message like:
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
This could be indicative of a XCode upgrade having happened via the App Store, either manually or automatically, and you not having opened it since that time.
If so, you should be able to open XCode, agree to the new license, and then install Nokogiri successfully.
On Mac OS X Yosemite my mistake was that I tried to use sudo gem install when it's a rule of thumb to not use superuser privileges when installing gems.
In my case it tried to modify the system installation of Ruby, and that's not a good idea. I installed rbenv, installed Ruby 2.2.2 thru it and set it as global, which is a term from rbenv's documentation. After that Nokogiri could install itself with a simple
gem install nokogiri
No hacks or workarounds were necessary, just a properly set environment; Nokogiri does the rest perfectly.
Was able to install vagrant-awe by following the above post but using the command as follow:
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 vagrant plugin install vagrant-aws
For Windows x64:
gem inst nokogiri --pre --platform ruby
For more information check this thread: https://github.com/sparklemotion/nokogiri/issues/864
I was able to install Nokogiri by running the following packages:
$ dnf group install "C Development Tools and Libraries"
$ dnf install ruby-devel libxml2-devel patch
=== TLDR ===
As the instructions state, build Ruby with the latest clang compiler, or at least the same version that Rubygems will use to compile Nokogiri's native extensions libxml and libxsl.
If using RVM, building from source with the --with-ggc=clang flag was what did it for me:
rvm install 2.2 --with-gcc=clang
Replace 2.2 with whatever version you want. --with-gcc=clang ensures RVM builds from source and uses clang to do so; otherwise RVM may a pre-built binary Ruby, which is what tripped me up.
Then, install Nokogiri as normal using Bundler or Rubygems.
=== IN DEPTH ===
I struggled with this for a while. gem install nokogiri gave me:
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
Digging into mkmf.log I saw:
conftest.c:15:27: error: too few arguments to function call, single argument 'cur' was not specified
int t(void) { xmlParseDoc(); return 0; }
Nokogiri supplies its own libxml and libxsl (as of 1.6.4). The signature defined in Nokogiri's local copy of parser.h (found under the gem install directory) is:
xmlParseDoc (const xmlChar *cur);
So I was at a loss as to how the method call in the hermetically sealed conftest.c file usage couldn't match up with the header file for parser.h.
When I realized I had probably installed a binary Ruby I removed and reinstalled using --with-gcc=clang (to force compilation and use clang) and the problem was solved:
rvm uninstall 2.2
rvm install 2.2 --with-gcc=clang
gem install nokogiri
I'm not exactly sure why that works as the system libxml header /usr/include/libxml2/libxml/parser.h has the same signature as Nokogiri's local copy.
It's weird, but it worked. Just make sure you compile a Ruby with clang.
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib
Change your version with it.

Why can't I install the SQLite gem?

I'm try to install the SQLite gem on a Fedora 9 Linux box with Ruby 1.8.6, Rails 2.2.2, gem 1.3, and sqlite-3.5.9. Here's the command I'm running and its results:
sudo gem install sqlite3-ruby
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb install sqlite3-ruby
can't find header files for ruby.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out
gem_make.out just repeats what was already sent to the console. How can I install this gem?
The SQLite RubyGem isn't actually a RubyGem, it's a "CGem", IOW it's written in C. This means it has to be compiled and linked to the Ruby interpreter when you install it and in order to do that it needs the C header files for the Ruby interpreter.
If you compile Ruby yourself, those header files will be installed automatically, however, in RedHat-ish systems, such header files are usually packaged in a seperate package, called <whatever>-dev. So, in this case you will need to install the ruby-dev package and possibly the libsqlite3-dev (Ubuntu) or sqlite-devel (Fedora) package as well.
However, you might be better off just installing your Operating System's pre-packaged libsqlite3-ruby package, that way all the dependencies are automatically satisfied.
(Note: all package names pulled out of thin air, might be different on your system.)
You probably need the ruby dev package. For Ubuntu you have to install ruby1.8-dev which includes the ruby header files. A quick google says that the yum package is ruby-devel. so run this:
sudo yum install ruby-devel
I faced problem installing sqlite3-ruby gem on my fedora 13 box.
It was fixed after sudo yum install sqlite-devel
When I had that problem:
gem install sqlite3 -v '1.3.9'
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
For me worked, installing the "libsqlite3-dev" with:
apt-get install libsqlite3-dev
sudo apt-get install ruby-dev
Fixed it for me.
On Ubuntu 9 and 10 try:
sudo apt-get install ruby-dev
sudo apt-get install sqlite3-dev
Then run
gem install sqlite3
Run the following for Fedora OS:
yum install rubygem-sqlite3
On alpine, you need to install the sqlite-dev package.
I also faced this same issue, the problem is that your Linux installation requires the development libraries for SQLite3 to be installed in order to build the gem.
Here's how I fixed the issue
Open your terminal and run the following commands
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
And then try installing Sqlite3 gem again using this command
gem install sqlite3
That's all.
I hope this helps
Do you have all the source code required to build sqlite3-ruby? Gem is trying to compile some C code and cannot find the headers. You can probably use a fedora rpm for sqlite3-ruby (I don't use fedora, but I'm sure one exists) if you prefer to forgo compiling. Personally for ruby stuff, I prefer to use gem rather than a distro's packaging system.
I'm not really familiar with Fedora, but in Ubuntu when you are installing packages you have apt-get, and you have to install the build-essentials which includes gcc and other compilation tools for C. I would say that could be your issue, and you make look into how that can be install either using RPM or apt-get on Fedora.
I fixed the problem on my OLPC (Fedora 9) by installing 'gcc' oddly enough. It seems like it should have been one of those dev packages, but no.
Also, regarding the other packages, the suffix is "-devel", not "-dev", so make sure you get those ending right: "ruby-devel", "sqlite-devel"...
Once you get that installed, if you get errors about your gems being too old "< 1.3.1" when you try to run various rails scripts, eg: script/server or script/console, google "upgrade_rubygems" to fix that problem...
HTH...
Run "sudo yum install sqlite-devel" and then "gem install sqlite3". Had the same problem on my Fedora 15.
I had this same exact issue...instead of gem'ing the missing pieces I used synaptic on unbuntu.
The key package for me was libsqlite-ruby1.9.1 ... I documented my experience (for reference) with this error at :
Sqlite3-gem-error-during-bundle-install
I encountered this error while running bundle install after generating a react-rails app on Fedora 29. I was able to identify a suitable development package by running dnf search sqlite3, then installed it dnf install libsqlite3x-devel. This fixed it for me.

Resources