Cocoapods:US-ASCII中的无效字节序列

时间:2012-11-22 15:13:38

标签: ios6 cocoapods

按步骤一步一步完成: http://www.raywenderlich.com/12139/introduction-to-cocoapods

在不同项目中运行pod install时出错:

### Stack

```
   CocoaPods : 0.15.2
        Ruby : ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
    RubyGems : 1.8.24
        Host : Mac OS X 10.8.2 (12C60)
       Xcode : 4.5.2 (4G2008a)
Ruby lib dir : /usr/local/rvm/rubies/ruby-1.9.3-p194/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 60b51e341f727b7d715ed541ea9cb52f6e0cc819
```

### Podfile

```ruby
          platform :ios, '6.0'
pod 'AFNetworking', '1.0'
```

### Error

```
invalid byte sequence in US-ASCII
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/local_pod.rb:540:in `glob'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/local_pod.rb:540:in `glob'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/local_pod.rb:540:in `block in expanded_paths'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/local_pod.rb:534:in `map'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/local_pod.rb:534:in `expanded_paths'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/local_pod.rb:327:in `readme_file'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/generator/documentation.rb:50:in `index_file'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/generator/documentation.rb:70:in `appledoc_options'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/generator/documentation.rb:81:in `generate'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/installer.rb:91:in `generate_docs'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/installer.rb:60:in `block (2 levels) in install_dependencies!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/user_interface.rb:37:in `section'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/installer.rb:53:in `block in install_dependencies!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/installer.rb:50:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/installer.rb:50:in `install_dependencies!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/installer.rb:119:in `block in install!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/user_interface.rb:37:in `section'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/installer.rb:118:in `install!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/command/install.rb:46:in `run_install_with_update'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/command/install.rb:51:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/lib/cocoapods/command.rb:75:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.15.2/bin/pod:16:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/pod:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/pod:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
```

UPD

➜  ~  gem install cocoapods
zsh: correct 'cocoapods' to '.cocoapods' [nyae]? n
Fetching: xcodeproj-0.4.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for -std=c99 option to compiler... *** 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
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
    from extconf.rb:24:in `block in <main>'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from extconf.rb:23:in `<main>'


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/xcodeproj-0.4.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/xcodeproj-0.4.0/ext/xcodeproj/gem_make.out

3 个答案:

答案 0 :(得分:5)

将导出LC_ALL =“en_US.UTF-8”添加到〜/ .zshrc或〜/ .bashrc https://github.com/CocoaPods/CocoaPods/issues/639

答案 1 :(得分:1)

打开一个新的终端窗口足以解决我的问题。

我的终端实例/会话是如何搞砸的。 pod install 会在新窗口中工作,但在旧窗口中继续失败。

答案 2 :(得分:0)

问题出在Ruby编译器中,它被其他一些应用程序破坏了。 重新安装后一切正常。