1

我刚刚安装了 Ruby EE 11.01。我有一个 Rails 2.3.8 应用程序在 Apache2 上针对乘客 3.0.2 运行。现在,我的应用程序不会出现。错误是:

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

“哪个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 */

    --------------------
4

1 回答 1

2

我强烈推荐在 Mac OS 上使用 RVM。它非常易于安装,它使用 readline、iconv、openssl、zlib 等处理下载和编译环境。我无法告诉你它为我节省了多少小时。

http://rvm.beginrescueend.com/

回到你的问题——你试过了gem install iconv -- --with-iconv-dir=/opt/local吗?

于 2011-02-13T03:37:05.703 回答