I am very new to Ruby . I installed DataMapper and I am trying to install dm-mysql-adapter-1.0.2 gem . But when I try to install , I get the below error . I am using ubuntu OS .
vinoth#vinoth-laptop:~/Downloads$ gem install dm-mysql-adapter-1.0.2 -- --with-mysql- lib=/usr/lib/mysql -- --with-mysql-conf=/usr/bin/mysql
WARNING: Installing to ~/.gem since /home/vinoth/gems and
/home/vinoth/gems/bin aren't both writable.
WARNING: You don't have /home/vinoth/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
Building native extensions. This could take a while...
ERROR: Error installing dm-mysql-adapter-1.0.2:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb --with-mysql-lib=/usr/lib/mysql -- --with-mysql- conf=/usr/bin/mysql
checking for mysql_query() in -lmysqlclient... no
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
- ........
Gem files will remain installed in /home/vinoth/.gem/ruby/1.8/gems/do_mysql-0.10.2 for inspection.
Results logged to /home/vinoth/.gem/ruby/1.8/gems/do_mysql-0.10.2/ext/do_mysql/gem_make.out
Am I missing something ?
Additional information .
Ruby Version : ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
Gem Version : 1.3.5
You need to have mysql dev package installed:
sudo apt-get install libmysqlclient-dev
Should do the trick
Related
I am trying to install jsduck on ruby gem, however I got error.
I've downloaded Ruby 2.3.0(x64).
I've also downloaded DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe which is for x64.
I installed the ruby 2.3.0(x64). Then I extracted devkit to "C:/rubydevkit"
I ran the below commands in "C:/rubydevkit" folder :
$ruby dk.rb init
and
$ruby dk.rb install
So far, everything is okay. I installed sass successfully by
$gem install sass
However, when I try
$gem install jsduck
or
$gem install rdiscount --platform=ruby
I got followin error:
$ gem install jsduck
ERROR: Error installing jsduck:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rdiscount-2.1.8/ext
C:/Ruby23-x64/bin/ruby.exe -r ./siteconf20160411-6020-6ayo32.rb extconf.rb
checking for random()... no
checking for srandom()... no
checking for rand()... yes
checking for srand()... yes
checking size of unsigned long... 4
checking size of unsigned int... failed
checking size of unsigned short... 2
no int with size 2
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby23-x64/bin/$(RUBY_BASE_NAME)
--with-rdiscount-dir
--without-rdiscount-dir
--with-rdiscount-include
--without-rdiscount-include=${rdiscount-dir}/include
--with-rdiscount-lib
--without-rdiscount-lib=${rdiscount-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/rdiscount-2.1.8/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rdiscount-2.1.8 for inspection.
Results logged to C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/rdiscount-2.1.8/gem_make.out
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Below are my current versions versions:
Windows 8.1 64bit
$ gem -v
2.5.1
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
Have you tried using a precompiled windows binary?
You're really running into issues with compiling binary extensions for Ruby. Specifically the rdiscount dependency is failing to compile - you might get better help from rdiscount developers.
RDiscount definitely works on Ruby 2.2.2 on Windows (since this is covered by CI) and in Ruby 2.3.0 on Linux (since this is also covered by CI).
But RDiscount + Ruby 2.3.0 + Windows hasn't been tested yet.
See if you can build successfully with Ruby 2.2.2 on your Windows box.
I am on windows7 with Ruby2.1.5.
While installing rbczmq i got below error:
C:\Users\namitk>gem install rbczmq
Building native extensions. This could take a while...
ERROR: Error installing rbczmq:
ERROR: Failed to build gem native extension.
C:/Ruby21-x64/bin/ruby.exe extconf.rb
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby21-x64/bin/ruby
--with-kernel32lib
--without-kernel32lib
--with-rpcrt4lib
--without-rpcrt4lib
--with-gdi32lib
--without-gdi32lib
extconf.rb:49:in `<main>': uninitialized constant GNU_CHAIN (NameError)
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rbczmq-1.7.8 for inspection.
Results logged to C:/Ruby21-x64/lib/ruby/gems/2.1.0/extensions/x64-mingw32/2.1.0/rbczmq-1.7.8/gem_make.out
even gem install rbczmq -- --with-system-libs is also giving error. So above two error cases came i tried to install rbczmq using gem hosting service
Then i have downloaded source from its git repo: https://github.com/methodmissing/rbczmq
then i did:
git submodule init
git submodule update
and from that source when i tried to build the gem from its gemspec file as gem build rbczmq.gemspec; same uninitialized constant GNU_CHAIN error came.
then and i build the gem using system libs as below, and it was successful:
D:\rbczmq>gem build rbczmq.gemspec -- --with-system-libs
WARNING: description and summary are identical
WARNING: pessimistic dependency on minitest (~> 5.5.0, development) may be overly strict
if minitest is semantically versioned, use:
add_development_dependency 'minitest', '~> 5.5', '>= 5.5.0'
WARNING: pessimistic dependency on rake-compiler (~> 0.8.0, development) may be overly strict
if rake-compiler is semantically versioned, use:
add_development_dependency 'rake-compiler', '~> 0.8', '>= 0.8.0'
WARNING: See http://guides.rubygems.org/specification-reference/ for help
Successfully built RubyGem
Name: rbczmq
Version: 1.7.8
File: rbczmq-1.7.8.gem
as you can see above step is successful when i build gem from source on windows. But error comes when i install this gem as:
D:\rbczmq>gem install rbczmq-1.7.8.gem
ERROR: While executing gem ... (Errno::EINVAL)
Invalid argument # dir_s_mkdir - C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rbczmq-1.7.8/d:
so is there any mistake while building the gem from source? how to solve Invalid argument # dir_s_mkdir error as mentioned above on windows?
FYI: i got zeromq win64 builds for matching zeromq used in given rbczmq from https://binstar.org/minrk/zeromq/4.0.3/download/win-64%5Czeromq-4.0.3-1.tar.bz2
I am trying to install linecache with RVM on Ruby 2.1.1.
$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
I run bundle install
$ bundle install
It blows saying it isn't compatible with 1.9.x when I run bundle install:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/g/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/g/.rvm/rubies/ruby-2.1.2/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in /home/g/.rvm/gems/ruby-2.1.2/gems/linecache-0.46
for inspection.
Results logged to /home/g/.rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0
/linecache-0.46/gem_make.out
An error occurred while installing linecache (0.46), and Bundler cannot continue.
Make sure that `gem install linecache -v '0.46'` succeeds before bundling.
Any ideas whats happening here?
Linecache hasn't been updated in 3 years, the last update was bringing it up to version 1.9.3. Unless you're pulling it from someone else's fork, since you're using 2.1.1 the gem won't work. Most likely the error message hasn't been updated so it just tells you it's invalid for 1.9.x since it doesn't know about any newer versions.
I am trying to install ruby on rails (v4.0) using ruby installer. It is throwing me this error. I am brand new to RoR and some websites told me to install devkit. I have done that. I ran gem install thin
C:\Users\shashid\Downloads>gem install rails
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/RubyRails/bin/ruby.exe extconf.rb
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RubyRails/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to gene
rate an executable file. (RuntimeError)
You have to install development tools first.
from C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
from extconf.rb:22:in `<main>'
Gem files will remain installed in C:/RubyRails/lib/ruby/gems/2.0.0/gems/atomic-
1.1.10 for inspection.
Results logged to C:/RubyRails/lib/ruby/gems/2.0.0/gems/atomic-1.1.10/ext/gem_ma
ke.out
Thank you in advance for your help
You need to install Ruby DevKit if on windows, get it from: http://rubyinstaller.org/downloads/ (scroll down a little).
Same story here deleting ruby and installing:
Ruby 2.0.0-p247
DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
from http://rubyinstaller.org/downloads/ solved the problem.
Try to use railsinstaller from http://railsinstaller.org/
it will install follwing
Ruby 1.9.3-p392
Rails 4
Bundler
Git
Sqlite
TinyTDS
SQL Server Support
DevKit
The same can happen when you try to combine 32-bit Ruby and 64-bit DevKit.
The solution is to use same-bit versions.
For instance current versions:
rubyinstaller-2.0.0-p247-x64.exe
DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
I have a problem installing my bundle.
These were my last steps:
git clone http:...
git checkout -b daniel
bundle install
The error I got was:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** 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.
Provided configuration options: --with-opt-dir --without-opt-dir
--with-opt-include --without-opt-include=${opt-dir}/include
--with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog
--without-make-prog --srcdir=. --curdir
--ruby=/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
--with-pthreadlib --without-pthreadlib --with-objclib
--without-objclib --enable-debug --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError) from
extconf.rb:20:in `<main>'
Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.11.0), and Bundler
cannot continue. Make sure that `gem install therubyracer -v '0.11.0'`
succeeds before bundling.
When I tried to run gem install therubyracer -v '0.11.0' I got:
Building native extensions. This could take a while... ERROR: Error
installing therubyracer: ERROR: Failed to build gem native extension.
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** 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.
Provided configuration options: --with-opt-dir --without-opt-dir
--with-opt-include --without-opt-include=${opt-dir}/include
--with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog
--without-make-prog --srcdir=. --curdir
--ruby=/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
--with-pthreadlib --without-pthreadlib --with-objclib
--without-objclib --enable-debug --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError) from
extconf.rb:20:in `<main>'
Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
I am working on Mac OS 10.7.5. Xcode and its command line tools and Rails are up to date.
SQLite 3 is also installed.
Can anyone help me?
EDIT:
I also tried to delete the repository and to clone it again, with the same errors.
EDIT:
Is the installation path of Rails and Sqlite3 correct?
daniel:~
daniel$ sudo gem update --system Latest version currently
installed. Aborting.
daniel:~
daniel$ sudo gem install rails
Fetching:
rails-3.2.11.gem (100%) Successfully installed
rails-3.2.11 1 gem installed
Installing ri documentation for rails-3.2.11...
Installing RDoc documentation for rails-3.2.11...
daniel:~
daniel$ sudo gem install sqlite3
Fetching: sqlite3-1.3.7.gem (100%)
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.7 1 gem installed
Installing ri documentation for sqlite3-1.3.7...
Installing RDoc documentation for sqlite3-1.3.7...
daniel:~
daniel$ which ruby irb gem rake
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/irb
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/gem
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/bin/rake
At least one problem is that you are running RVM, but used sudo to install gems on your system.
Read "RVM and RubyGems", especially the part that says:
"DO NOT use sudo..."
RVM creates a sandbox for you, the user, in your own user-space on a machine, that allows you to manage it without needing to be the system administrator. In other words, that means you don't have to use sudo for any RVM or gems management.
If you do use sudo, you temporarily cease being you, the user, and become the administrator, with administrator privileges and the administrator's environment, which does NOT include the RVM sandbox in your /Users/daniel/.rvm/rubies/ruby-1.9.3-p286 path. Knowledge of the sandbox is carried by the PATH in your environment, which the root on your machine doesn't use. Gems installed inside that sudo sub-shell get installed into the location that the administrator account knows about, which is inside the System Ruby installation, which is why your RVM sandboxed Ruby doesn't see them: There is no crossover between the System's Ruby and your RVM-controlled RUby. That's the whole idea of a sandbox: separation of the elements and resources to avoid contamination.
You could have figured this all out by looking at the output of:
which ruby irb gem rake
The path for all of them is pointing to your sandbox:
/Users/daniel/.rvm/rubies
On a Mac OS system, that command should have reported:
/usr/bin/ruby
/usr/bin/irb
/usr/bin/gem
/usr/bin/rake
Reinstall Rails and the SQLite gem using:
gem install rails sqlite3
and see how your bundle behaves.
And, by the way, do NOT use sudo to deliberately try to manage/delete the System installed Ruby. That was installed by Apple for their own purposes, to enable software they installed. It's OK to take advantage of its existence, but it's there for their use. Use a RVM-managed Ruby for your own purposes.