ruby - 在 Mac OS X 10.6.4 上安装 iconv gem 真的很费劲

标签 ruby macos rubygems iconv

这是一个真正的麻烦。这是斗争的结果:

checking for iconv() in iconv.h... no
checking for iconv() in -liconv... no

我的命令行是:

sudo gem install iconv

“which iconv”产生:

/opt/local/bin/iconv

我真的不知道上面那些“检查”行是什么意思。为什么 iconv.h 中不存在 iconv()?对我来说没有意义。 iconv.h 位于/opt/local/include。

编辑:

这是 mkmf.log 的输出:

    have_func: checking for iconv() in iconv.h... -------------------- no

    "gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -I/opt/local/bin/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -arch i386 -arch x86_64 -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/opt/local/bin/lib -L. -arch i386 -arch x86_64      -lruby  -lpthread -ldl  "
    Undefined symbols for architecture i386:
      "_libiconv", referenced from:
          _libiconv$non_lazy_ptr in ccF0PUYQ.o
    ld: symbol(s) not found for architecture i386
    collect2: ld returned 1 exit status
    Undefined symbols for architecture x86_64:
      "_libiconv", referenced from:
          _t in cc0k5gYm.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    lipo: can't open input file: /var/tmp//cc3Rrwkf.out (No such file or directory)
    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/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -I/opt/local/bin/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -arch i386 -arch x86_64 -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/opt/local/bin/lib -L. -arch i386 -arch x86_64      -lruby  -lpthread -ldl  "
    conftest.c: In function 't':
    conftest.c:5: error: too few arguments to function 'libiconv'
    conftest.c: In function 't':
    conftest.c:5: error: too few arguments to function 'libiconv'
    lipo: can't figure out the architecture type of: /var/tmp//ccfQKL4Y.out
    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/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -I/opt/local/bin/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -arch i386 -arch x86_64 -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/opt/local/bin/lib -L. -arch i386 -arch x86_64      -lruby -liconv  -lpthread -ldl  "
    Undefined symbols for architecture x86_64:
      "_libiconv", referenced from:
          _t in ccorhTF7.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    lipo: can't open input file: /var/tmp//ccqa9vmd.out (No such file or directory)
    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/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -I/opt/local/bin/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -arch i386 -arch x86_64 -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/opt/local/bin/lib -L. -arch i386 -arch x86_64      -lruby -liconv  -lpthread -ldl  "
    conftest.c: In function 't':
    conftest.c:5: error: too few arguments to function 'libiconv'
    conftest.c: In function 't':
    conftest.c:5: error: too few arguments to function 'libiconv'
    lipo: can't figure out the architecture type of: /var/tmp//cc2UrCWJ.out
    checked program was:
    /* begin */
    1: #include <iconv.h>
    2: 
    3: /*top*/
    4: int main() { return 0; }
    5: int t() { iconv(); return 0; }
    /* end */

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

最佳答案

我在 OS X 10.9.1 上也遇到了这个错误。我的解决方案是重新安装与自制软件一起安装的 libiconv。

关于ruby - 在 Mac OS X 10.6.4 上安装 iconv gem 真的很费劲,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5105976/

相关文章:

macos - Mac : stream a video file as webcam to applications (similar to CamTwist)

ruby - 如何从 `gem` 中获取不在 `lib` 目录下的文件?

ruby-on-rails - 如何使用驼峰键名称从 Rails 返回 JSON

ruby-on-rails - 设计允许对单个 Controller 操作进行 token 身份验证

python-3.x - 无法在Mac 10.14.3中安装python 3.7包Fiona,lxml,pandas,Pillow

Ubuntu 无法识别 Ruby 1.9.1

ruby-on-rails - 我是否必须手动卸载所有依赖的 gem?

ruby - 如何在 cucumber.feature 测试中嵌入 ruby​​ 变量

ruby-on-rails - ruby/rails 根据字符串数组对记录数组进行排序

objective-c - 如何在 Mac OS X 中使用 Storyboard Unwind Segue