2012-02-03 5 views
7

Tôi vừa di chuyển môi trường devR devm của mình sang Ubuntu. Tôi rút ra một dự án mà tôi đang làm việc trên từ github, và tôi đang cố gắng để cài đặt tất cả các đá quý cần thiết. Tuy nhiên, bất cứ khi nào tôi chạy bundle hoặc bundle install hoặc bundle install exec tôi nhận được lỗi sau:Tôi không thể chạy gói, tiếp tục gặp lỗi

[email protected]:~/Workspace/SuitBrokers$ bundle install exec 
Fetching source index for http://rubygems.org/ 
Installing rake (0.9.2.2) 
Installing multi_json (1.0.3) 
Installing activesupport (3.1.0) 
Installing bcrypt-ruby (3.0.1) with native extensions 
Installing builder (3.0.0) 
Installing i18n (0.6.0) 
Installing activemodel (3.1.0) 
Installing erubis (2.7.0) 
Installing rack (1.3.5) 
Installing rack-cache (1.0.3) 
Installing rack-mount (0.8.3) 
Installing rack-test (0.6.1) 
Installing hike (1.2.1) 
Installing tilt (1.3.3) 
Installing sprockets (2.0.3) 
Installing actionpack (3.1.0) 
Installing mime-types (1.17.2) 
Installing polyglot (0.3.3) 
Installing treetop (1.4.10) 
Installing mail (2.3.0) 
Installing actionmailer (3.1.0) 
Installing arel (2.2.1) 
Installing tzinfo (0.3.31) 
Installing activerecord (3.1.0) 
Installing activeresource (3.1.0) 
Installing ansi (1.4.1) 
Using bundler (1.0.21) 
Installing cocaine (0.2.0) 
Installing coffee-script-source (1.1.3) 
Installing execjs (1.2.9) 
Installing coffee-script (2.2.0) 
Installing rack-ssl (1.3.2) 
Installing json (1.6.1) with native extensions 
Installing rdoc (3.11) 
Installing thor (0.14.6) 
Installing railties (3.1.0) 
Installing coffee-rails (3.1.1) 
Installing jquery-rails (1.0.18) 
Installing mysql (2.8.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /home/edu/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lm... yes 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lz... yes 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lsocket... no 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lnsl... yes 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lmygcc... no 
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 
    --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/edu/.rvm/rubies/ruby-1.9.2-p290/bin/ruby 
    --with-mysql-config 
    --without-mysql-config 
    --with-mysql-dir 
    --without-mysql-dir 
    --with-mysql-include 
    --without-mysql-include=${mysql-dir}/include 
    --with-mysql-lib 
    --without-mysql-lib=${mysql-dir}/lib 
    --with-mysqlclientlib 
    --without-mysqlclientlib 
    --with-mlib 
    --without-mlib 
    --with-mysqlclientlib 
    --without-mysqlclientlib 
    --with-zlib 
    --without-zlib 
    --with-mysqlclientlib 
    --without-mysqlclientlib 
    --with-socketlib 
    --without-socketlib 
    --with-mysqlclientlib 
    --without-mysqlclientlib 
    --with-nsllib 
    --without-nsllib 
    --with-mysqlclientlib 
    --without-mysqlclientlib 
    --with-mygcclib 
    --without-mygcclib 
    --with-mysqlclientlib 
    --without-mysqlclientlib 


Gem files will remain installed in /home/edu/Workspace/SuitBrokers/exec/ruby/1.9.1/gems/mysql-2.8.1 for inspection. 
Results logged to /home/edu/Workspace/SuitBrokers/exec/ruby/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out 
An error occured while installing mysql (2.8.1), and Bundler cannot continue. 
Make sure that `gem install mysql -v '2.8.1'` succeeds before bundling. 

Có ai bị xử lý đau đặc biệt này? Sự giúp đỡ của bạn luôn được đánh giá cao.

+0

bạn có thể bao gồm sản lượng của 'mèo /home/edu/Workspace/SuitBrokers/exec/ruby/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out'? – Woahdae

+0

tệp đó nói nguyên văn những gì ouput nói bắt đầu sau dòng này "Gem :: Installer :: ExtensionBuildError: ERROR: Không thể xây dựng phần mở rộng gốc đá quý." –

+0

tuy nhiên, tôi không thấy extconf.rb ở bất kỳ đâu trong thư mục ruby ​​.../bin/ruby ​​ –

Trả lời

12

Bạn cần phải thông báo cho nhà cung cấp nơi tìm thấy công cụ mysql-dev trên hộp của bạn. Thông thường, một số thông tin như sau sẽ hoạt động:

bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config 

Tất nhiên, bạn sẽ cần phải thay thế đường dẫn ở trên bằng đường dẫn thực tế đến mysql_config. Nếu bạn chưa cài đặt mysql_config thì bạn sẽ cần gói mysql-dev được cài đặt trên máy chủ của bạn. Có vẻ như bạn đang ở trên một máy chủ chia sẻ, vì vậy hy vọng gói phát triển đã được cài đặt. Nếu không, bạn sẽ cần phải yêu cầu.

+0

nhờ @JasonK. Làm thế nào để tôi tìm ra nếu tôi đã cài đặt gói mysql-dev? Tôi tìm nó ở đâu? có một lệnh để chạy? Tôi đang sử dụng Ubuntu 11.10 được cài đặt trong một máy ảo Oracle chạy trong Windows 7. –

+6

Tôi tin vào gói Ubuntu được gọi là libmysqlclient-dev. Vì vậy, lệnh để cài đặt nó sẽ là một cái gì đó giống như 'sudo apt-get install libmysqlclient-dev' – JasonK

+0

Điều này làm việc cho tôi mà không có bất kỳ vấn đề. Cảm ơn. –

3

Thư viện bạn đang thiếu, trên Ubuntu 14.04 (Trusty) là: libmysqlclient-dev. Dòng dưới đây đã làm các trick cho tôi:

sudo apt-get install libmysqlclient-dev