Sqlite3 导致捆绑安装和 gem 安装出现问题
使用 Rails,每当我尝试执行“bundle install”或 sudo gem install someGem 之类的操作时,我都会收到有关 sqlite3 的这些相同错误。我都尝试过
sudo port install sqlite3 +universal
,
sudo port install rb-sqlite3 +universal
但都没有帮助。这是错误:
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
更新: 我找到了 mkmf.log 文件,以下是其内容:
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 */
--------------------
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 */
--------------------
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
弄清楚了:
“which -a ruby”和“which -a
sqlite3”和“which -a gem”
意识到我有两三个版本
每个
手动卸载其他版本sqlite3 不一样
路径为 Ruby 和 Rubygems
一旦 Ruby、Rubygems 和 Sqlite3 都处于同一浴中
(usr/bin) 一切又恢复正常了。
Figured it out:
Did "which -a ruby" and "which -a
sqlite3" and "which -a gem" to
realize I had two or three versions
of each
Use port to uninstall all the versions of Ruby, Sqlite3, and rubygems it had installed
Manually uninstall the other sqlite3 that was not along the same
path as Ruby and Rubygems
Once Ruby, Rubygems, and Sqlite3 were all along the same bath
(usr/bin) it all works fine again.