Search code examples
rubyrubygemscocoapods

run pod command generate ruby error: Symbol not found: _ffi_type_double


I use rvm install ruby and then use gem install cocoapods ,bug run pod command always raise error:

 /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/stanhu/.rvm/gems/ruby-2.4.6/gems/ffi-1.12.2/lib/ffi_c.bundle, 9): Symbol not found: _ffi_type_double (LoadError)
  Referenced from: /Users/stanhu/.rvm/gems/ruby-2.4.6/gems/ffi-1.12.2/lib/ffi_c.bundle
  Expected in: flat namespace
 in /Users/stanhu/.rvm/gems/ruby-2.4.6/gems/ffi-1.12.2/lib/ffi_c.bundle - /Users/stanhu/.rvm/gems/ruby-2.4.6/gems/ffi-1.12.2/lib/ffi_c.bundle
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/gems/ruby-2.4.6/gems/ffi-1.12.2/lib/ffi.rb:6:in `rescue in <top (required)>'
    from /Users/stanhu/.rvm/gems/ruby-2.4.6/gems/ffi-1.12.2/lib/ffi.rb:3:in `<top (required)>'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/gems/2.4.0/gems/typhoeus-1.3.1/lib/typhoeus.rb:2:in `<top (required)>'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.0/lib/cocoapods/sources_manager.rb:5:in `<top (required)>'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.0/lib/cocoapods/core_overrides.rb:1:in `<top (required)>'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.0/lib/cocoapods.rb:75:in `<module:Pod>'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.0/lib/cocoapods.rb:17:in `<top (required)>'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.0/bin/pod:36:in `<top (required)>'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/bin/pod:23:in `load'
    from /Users/stanhu/.rvm/rubies/ruby-2.4.6/bin/pod:23:in `<main>'
    from /Users/stanhu/.rvm/gems/ruby-2.4.6/bin/ruby_executable_hooks:24:in `eval'
    from /Users/stanhu/.rvm/gems/ruby-2.4.6/bin/ruby_executable_hooks:24:in `<main>'

the path and the version as blew:

Stans-MacBook-Pro:WorkProject stanhu$ which ruby

/Users/stanhu/.rvm/rubies/ruby-2.4.6/bin/ruby

Stans-MacBook-Pro:WorkProject stanhu$ which pod

/Users/stanhu/.rvm/rubies/ruby-2.4.6/bin/pod

Stans-MacBook-Pro:WorkProject stanhu$ ruby --version

ruby 2.4.6p354 (2019-04-01 revision 67394) [x86_64-darwin19]

and the ffi library also installed:

Stans-MacBook-Pro:WorkProject stanhu$ gem install ffi

Fetching ffi-1.12.2.gem

Building native extensions. This could take a while...

Successfully installed ffi-1.12.2

Parsing documentation for ffi-1.12.2

Installing ri documentation for ffi-1.12.2

Done installing documentation for ffi after 26 seconds

1 gem installed

does anyone know this issue?


Solution

  • the solution link:github solution link

    $ gem uninstall ffi
    
    You have requested to uninstall the gem:
        ffi-1.12.2
    
    ethon-0.12.0 depends on ffi (>= 1.3.0)
    
    
    Successfully uninstalled ffi-1.12.2
    
    $ brew reinstall libffi
    
    
    For compilers to find libffi you may need to set:
      export LDFLAGS="-L/usr/local/opt/libffi/lib"
    
    For pkg-config to find libffi you may need to set:
      export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
    
    
    $ export LDFLAGS="-L/usr/local/opt/libffi/lib"
    
    $ export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
    
    $ gem install ffi
    
    $ pod
    
    Usage:
    
        $ pod COMMAND
    
          CocoaPods, the Cocoa library package manager.
    

    It worked, very nice