ffi: LoadError: code signature in (ffi-1.13.1/lib/ffi_c.bundle) not valid for use in process using Library Validation

Hi guys,

I’m really hoping someone can help me - I’ve spent the last few hours trying to fix this, trying all the web-suggested solutions like unlinking and re-linking cocoapods, pristining FFI, reinstalling it compeltely, etc.

Whenever I run a pod command, in particular I’m currently running pod repo update I get the following error.

Command

/Applications/MAMP/Library/bin/pod repo update

Report

  • What did you do? Ran any pod command which uses FFI

  • What did you expect to happen? The command should complete successfully

  • What happened instead? The error below

Stack

   CocoaPods : 1.10.0
        Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin14]
    RubyGems : 2.5.2.3
        Host : Mac OS X 10.15.7 (19H2)
       Xcode : 12.1 (12A7403)
         Git : git version 2.26.2
Ruby lib dir : /Applications/MAMP/Library/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Error

LoadError - dlopen(/Users/me/.rvm/gems/ruby-2.6.3/gems/ffi-1.13.1/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
	/Users/me/.rvm/gems/ruby-2.6.3/gems/ffi-1.13.1/lib/ffi_c.bundle: code signature in (/Users/me/.rvm/gems/ruby-2.6.3/gems/ffi-1.13.1/lib/ffi_c.bundle) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?) - /Users/me/.rvm/gems/ruby-2.6.3/gems/ffi-1.13.1/lib/ffi_c.bundle
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/me/.rvm/gems/ruby-2.6.3/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
/Users/me/.rvm/gems/ruby-2.6.3/gems/ffi-1.13.1/lib/ffi.rb:3:in `<top (required)>'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/me/.rvm/gems/ruby-2.6.3@global/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/me/.rvm/gems/ruby-2.6.3@global/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:78:in `deprecated_local_podspecs'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:60:in `preheat_existing_files'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:257:in `update'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:135:in `block (3 levels) in update'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:134:in `block (2 levels) in update'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:133:in `each'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:133:in `block in update'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:131:in `open'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:131:in `update'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/command/repo/update.rb:23:in `run'
/Users/me/.rvm/gems/ruby-2.6.3@global/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/Applications/MAMP/Library/bin/pod:22:in `load'
/Applications/MAMP/Library/bin/pod:22:in `<main>'

The issue seems to be with FFI rather than CocoaPods, because other commands (like pod install don’t throw up this error).

Thanks in advance

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 2
  • Comments: 23 (4 by maintainers)

Most upvoted comments

@crose-88 need to say that i am not an expert in ffi, but we did such steps:

Software: MacOS latest, MAMP PRO, MAMP has ruby’s version 2.7.3

  1. install rbenv

  2. installed ruby’s version 3.0.0

  3. switched ruby globally to 3.0.0

  4. removed checkbox in MAMP -> Ruby section, which says something like 'use ruby in command line ...'. this item inserts aliases into .profile-file

  5. added export and alias into .profile

    export PATH="/<user home>/.rbenv/shims:$PATH"

    alias pod='/<user home>/.rbenv/shims/pod'
  1. then we run command gem install cocoapods (but i am not sure it is required in all cases)

@jcush @larskanis I am getting the exact same error when trying to run pod install. I have also tried manually signing ffi (I was receiving the error as well before signing anything), reinstalling completely, pristining ffi and all gems.

I have almost the exact same environment and stack trace, I can provide it if needed.

If this is not an issue with FFI, can you advise how this may be handled?

In case of Apple M1 try to execute $arch -x86_64 gem install ffi and reinstall ffi. Don’t forget install rossetta

Yes, it was actually @lon9man who emailed me and the above steps he’s posted worked for me!

@larskanis there are now more users above experiencing this issue - what are the next steps for finding out the problem? It’s clear this isn’t an isolated incident now.

Additionally, I noticed @oleg-moseyko has MAMP installed like I do, so I wonder if @moodwrench also does? Could maybe look to find some common factors here

Did you try gem inst ffi -- --enable-system-libffi or --disable-system-libffi? Maybe one of these works.

In case of --disable-system-libffi the ffi-builtin libffi is used. It is built by this makefile: https://github.com/ffi/ffi/blob/2b44904f8323dcad3eaa978c1fd2b5298bd04663/ext/ffi_c/libffi.darwin.mk

In case of --enable-system-libffi only the extconf.rb is in action: https://github.com/ffi/ffi/blob/2b44904f8323dcad3eaa978c1fd2b5298bd04663/ext/ffi_c/extconf.rb

Sorry I can not help more. I don’t have a Mac and I’m not familiar with this OS. But if someone comes up with a patch, I’m happy to integrate it!