簡體   English   中英

Ruby和Mysql2

[英]Ruby and Mysql2

我正在嘗試在本地安裝5年歷史的網站,即1.9.2 Ruby網站。 為此,我需要mysql2 gem文件,但是我經常失敗,並出現錯誤mesasge belove。

Installing mysql2 0.3.20 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/li/.rvm/rubies/ruby-1.9.2-p330/bin/ruby -r ./siteconf20160114-7831-msi06n.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... no
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... no
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting libpath to /usr/lib64/mysql
-----
creating Makefile

make  clean

make
gcc -I. -I/home/li/.rvm/rubies/ruby-1.9.2-p330/include/ruby-1.9.1/x86_64-linux -I/home/li/.rvm/rubies/ruby-1.9.2-p330/include/ruby-1.9.1/ruby/backward -I/home/li/.rvm/rubies/ruby-1.9.2-p330/include/ruby-1.9.1 -I. -I/usr/include/mysql -DHAVE_RUBY_THREAD_H -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_RB_HASH_DUP -DHAVE_RB_INTERN3 -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H    -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -fPIC -Wall -funroll-loops  -o mysql2_ext.o -c mysql2_ext.c
In file included from ./mysql2_ext.h:32:0,
                 from mysql2_ext.c:1:
/usr/include/ruby/thread.h:26:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
 void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
 ^
In file included from ./mysql2_ext.h:41:0,
                 from mysql2_ext.c:1:
./client.h:39:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
 typedef struct {
 ^
Makefile:180: recipe for target 'mysql2_ext.o' failed
make: *** [mysql2_ext.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/li/.rvm/gems/ruby-1.9.2-p330@trafo/gems/mysql2-0.3.20 for inspection.
Results logged to /home/li/.rvm/gems/ruby-1.9.2-p330@trafo/extensions/x86_64-linux/1.9.1/mysql2-0.3.20/gem_make.out

你能幫我一下嗎?

謝謝! 關於該鏈接解決方案,我刪除了ruby,發現安裝了多個版本。 刪除后,一切正常。

我也遇到了這個問題,但是無法刪除系統紅寶石,因為它是在RVM之外使用的。

但是,事實證明,要使此功能正常運行,您需要刪除的只是ruby-devel軟件包。 似乎出於某種原因,當嘗試在RVM中編譯mysql本機擴展時,某些包含的文件是從系統include目錄而不是RVM include目錄中獲取的,從而導致了ruby版本之間的沖突。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM