i have git clone git://github.com/jalagrange/excel_test_app.git
I got the below error while the bundle install, This does not happen with other my applications.
following error
Installing mysql2 (0.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for main() in -llibmysql... 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.
gemfile
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem "spreadsheet"
gem "carrierwave"
gem "mini_magick"
gem 'flash_cookie_session'
gem "pry"
gem "haml"
gem 'fog'
# To use Delayed_job
gem 'daemons'
gem 'delayed_job_active_record'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
group :development, :test do
gem "mysql2", "0.3.6"
gem "letter_opener"
gem "pry"
end
this question and answer not working for my problem..
gem install: Failed to build gem native extension (can't find header files)
problem solved,
i have run bundle update..
thx all..
Run the following command and install the bundle again
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo apt-get install libmysqlclient-dev
then
gem install mysql2 -v=X.X.x
where x.x.x is the version that you need
then bundle install
2018.11.05 => Depreciated.
After an apt search libmysqlclient-dev you will get the new package you will need to continue installing mysql2.
In my case it results default-libmysqlclient-dev
apt install default-libmysqlclient-dev
gem install mysql2 -v 0.4.6
=> then you can restart thebundle installenter code here cmd.
Related
This issue occurs only when my database is mysql2.
i try to install gem install win32api but is not working
my gem file
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.0.2"
gem "rails", "~> 7.0.2", ">= 7.0.2.3"
gem "mysql2"
gem "puma", "~> 5.0"
# gem "redis", "~> 4.0"
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
gem "bootsnap", require: false
[https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem "rack-cors"
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
end
group :development do
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
gem "annotate"
end
when i try create model and database
So I'm running rspec tests with jruby-1.7.16.1 after completing a bundle install, and they are all failing to the same error:
Failure/Error: Unable to find arjdbc/jdbc/RubyJdbcConnection.java to read failed line
ActiveRecord::JDBCError:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
# arjdbc/jdbc/RubyJdbcConnection.java:453:in `init_connection'
Occasionally I would get an error like this when I'd forget to start mysql server, but I ensured it was running.
The GemFile is as such
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'rubyzip', '0.9.9'
gem 'roo','1.12.1'
gem 'jdbc-mysql', '5.1.33', platform: :jruby
gem 'activerecord-jdbcmysql-adapter', '1.3.12', platform: :jruby
gem 'jquery-rails', '2.1.2'
gem 'haml', '3.1.7'
gem 'puma', '2.9.2'
gem 'devise', '2.1.2'
gem 'devise-async', '0.5.0'
gem 'cancan', '1.6.8'
gem 'simple_form', '2.0.4'
gem 'cocoon', '1.1.1'
gem 'inherited_resources', '1.3.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'mechanize', '2.5.1'
gem 'delayed_job', '3.0.4'
gem 'paperclip', '3.4.0'
gem 'spreadsheet', '0.6.4.1'
gem 'geocoder', '1.1.6'
gem 'whenever', '0.8.2'
gem 'american_date', '1.0.0'
gem 'money','5.1.1'
gem 'rets', '0.11.0'
gem 'haversine','0.3.0'
gem 'celluloid','0.15.2'
gem 'sinatra', '1.4.6'
source "https://9789474f:e71b0546#gems.contribsys.com/" do
gem 'sidekiq-pro','1.9.2'
end
gem 'redis','3.2.1'
gem 'remote_lock','1.1.0'
gem 'sidekiq-limit_fetch','2.3.0'
group :assets do
gem 'stylus', '0.7.1'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.3.0'
end
group :development do
gem 'net-ssh', '2.9.4'
gem 'capistrano', '3.4.1'
gem 'capistrano-rails', '1.3.0'
gem 'capistrano-rvm', '0.1.2'
end
group :development, :test do
gem 'dotenv-rails', '2.2.1'
gem 'rspec-rails', '~> 3.5'
gem 'fantaskspec'
end
group :test do
gem 'factory_girl_rails', '~> 4.0'
gem 'fantaskspec'
gem 'vcr'
gem 'fakeweb'
end
gem 'rest-client', '1.8.0'
gem 'poltergeist', '1.8.1'
gem 'nokogiri', '1.5.11'
gem 'zip-codes', '0.2.1'
gem 'elasticsearch-model', '0.1.9'
gem 'elasticsearch-rails', '0.1.9'
gem "fog", '1.38.0'
gem 'newrelic_rpm', '3.18.1.330'
gem 'sidekiq-scheduler', '2.1.7'
gem 'aws-sdk', '2.10.28'
gem 'StreetAddress', '1.0.6'
If there is more information required I'd be happy to provide it, let me know if anyone has run into this.
The odd thing is, these spec tests used to work fine prior to a merge I did with our repository. The other dev doesn't seem to be running into this same issue, so I can only assume the Gemfiles are all correct and that my environment is the issue.
Make sure the database is up and running.
Does the user that's trying to connect to the database has permission to connect? Try logging in with that user in the client software.
Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server
Try creating a new user with admin privileges and try connecting.
Advice: Try using a software that keeps your development environments in sync, and test it well. We use Vagrant to reproduce development environments.
I'm trying to build gem file that will require the dll "libmysql.dll" with the gem mysql.Didn't find any documentation on it at http://bundler.io website and searched the internet.
currently this is the gem file:
source "https://rubygems.org"
gem 'json'
gem 'trollop'
gem 'activeresource', '~> 3.2.21'
gem 'activesupport', '~> 3.2.21'
gem 'activemodel', '~> 3.2.21'
gem 'mysql', '~> 2.9.1'
Thanks!
Install MySQL connector from here which will install libmysql.dll file and then run bundle install.
In rails 4.2.2 environment, I am trying to run bundle install for one sample project but I am getting an error like below
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/aparna/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150912- 2709-1b70inv.rb extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling mysql2_ext.c
In file included from ./client.h:11:0,
from ./mysql2_ext.h:39,
from mysql2_ext.c:1:
/home/aparna/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp]
#warning rubysig.h is obsolete
^
In file included from ./mysql2_ext.h:39:0,
from mysql2_ext.c:1:
./client.h: In function ‘rb_thread_blocking_region’:
./client.h:23:3: error: ‘TRAP_BEG’ undeclared (first use in this function)
TRAP_BEG;
^
./client.h:23:3: note: each undeclared identifier is reported only once for each function it appears in
./client.h:25:3: error: ‘TRAP_END’ undeclared (first use in this function)
TRAP_END;
^
mysql2_ext.c: At top level:
./client.h:16:1: warning: ‘rb_thread_blocking_region’ defined but not used [-Wunused-function]
rb_thread_blocking_region(
^
make: *** [mysql2_ext.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/aparna/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.13 for inspection.
Results logged to /home/aparna/.rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/mysql2-0.3.13/gem_make.out
An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.
Gemfile is,
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'mysql2', '0.3.13'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
gem 'protected_attributes'
gem 'devise'
gem 'paperclip'
gem "cocaine"
gem "simple_form"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"
gem 'kristin'
gem 'docsplit'
gem 'pdf2html'
I have try to install mysql2 then it got installed mysql2 (0.4.0) but this will shows below error while starting a rails server
/home/aparna/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
How can I solve mysql2 installation issue?
There's a bug in mysql2-0.4.0 version, look into neighbor question
Try to install latest mysql2-0.3.x version:
Change in your Gemfile:
gem 'mysql2', '~> 0.3.13'
And run
bundle update mysql2
Make sure to stop spring via spring stop and then start rails.
I have a old rails project that is using rails 3.0.9 and I am trying to run it using rails s. It appears that when I do this is gives me the following error:
You will see that it says that the current adapter that I have installed is not supported by foriegner. I have updated my gemfile to look like the following:
gem 'rake', '0.9.2.2'
gem 'mysql2'
gem 'rails', '3.0.9'
gem "acl9"
gem 'foreigner'
gem 'devise'
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails'
gem 'lazy_high_charts'
gem 'client_side_validations'
gem 'carrierwave'
gem 'tiny_mce'
#gem 'devise_security_extension'
#gem 'rails_email_validator'
#gem 'easy_captcha'
group :development do
gem 'rspec-rails', '2.6.1'
gem 'jspec'
gem 'faker', '0.3.1'
gem 'rspec'
gem 'annotate'
end
group :test do
gem 'rspec-rails', '2.6.1'
gem 'spork', '0.9.0.rc8'
gem 'webrat'
gem 'autotest-growl'
gem 'autotest-rails'
gem 'autotest', '4.4.6'
gem 'autotest-rails-pure', '4.1.2'
gem 'factory_girl_rails'
gem 'ZenTest'
gem 'test-unit'
end
What I don't seem to understand is why it would say in the command prompt that the gem is missing and I need to add it to my gemfile when it is there. What is the best solution to tackling this.
It isnt working cause you are trying to install the latest version of mysql2 which doesnt work with rails 3.0.X. You can get around this by specifying the version this way
gem 'mysql2', '< 0.3' or gem "mysql2", "~> 0.2.7"
But to get around the foreigner dependency which is probably the main issue here:
You can upgrade your rails version to 3.1.x or higher and upgrade the mysql2 in the gem file. I see that you have a recent version of ruby.
After you update the gems in the gemfile, make sure you run bundle install in the command line...before trying to start the server. Also, ensure that you setup your database in the database.yml file in the config folder.
edit your config/database.yml file from:
adapter: mysql
to
adapter: mysql2