2012-04-07 12 views
47

मैं रेल 3.2.3 के साथ mysql2 मणि ​​स्थापित करने के लिए कोशिश कर रहा हूँ और वह असफल रहा है:त्रुटि: मणि देशी एक्सटेंशन (रेल 3.2.3 पर mysql2) का निर्माण करने में विफल

★ bundle install 
Fetching gem metadata from https://rubygems.org/......... 
Using rake (0.9.2.2) 
Using i18n (0.6.0) 
Using multi_json (1.2.0) 
Using activesupport (3.2.3) 
Using builder (3.0.0) 
Using activemodel (3.2.3) 
Using erubis (2.7.0) 
Using journey (1.0.3) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.2) 
Using actionpack (3.2.3) 
Using mime-types (1.18) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.4.4) 
Using actionmailer (3.2.3) 
Using arel (3.0.2) 
Using tzinfo (0.3.32) 
Using activerecord (3.2.3) 
Using activeresource (3.2.3) 
Using bundler (1.1.3) 
Using coffee-script-source (1.2.0) 
Using execjs (1.3.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.6.6) 
Using rdoc (3.12) 
Using thor (0.14.6) 
Using railties (3.2.3) 
Using coffee-rails (3.2.2) 
Using jquery-rails (2.0.2) 
Installing mysql2 (0.3.11) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /Users/rarneson/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes 
checking for rb_wait_for_single_fd()... yes 
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... no 
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=/Users/rarneson/.rvm/rubies/ruby-1.9.3-p125/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 /Users/rarneson/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11 for inspection. 
Results logged to /Users/rarneson/.rvm/gems/ruby-1.9.3-p125/gems/mysql2-0.3.11/ext/mysql2/gem_make.out 
An error occured while installing mysql2 (0.3.11), and Bundler cannot continue. 
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling. 

मैं बंडल चल रहा हूँ स्थापित और यह मेरे जेमफाइल में है:

gem 'mysql2', '~> 0.3.11' 

मुझे वर्तमान में एमएएमपी के माध्यम से MySQL चल रहा है। मुझे यकीन नहीं है कि यह एक बुरा विचार है और मुझे एक वेनिला माईएसक्यूएल चलाना चाहिए, लेकिन ऐसा लगता है कि मेरी वर्तमान समस्या सिर्फ मणि स्थापित हो रही है। मैंने स्टैक ओवरफ्लो पर इन समस्याओं में से कुछ को देखा है लेकिन सभी थोड़ा अलग दिखते हैं या वास्तव में जटिल समाधान हैं। क्या मुझे कुछ याद आ रही है? कुछ आसान है? कुछ मूर्खतापूर्ण? यदि आवश्यक हो तो मैं आउट फ़ाइल से अतिरिक्त जानकारी प्रदान कर सकता हूं। मैंने पढ़ा है कि कुछ लोग देव के लिए SQLite का उपयोग करते हैं और फिर प्रोड में MySQL परीक्षण करते हैं लेकिन यह एक बहुत ही भयानक विचार की तरह लगता है।

+0

मैं एक mysql_config आदेश उपलब्ध है, यकीन है कि MySQL पुस्तकालयों और हेडर के बारे में नहीं मिल गया है। मैंने एमएएमपी/लाइब्रेरी/बिन को मेरे .profile में जोड़ा और यह मदद करने लग रहा था। अब यह असफल रहा है क्योंकि यह mysql.h नहीं ढूंढ सकता है, जिसे मैं मान रहा हूं पुस्तकालयों/शीर्षकों का हिस्सा हैं? –

उत्तर

1

मैं सिर्फ एक ताजा प्रतिलिपि स्थापित करने समाप्त हो गया MySQL का और एमएएमपी का उपयोग नहीं किया और यह चाल है। 64-बिट संस्करण को स्थापित करने के लिए भी सुनिश्चित होना चाहिए, 32-बिट नहीं।

17

यह ज्यादातर mysql हेडर की कमी के कारण, स्थापित करने के लिए mysql डेवलपर (mysql-devel) पैकेज

आम तौर पर इस त्रुटि जब 'libmysqlclient-देव' पैकेज

  • अगर आप याद आ रही है की बात आती है की कोशिश करो है यदि आप विंडो पर linux try this link
  • पर हैं इस url might help you
+0

यह मुझे काम किया! धन्यवाद! :) –

+1

लिंक मर गए हैं। – Cyclonecode

127

https://github.com/brianmario/mysql2/issues/8

से सिर्फ सांत्वना

sudo apt-get install mysql-client libmysqlclient-dev 

में इस की नकल की और काम किया !!

+2

उबंटू 12.04, अप्रैल 2013 –

+0

पर मेरे लिए काम किया, धन्यवाद! – jpganz18

+0

मेरे लिए भी काम किया। – erik404

0

आप इस थ्रेड Errors Installing mysql2 gem via the Bundler का पालन कर सकते हैं जो Centos के समाधान को बताता है और यह समस्या ठीक हो जाएगी, अगर आप कमांड को tweak करते हैं तो आप अपने ओएस और सफलतापूर्वक mysql2 मणि ​​इंस्टॉल कर सकते हैं।

40

मैं स्थापित करने के लिए इस्तेमाल किया Homebrew for Mac mysql:

brew install mysql 

तब मैं mysql2 मणि ​​स्थापित करने के लिए एक मणि आदेश का प्रयोग किया:

sudo gem install mysql2 
+0

ने यह किया और मुझे अपना त्रुटि संदेश ठीक हो गया। –

0

बस, पथ को MAMP mysql जोड़ने तो आप बंडल स्थापित चला सकते हैं सामान्य के अनुसार।

$/अनुप्रयोग/MAMP/पुस्तकालय/bin/mysql --host = स्थानीय होस्ट -uroot -proot

स्रोत: http://blog-en.mamp.info/2009/08/using-mysql-command-line-with-mamp.html

2

मैं सिर्फ एक ही समस्या में पड़ गए, ओएस एक्स सिएरा और MAMP का उपयोग कर और रेल 5. मैं सफलतापूर्वक के माध्यम से

gem install mysql2 -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config 

उसके बाद मणि स्थापित है, ठीक काम किया स्थापित बंडल।

0

जब मैं यह त्रुटि आई, मैं चलाकर इसे ठीक करने में सक्षम था:

gem install devtools 
संबंधित मुद्दे