복붙노트

[RUBY-ON-RAILS] mysql2 보석을 설치할 수 없습니다

RUBY-ON-RAILS

mysql2 보석을 설치할 수 없습니다

내 Windows7의의 x64 시스템에서 mysql2 보석을 설치할 수 없습니다입니다. 나는 모두에게 MySQL 서버의 32 비트 및 64 비트 버전을 사용하려고했지만 아무도 나에게 더 이상 없어.

루비 1.8, 개발 키트 및 레일 플랫폼을 설치했습니다. 난 것들의 C ++ / C 컴파일을 허용하기는 MinGW를 설치했습니다. MySQL 서버는 기본 위치에 설치되었다.

때 명령을 실행 :

C:\Users\Arne>gem install mysql2 -- --with-mysql-include="C:\Program Files (x86)\MySQL\MySQL Server 5.1\include" --with-mysql-lib="C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib\"

나는 콘솔에서 다음과 같은 출력이 나타납니다 :

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
*** 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:/Ruby/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include=${mysql-dir}/include
        --with-mysql-lib=${mysql-dir}/lib
        --with-libmysqllib
        --without-libmysqllib
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

        C:/Ruby/bin/ruby.exe extconf.rb --with-mysql-include=C:\Program Files (x
86)\MySQL\MySQL Server 5.1\include --with-mysql-lib=C:\Program Files (x86)\MySQL
\MySQL Server 5.1\lib"
checking for rb_thread_blocking_region()... no
checking for main() in -llibmysql... no


Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/mysql2-0.3.2 f
or inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/mysql2-0.3.2/ext/mysql2/gem_mak
e.out

젬 내 환경에있어서의 출력은 다음과 같습니다

C:\Users\Arne>gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.7.2
  - RUBY VERSION: 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: C:/Ruby/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby/lib/ruby/gems/1.8
     - C:/Users/Arne/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

다음 보석뿐만 아니라 시스템에 설치되어 있습니다 :

C:\Users\Arne>gem list --local

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.7)
actionpack (3.0.7)
activemodel (3.0.7)
activerecord (3.0.7)
activeresource (3.0.7)
activesupport (3.0.7)
arel (2.0.9)
builder (3.0.0, 2.1.2)
bundler (1.0.12)
erubis (2.7.0, 2.6.6)
fastthread (1.0.7)
i18n (0.5.0)
mail (2.3.0, 2.2.18)
mime-types (1.16)
mysql (2.8.1 x86-mingw32)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.7.2, 0.6.14)
rack-test (0.5.7)
rails (3.0.7)
railties (3.0.7)
rake (0.8.7)
rdoc (3.5.3, 2.5.11)
rdoc-data (2.5.3)
rubygems-update (1.7.2)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27, 0.3.26)

나는이 없거나 잘못된 건지 모르겠어요,하지만 출력 파일은 스크립트가 다음과 같은 데이터를 포함 가리키는 :

mkmf.log :

have_func: checking for rb_thread_blocking_region()... -------------------- no

"gcc -o conftest -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I.    -g -O2 -DFD_SETSIZE=256    conftest.c  -L. -LC:/Ruby/lib -L.      -lmsvcrt-ruby18-static  -lshell32 -lws2_32  "
conftest.c: In function 't':
conftest.c:7:53: error: 'rb_thread_blocking_region' undeclared (first use in this function)
conftest.c:7:53: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
1: #include <ws2tcpip.h>
2: #include <winsock2.h>
3: #include <windows.h>
4: 
5: /*top*/
6: int main() { return 0; }
7: int t() { void ((*volatile p)()); p = (void ((*)()))rb_thread_blocking_region; return 0; }
/* end */

"gcc -o conftest -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I.    -g -O2 -DFD_SETSIZE=256    conftest.c  -L. -LC:/Ruby/lib -L.      -lmsvcrt-ruby18-static  -lshell32 -lws2_32  "
C:\Users\Arne\AppData\Local\Temp\ccCicaNu.o: In function `t':
C:\Ruby\lib\ruby\gems\1.8\gems\mysql2-0.3.2\ext\mysql2/conftest.c:3: undefined reference to `rb_thread_blocking_region'
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { rb_thread_blocking_region(); return 0; }
/* end */

--------------------

have_library: checking for main() in -llibmysql... -------------------- no

"gcc -o conftest -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I. -IC:\Program    -g -O2 -DFD_SETSIZE=256    conftest.c  -L. -LC:/Ruby/lib -LC:\Program -L.      -lmsvcrt-ruby18-static -llibmysql  -lshell32 -lws2_32  "
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -llibmysql
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include <ws2tcpip.h>
2: #include <winsock2.h>
3: #include <windows.h>
4: 
5: /*top*/
6: int main() { return 0; }
7: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
/* end */

