简体   繁体   中英

An error occurred while installing mysql (2.9.1) and Bundler cannot continue

I'm trying to upload a Rails app to hostgator following this guide: http://support.hostgator.com/articles/specialized-help/technical/how-do-i-start-using-ruby-on-rails I'm getting an error in point 5.6. When I do:

rake generate_session_store

It says that couldn't find gem 'rack' and suggest me to run bundle install. When I do that:

Gem::Installer:ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby
    --with-mysql-config
    --without-mysql-config

Gem files will remain installed in /home4/agtcorp/ruby/gems/gems/mysql-2.9.1 for inspection.
An error ocurred while installing mysql(2.9.1) and Bundler cannot continue.
Make sure that gem install mysql -v '2.9.1 succeeds before bundling.

I tried gem install mysql -v '2.9.1' obviously. I contacted the Hostgator support and a linux administrator said to me:

'I am seeing your issue is due to the path declared being incorrect. The Rakefile is currently located in /home4/agtcorp/rails_apps/agtcorp2/ . Perhaps if you update the installation to use the correct path, it will find the file in the full file path /home4/agtcorp/rails_apps/agtcorp2/Rakefile.'

I don't know how to do that. Please help!

我想你错过了“libmysqlclient-dev”,请试试:

   sudo apt-get install mysql-server mysql-client libmysqlclient-dev 

As Srdjan said, the answer from HostGator is wrong. The issue isn't the location of the Rakefile — the issue is that the there are no MySQL headers available to you. But that's ultimately irrelevant because HostGator shared hosting customers (like most shared hosting customers) don't have access to a compiler.

The only people who can compile native gems for you are HostGator administrators. They generally will not, however, because HostGator has a predefined list of (outdated, often insecure) permissible versions.

While it is possible to get a very simple Rails app up and running on Hostgator with a great deal of effort and hair-pulling, you would likely be far better served by either an IaaS platform like Heroku if you're not comfortable with typical sysadmin duties, or a PaaS platform like AWS, Azure, or Rackspace if you are.

That suggestion is likely wrong. The problem here is that the mysql gem isn't finding the relevant MySQL C libraries. You usually need to supply that using the --with-opt-dir and --with-opt-libs parameters.

Another issue may be that the MySQL development libraries aren't installed. This is something the Hostgator support may have to help you with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM