Sqlite3导致bundle安装和gem安装出现问题 [英] Sqlite3 causing problems for bundle install and gem install

查看:154
本文介绍了Sqlite3导致bundle安装和gem安装出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Rails,每当我尝试执行bundle install或sudo gem install someGem等任何操作时,我都会得到关于sqlite3的相同错误。我已经尝试了两种方式:

  sudo port install sqlite3 + universal 


$ b $ pre $ sudo port install rb-sqlite3 + universal

但都没有帮助。这是错误:

  cmu-435163:photoGlass dpieri $ sudo gem install taps 
密码:
构建原生扩展。
这可能需要一段时间...
错误:安装水龙头时出错:
错误:未能构建gem本机扩展。

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
检查sqlite3.h ...是
检查sqlite3_libversion_number()在-lsqlite3 ...没有
sqlite3缺失。试试'port install sqlite3 + universal'
或'yum install sqlite3-devel'并检查你的共享库搜索路径(sqlite3共享库所在的
位置)。
*** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少必要的库和/或头文件。
检查mkmf.log文件以获取更多详细信息。
您可能需要配置选项。

提供的配置选项:
--with-opt-dir
--without-opt-dir
--with-opt-include
- -without-opt-include = $ {opt-dir} / include
--with-opt-lib
....

....
Gem文件将保持安装在/Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3中进行检查。结果记录到/Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out

UPDATE:
我找到了mkmf.log文件,这里是它的内容:

  find_header :检查sqlite3.h ... 
--------------------是

gcc -E -I。
-I / System / Library / Frameworks / Ruby.framework / Versions / 1.8 / usr / lib / ruby​​ / 1.8 / universal-darwin10.0
-I。-I / usr / local / include -I / opt / local / include -I / sw / local / include -I / usr / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c - o conftest.ichecked program is:/ * begin * / 1:#include< sqlite3.h> / *结束* /

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

find_library:检查$中的sqlite3_libversion_number() b $ b -lsqlite3 ... -------------------- no

gcc -o conftest -I。
- I / System / Library / Frameworks / Ruby.framework / Versions / 1.8 / usr / lib / ruby​​ / 1.8 / universal-darwin10.0
-I。-I / usr / local / include -I / opt / local / include -I / sw / local / include -I / usr / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L。-L /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib
-L ​​/ usr / local / lib -L ​​/ opt / local / lib -L ​​/ sw / local / lib -L ​​/ usr / lib -L。-lruby -lsqlite3 -lpthread -ldlconftest.c:在函数't'中:conftest.c:3:错误:'sqlite3_libversion_number'未声明(在此函数中首次使用)conftest.c:3:错误:(每个未声明的标识符只报告一次conftest.c:3:错误:对于它出现的每个函数)检查的程序是:/ * begin * / 1:/ * top * / 2:int main(){return 0 ; } 3:int t(){void((* volatile p)()); p =(void((*)()))sqlite3_libversion_number;返回0; } / * end * /

gcc -o conftest -I。
-I / System / Library / Frameworks / Ruby.framework / Versions / 1.8 / usr / lib / ruby​​ / 1.8 /universal-darwin10.0
-I。-I / usr / local / include -I / opt / local / include -I / sw / local / include -I / usr / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g - os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L。-L / System / Library / Frameworks / Ruby.framework / Versions / 1.8 / usr / lib
- L / usr / local / lib -L ​​/ opt / local / lib -L ​​/ sw / local / lib -L ​​/ usr / lib -L。-lruby -lsqlite3 -lpthread -ldlld:warning:directory'/ sw / local / lib'-L未找到ld:warning:在/usr/local/lib/libsqlite3.dylib文件中缺少必需的体系结构x86_64未定义的符号:_sqlite3_libversion_number,引用自:
cc在ccSWkK1V.o中ld:symbol(s)not found collect2:ld returned 1 exit status checked program is:/ * begin
* / 1:/ * top * / 2:int main(){return 0; } 3:int t(){sqlite3_libversion_number();返回0; } / * end * /

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

解决方案

p>哪一个 - 一个红宝石和哪一个-a $ b $ sqlite3和哪一个宝石到
意识到我有两个或三个版本每个


  • 使用端口卸载已安装的所有Ruby,Sqlite3和rubygems版本 手动卸载另一个与Ruby和Rubygems不同的
    路径的sqlite3一旦Ruby,Rubygems和Sqlite3一直在同一个浴室中

  • b $ b(usr / bin)一切正常。



  • Using Rails, whenever I try to do anything like "bundle install" or sudo gem install someGem, I get these same errors about sqlite3. I've tried both

    sudo port install sqlite3 +universal
    

    and

    sudo port install rb-sqlite3 +universal
    

    But neither has helped. Here is the error:

    cmu-435163:photoGlass dpieri$ sudo gem install taps 
    Password: 
    Building native extensions.  
    This could take a while... 
    ERROR:  Error installing taps:  
        ERROR: Failed to build gem native extension.
    
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
    checking for sqlite3.h... yes 
    checking for sqlite3_libversion_number() in -lsqlite3... no 
    sqlite3 is missing. Try 'port install sqlite3 +universal' 
    or 'yum install sqlite3-devel' and check your shared library search path (the 
    location where your sqlite3 shared library is located).
    *** 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 
    ....
    
    ....
    Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
    

    UPDATE: I found the mkmf.log file and here are its contents:

    find_header: checking for sqlite3.h...
    -------------------- yes
    
    "gcc -E -I.
    -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
    -I. -I/usr/local/include -I/opt/local/include -I/sw/local/include -I/usr/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE    -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    conftest.c -o conftest.i" checked program was: /* begin */ 1: #include <sqlite3.h> /* end */
    
    --------------------
    
    find_library: checking for sqlite3_libversion_number() in
    -lsqlite3... -------------------- no
    
    "gcc -o conftest -I.
    -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
    -I. -I/usr/local/include -I/opt/local/include -I/sw/local/include -I/usr/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE    -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib
    -L/usr/local/lib -L/opt/local/lib -L/sw/local/lib -L/usr/lib -L.       -lruby -lsqlite3  -lpthread -ldl  " conftest.c: In function ‘t’: conftest.c:3: error: ‘sqlite3_libversion_number’ undeclared (first use in this function) conftest.c:3: error: (Each undeclared identifier is reported only once conftest.c:3: error: for each function it appears in.) checked program was: /* begin */ 1: /*top*/ 2: int main() { return 0; } 3: int t() { void ((*volatile p)()); p = (void ((*)()))sqlite3_libversion_number; return 0; } /* end */
    
    "gcc -o conftest -I.
    -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
    -I. -I/usr/local/include -I/opt/local/include -I/sw/local/include -I/usr/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE    -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib
    -L/usr/local/lib -L/opt/local/lib -L/sw/local/lib -L/usr/lib -L.       -lruby -lsqlite3  -lpthread -ldl  " ld: warning: directory '/sw/local/lib' following -L not found ld: warning: in /usr/local/lib/libsqlite3.dylib, missing required architecture x86_64 in file Undefined symbols:   "_sqlite3_libversion_number", referenced from:
          _t in ccSWkK1V.o ld: symbol(s) not found collect2: ld returned 1 exit status checked program was: /* begin
    */ 1: /*top*/ 2: int main() { return 0; } 3: int t() { sqlite3_libversion_number(); return 0; } /* end */
    
    --------------------
    

    解决方案

    Figured it out:

    1. Did "which -a ruby" and "which -a sqlite3" and "which -a gem" to realize I had two or three versions of each

    2. Use port to uninstall all the versions of Ruby, Sqlite3, and rubygems it had installed

    3. Manually uninstall the other sqlite3 that was not along the same path as Ruby and Rubygems

    4. Once Ruby, Rubygems, and Sqlite3 were all along the same bath (usr/bin) it all works fine again.

    这篇关于Sqlite3导致bundle安装和gem安装出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