"gcc -o conftest -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I. -IC:\Program    -g -O2 -DFD_SETSIZE=256    conftest.c  -L. -LC:/Ruby/lib -LC:\Program -L.      -lmsvcrt-ruby18-static -llibmysql  -lshell32 -lws2_32  "
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -llibmysql
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { main(); return 0; }
/* end */

--------------------

gem_make.out :

C:/Ruby/bin/ruby.exe extconf.rb --with-mysql-include=C:\Program Files (x86)\MySQL\MySQL Server 5.1\include --with-mysql-lib=C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib"
checking for rb_thread_blocking_region()... no
checking for main() in -llibmysql... no

나는 누군가가 내가 잘못하고있어 무엇을 가리킬 수 있기를 바랍니다, 또는 실제로 내 개발 시스템에없는 것을이 보석이 제대로 설치되어 작동 얻을 수 있습니다.

해결법

  1. ==============================

    1.나는 마지막으로 그것을 해결 :

    나는 마지막으로 그것을 해결 :

    이제 매력으로 일하고있다. MySQL의 보석은 64 비트를 처리 할 때 데이터를 찾는 문제가 보인다.

  2. ==============================

    2.Win7에 64 / MySQL을 5.5 64 비트 / 루비 1.9.2를 : 여기에 사용 나를 위해 일한 내용은 다음과 같습니다

    Win7에 64 / MySQL을 5.5 64 비트 / 루비 1.9.2를 : 여기에 사용 나를 위해 일한 내용은 다음과 같습니다

    gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include" --with-mysql-dir="c:\Program Files\MySQL\MySQL Server 5.5"'
    

    행운을 빕니다.

  3. ==============================

    3.여전히 오류가 있다면 십자가에서 설치 단계를 확인 -

    여전히 오류가 있다면 십자가에서 설치 단계를 확인 -

    http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html

    여기서 사용자의 대부분이 설명 된 단계를 수행 한 후 mysql2 보석을 설치 할 수 있었다.

  4. ==============================

    4.허용 대답은 나를 위해 작동하지 않았고, 그러나 다른 2. 않았다하지도, Ritesh에서 링크 MG에 의해 코멘트는 나를 위해 트릭을했다. 나는 버전 0.2.6을 지정하고 매개 변수 --platform = 루비를 포함했다. (참고 : 나는 또한 / lib 디렉토리 / 옵션 얻기 위해 MySQL을의 "noinstall"버전을 다운로드했다)

    허용 대답은 나를 위해 작동하지 않았고, 그러나 다른 2. 않았다하지도, Ritesh에서 링크 MG에 의해 코멘트는 나를 위해 트릭을했다. 나는 버전 0.2.6을 지정하고 매개 변수 --platform = 루비를 포함했다. (참고 : 나는 또한 / lib 디렉토리 / 옵션 얻기 위해 MySQL을의 "noinstall"버전을 다운로드했다)

    여기에 내가 윈도우에 설치된 보석을 가지고 어떻게

    gem install mysql2 -v 0.2.6 -- --platform=ruby --with-mysql-lib=C:\Ruby192\MySQL\lib\opt --with-mysql-dir=C:\Ruby192\MySQL
    
  5. ==============================

    5.나는 스레드가 윈도우에 관련되어 알고 있지만 나는 그것이 리눅스에서 같은 문제에 대한 검색 도달하고 난 LIB "libmysqlclient-DEV"를 설치하여 고정

    나는 스레드가 윈도우에 관련되어 알고 있지만 나는 그것이 리눅스에서 같은 문제에 대한 검색 도달하고 난 LIB "libmysqlclient-DEV"를 설치하여 고정

  6. ==============================

    6.나는 64 비트 Windows 7에 여기에 주어진 일 주요 솔루션에서의 MySQL 5.6과 비슷한 문제가 있었다. (단지 DLL을 복사 kobalz가 제시 한 솔루션은 kobalz 위해하지만 나를 위해 작동하는 이유 일. 아니 생각하지 않았다!)

    나는 64 비트 Windows 7에 여기에 주어진 일 주요 솔루션에서의 MySQL 5.6과 비슷한 문제가 있었다. (단지 DLL을 복사 kobalz가 제시 한 솔루션은 kobalz 위해하지만 나를 위해 작동하는 이유 일. 아니 생각하지 않았다!)

    그때 나는이 게시물에 설명되어있는 또 다른 문제로 실행 :

    mysql2 보석 잘못 mysql 클라이언트 라이브러리 컴파일

    이 솔루션은 완전한 32 비트 MySQL과 고정 두 문제를 다운로드가 피할 설명했다. 본질적으로, MySQL의 커넥터 (훨씬 작은 다운로드) 다운로드하고 mysql2 보석을 컴파일하는 것을 사용한다. 포스트에 설명 된대로 정확히 올바른 버전을 다운로드해야합니다. 나의 경우에는:

    http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick

    상기 한 바와 같이 다음 루비 bin 디렉토리에 거기에서 lib 디렉토리 \ libmysql.dll을 파일을 복사합니다.

    전 C에 내 커넥터를 넣어 : \ MySQL의 커넥터-C-noinstall-6.0.2-는 Win32를

    그래서 보석을 구축하고 설치하는 명령했다 :

    --with-mysql을-포함 = "C : \ MySQL의 커넥터-C : ="\ MySQL의 커넥터-C-noinstall-6.0.2-win32에서 \ lib 디렉토리 C "--with-mysql을 lib 디렉토리 - 보석 mysql2 설치 \ MySQL을 커넥터 C-noinstall-6.0.2-Win32에서 "-noinstall-6.0.2-는 Win32는 \"--with-MySQL을 DIR = "C 포함

    그때 내가 마이그레이션을 수행하는 레이크을 실행할 때 더 문제로 실행,하지만 난 (안 mysql2) MySQL의 보석을 사용하고있었습니다 내가 내 database.yml을을 업데이트 잊어했기 때문에였습니다. mysql2 보석, 그것은 말할 필요가있다 :

    개발:     어댑터 : mysql2

    보다는

    개발:     어댑터 : MySQL은

    이는 당신이 그것을 알아 냈어요,하지만 여전히 내 보석에 뭔가 잘못이있는 것처럼 그것이 보였다 그래서 내가 가진 오류 메시지가, 내가 전에 얻은 것과 비슷하면 분명하다.

  7. ==============================

    7.MariaDB 5.5 설치를 위해 나를 위해 일한이 하나

    MariaDB 5.5 설치를 위해 나를 위해 일한이 하나

    보석 mysql2를 설치 - '--with-mysql을-LIB = "C : \의 Program Files (x86) \ MariaDB 5.5 \ lib 디렉토리는"--with-mysql을-포함 = "C : \의 Program Files (x86) \ MariaDB 5.5 \ 포함 \ mysql을 "을 '

    네이티브 확장 구축 '--with-mysql을-LIB = "C : \의 Program Files (x86) \ 마리아 \ \ Program 파일 (x 86) \ MariaDB 5.5 포함 \ MYS을 : DB 5.5 \ lib 디렉토리 C "--with-mysql을-포함 =" QL " '

    루비 64을 사용하려는 경우 64 MariaDB 패키지를 사용하십시오. 물론, C를 복사하는 것을 잊지 마세요 : \의 Program Files (x86) \ MariaDB 5.5 \ lib 디렉토리 \ libmysql.dll을 C로 : 내 경우에는 \ Ruby200 \ 빈.

  8. ==============================

    8.당신의 MySQL의 bin 디렉토리에있는 libmysql.dll을 복사하여 루비 설치의 bin 디렉토리에 설치합니다. 광산은 C에 위치했다 : \ 프로그램 파일 \ MySQL과 C : \ 루비.

    당신의 MySQL의 bin 디렉토리에있는 libmysql.dll을 복사하여 루비 설치의 bin 디렉토리에 설치합니다. 광산은 C에 위치했다 : \ 프로그램 파일 \ MySQL과 C : \ 루비.

  9. ==============================

    9.이 8 64 비트 윈도우에 나를 위해 일한 루비 64 비트를 사용하는 것입니다

    이 8 64 비트 윈도우에 나를 위해 일한 루비 64 비트를 사용하는 것입니다

    다운로드 MYSQL 서버에게 5.6 64 비트를 설치

    다음 명령을 실행합니다 :

    보석 mysql2 -v '0.3.16'를 설치 - '--with-mysql을-LIB = "C : \ 프로그램 파일 \ MySQL은 \ MySQL 서버 5.6 \ lib 디렉토리는"--with-mysql을-포함 = "C : \ 프로그램 파일 \ MySQL은 \ MySQL은 서버 5.6 ' "를 포함 \

    도움이 되었기를 바랍니다

  10. from https://stackoverflow.com/questions/5841406/cannot-install-mysql2-gem by cc-by-sa and MIT license