我刚刚安装了Ruby EE 11.01。我有一个在Apache2上针对Passenger 3.0.2运行的Rails 2.3.8应用程序。现在,我的申请不会出现。错误是:
no such file to load -- iconv
我使用的是Mac OS X 10.6.4。我安装了Ruby EE:
sudo ./installer -c --with-openssl-dir=/opt/local -c --with-readline-dir=/opt/local -c --with-iconv-dir=/opt/local
“which iconv”产生:
/opt/local/bin/iconv
尝试安装gem iconv产生:
Building native extensions. This could take a while...
ERROR: Error installing iconv:
ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2011.01/bin/ruby extconf.rb
checking for iconv() in iconv.h... no
checking for iconv() in -liconv... 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.
我的iconv路径在安装行中出错了吗?救命啊!
编辑:
查看上面的日志文件,我看到了:
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))iconv; return 0; }
/* end */
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -ldl -lobjc "
conftest.c: In function 't':
conftest.c:5: error: too few arguments to function 'libiconv'
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { iconv(); return 0; }
/* end */
--------------------
have_library: checking for iconv() in -liconv... -------------------- no
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -liconv -ldl -lobjc "
Undefined symbols:
"_libiconv", referenced from:
_t in ccxx7BhR.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))iconv; return 0; }
/* end */
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -liconv -ldl -lobjc "
conftest.c: In function 't':
conftest.c:5: error: too few arguments to function 'libiconv'
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { iconv(); return 0; }
/* end */
--------------------
答案 0 :(得分:2)
我强烈建议在Mac OS上使用RVM。它非常容易安装,它使用readline,iconv,openssl,zlib等处理下载和编译环境。我无法告诉你它节省了多少小时。
http://rvm.beginrescueend.com/
回到你的问题 - 你试过gem install iconv -- --with-iconv-dir=/opt/local
吗?