ffi / ffi

Ruby FFI
https://github.com/ffi/ffi/wiki
BSD 3-Clause "New" or "Revised" License
2.08k stars 334 forks source link

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

Open jcush opened 3 years ago

jcush commented 3 years ago

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

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

jcush commented 3 years ago

This error started appearing after fixing a previous issue by running the following command:

sudo codesign -f -s - /Users/me/.rvm/gems/ruby-2.6.3/gems/ffi-1.13.1/lib/ffi_c.bundle

This command was required to suppress the following error which was cropping up for hours on end:

/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/me/.rvm/gems/ruby-2.6.3@global/gems/ffi-1.13.1/lib/ffi_c.bundle, 9): no suitable image found.  Did find: (LoadError)
    /Users/me/.rvm/gems/ruby-2.6.3@global/gems/ffi-1.13.1/lib/ffi_c.bundle: code signature in (/Users/me/.rvm/gems/ruby-2.6.3@global/gems/ffi-1.13.1/lib/ffi_c.bundle) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. - /Users/me/.rvm/gems/ruby-2.6.3@global/gems/ffi-1.13.1/lib/ffi_c.bundle
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/ffi-1.13.1/lib/ffi.rb:3:in `<top (required)>'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/cocoapods-1.9.3/lib/cocoapods/sources_manager.rb:5:in `<top (required)>'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/cocoapods-1.9.3/lib/cocoapods/core_overrides.rb:1:in `<top (required)>'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/cocoapods-1.9.3/lib/cocoapods.rb:75:in `<module:Pod>'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/cocoapods-1.9.3/lib/cocoapods.rb:17:in `<top (required)>'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
    from /Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from /Users/me/.rvm/gems/ruby-2.6.3@global/gems/cocoapods-1.9.3/bin/pod:36:in `<top (required)>'
    from /Applications/MAMP/Library/bin/pod:22:in `load'
    from /Applications/MAMP/Library/bin/pod:22:in `<main>'

This suggests to me that the solution to the unsigned FFI bundle may not have been to manually sign it? If not, please advise on this error instead

Thanks

larskanis commented 3 years ago

Code signing and verification is a feature of the operating system. I don't think ffi can do anything to better support this. Sorry for being unable to help in a more specific way!

jcush commented 3 years ago

@larskanis The error I mentioned in my last comment was appearing before I code-signed anything. Can you please take another look? It's only ever this library and doesn't happen with any others

fordchristopher commented 3 years ago

@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?

jcush commented 3 years ago

@larskanis It seems it's not just me - can you please confirm how this will be handled or should I instead open up a new issue referencing this one?

jcush commented 3 years ago

@larskanis To be clear, I think the main issue here is this:

https://github.com/ffi/ffi/issues/836#issuecomment-723453108

The Team ID problem only came about after manually signing FFI to try and avoid the existing issue. The problem I mentioned in the linked comment is the main issue and it appears with no other gems/libraries so I reckon it is an FFI issue

larskanis commented 3 years ago

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!

jcush commented 3 years ago

Hi @larskanis,

Thank you for your help so far. This is definitely an FFI issue - see CocoaPods' own response to someone who opened the same issue on the CocoaPods repo: https://github.com/CocoaPods/CocoaPods/issues/9941

Unfortunately we can't just keep bouncing between CocoaPods, you and Apple otherwise this will never get fixed. It's prevented any build of this particular app (which is obviously causing a lot of problems internally) for over a month now so please dive into why the signature for ffi-1.13.1/lib/ffi_c.bundle isn't valid.

When I ran your suggested commands, here's what i get..

enable-system-libffi image

Seems good, until pod install --repo-update is run (I need --repo-update as this has now taken long enough that certain pods have fallen out of date):

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 cdhash, completely unsigned? Code has to be at least ad-hoc signed. - /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/installer/analyzer.rb:145:in `block in update_repositories'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143:in `each'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143:in `update_repositories'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/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/installer.rb:234:in `resolve_dependencies'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52: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>'

disable-system-libffi image

Again, all good until pod install --repo-update:

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 cdhash, completely unsigned? Code has to be at least ad-hoc signed. - /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/installer/analyzer.rb:145:in `block in update_repositories'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143:in `each'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143:in `update_repositories'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/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/installer.rb:234:in `resolve_dependencies'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Users/me/.rvm/gems/ruby-2.6.3/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52: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>'

Seems like the same error both times!

I have zero knowledge of FFI, Ruby, gems, or anything like it. I'm only just finding out about Pods now, so I will appreciate you using your advanced knowldge of the above to assist here. You will know where to look in the FFI code whereas I wouldn't, so while I'd like to say I could help with a patch, I have no idea of Ruby code so I can only help by testing possible solutions out.

Things which might help you investigate:

In case it helps, since you said you're not familiar with the OS, reaching out to Apple I was able to collate the following resources about code signing:

Being a fellow developer, I understand the frustrations associated with issues that are hard to reproduce, but please empathise with us in that CocoaPods have pointed to FFI being the issue, Apple is a big corporation which can't be expected to have the time to address individuals' issues all the time (and will likely end up seeing the error output and saying "that's an FFI issue") and we're currently getting nowhere :-(

Again, I really, really appreciate you helping so please try and work with us on this!

Many thanks

James

larskanis commented 3 years ago

@jcush Could you try a different gem with a shared library like so?

$ gem inst bcrypt
$ ruby -rbcrypt -e "p BCrypt::Password.create('x')"

Background is that gem inst ffi --enable-system-libffi doesn't use any special build process and so other gems should be similar affected by the code signing issue.

jcush commented 3 years ago

Hi @larskanis

The issue only occurs when I run pod commands so I don't believe running your code above will trigger the error as there is no pod process being called?

Thanks

larskanis commented 3 years ago

@jcush Looking a second time at your stack traces I noticed this great mixture of two ruby instances. There is the MAMP application with ruby-2.3 and rvm with ruby 2.6. This can not work!

Maybe you can prefer the rvm installation by something like:

export PATH=~/.rvm/gems/ruby-2.6.3/bin/:$PATH

But in any case you should clean up your PATH.

jcush commented 3 years ago

Hi @larskanis

Thank you for looking over the traces again πŸ™‚

I will resolve the Ruby mismatch and will come back to you

Thanks

jcush commented 3 years ago

Hi @larskanis

First things first, could you please re-open this issue until it should actually be closed please? It seems GitHub doesn't alert me of some things for closed issues.

Next, I looked into the mixed-version issue. It doesn't seem to be the cause, but regardless I went in and fixed the path so that the RVM locations were on it, however it would still switch to 2.3.0 until the gem inclusion process (when it suddenly starts using v2.6.3 for some reason). I'm not sure why this version mismatch persisted (again, I know nothing about Ruby's internal processors or anything), so I simply removed v2.6.3. Upon running pod install --repo-update again, I get the same issue:

lopen(/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.13.1/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
    /Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.13.1/lib/ffi_c.bundle: code signature in (/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.13.1/lib/ffi_c.bundle) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. - /Applications/MAMP/Library/lib/ruby/gems/2.3.0/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'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/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'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/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'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/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'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:78:in `deprecated_local_podspecs'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:60:in `preheat_existing_files'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:257:in `update'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:135:in `block (3 levels) in update'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:134:in `block (2 levels) in update'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:133:in `each'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:133:in `block in update'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:131:in `open'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:131:in `update'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:145:in `block in update_repositories'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143:in `each'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:143:in `update_repositories'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/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>'

So it's not the mismatch issue. Assuming there isn't some sort of broken compatability with v2.3.0 I guess we should proceed assuming that's the version for now. I've read somewhere you can use something called rbenv to set environments for running commands against specific versions only, but for now I think one version of the unknown system is enough for me! haha

What's next?

Thanks

PS: I have checked and the file referenced (/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.13.1/lib/ffi_c.bundle) definitely exists, so it seems the file is just not signed correctly

jcush commented 3 years ago

Hi @larskanis,

What should we do next to try and debug this?

Thanks

moodwrench commented 3 years ago

same issue with ffi 1.14.2

Failure/Error: require 'ffi_c'

LoadError:
  dlopen(/Users/xxx/.chefdk/gem/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
    /Users/xxx/.chefdk/gem/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle: code signature in (/Users/xxx/.chefdk/gem/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. - /Users/xxx/.chefdk/gem/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle
# --- Caused by: ---
# LoadError:
#   cannot load such file -- 2.6/ffi_c
#   /Users/xxx/.chefdk/gem/ruby/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:4:in `<top (required)>'

note.. using ruby 2.6.6 which is installed with the newest chefdk 4.13.3 when calling rspec. Problem started happening when upgrading chefdk which upgraded ruby from 2.5.7 to 2.6.6

oleg-moseyko commented 3 years ago

$ rm -rf ~/Library/Caches/CocoaPods && rm -rf Pods && rm -rf ~/Library/Developer/Xcode/DerivedData/* && cd ios && pod deintegrate && pod setup && pod install && cd .. Deintegrating ImageLockerMobile.xcodeproj Removing Pods directory.

Project has been deintegrated. No traces of CocoaPods left in project. Note: The workspace referencing the Pods project still remains. Setup completed Auto-linking React Native modules for target ImageLockerMobile: RNCAsyncStorage, RNDeviceInfo, RNFastImage, RNGestureHandler, RNImageCropPicker, RNPermissions, RNReanimated, RNSVG, RNScreens, react-native-config, react-native-image-picker, and react-native-netinfo Analyzing dependencies Fetching podspec for DoubleConversion from ../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec Fetching podspec for Folly from ../node_modules/react-native/third-party-podspecs/Folly.podspec Fetching podspec for glog from ../node_modules/react-native/third-party-podspecs/glog.podspec

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Command

/usr/local/bin/pod install

Report

Stack

   CocoaPods : 1.10.1
        Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin14]
    RubyGems : 2.5.2.3
        Host : macOS 11.0.1 (20B50)
       Xcode : 12.3 (12C33)
         Git : git version 2.24.3 (Apple Git-128)
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-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'ImageLockerMobile' do

  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

  # Pods for ImageLockerMobile
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'QBImagePickerController', :path => '../node_modules/react-native-image-crop-picker/ios/QBImagePicker/QBImagePickerController.podspec'
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'SDWebImagePhotosPlugin'

  pod 'RNDateTimePicker', :path => '../node_modules/@react-native-community/datetimepicker/RNDateTimePicker.podspec'

  pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'RNTransferLibrary', :path => '../node_modules/react-native-transfer-library'

  pod 'react-native-cameraroll', :path => '../node_modules/@react-native-community/cameraroll'

  target 'ImageLockerMobileTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!

  use_frameworks!

  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
        def pod.build_type;
          # Uncomment one line depending on your CocoaPods version
           Pod::BuildType.static_library # >= 1.9
          # Pod::Target::BuildType.static_library # < 1.9
        end
      end
    end
  end

end

target 'ImageLockerMobile-tvOS' do
  # Pods for ImageLockerMobile-tvOS

  target 'ImageLockerMobile-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

post_install do |installer|
    framework = installer.pods_project.frameworks_group["iOS"]["MobileCoreServices.framework"]
    framework.referrers.each do |ref|
        if ref.isa == "PBXBuildFile"
            ref.remove_from_project
        end
    end
    framework.remove_from_project
end

Error

LoadError - dlopen(/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.14.2/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
        /Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.14.2/lib/ffi_c.bundle: code signature in (/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.14.2/lib/ffi_c.bundle) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. - /Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.14.2/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'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.14.2/lib/ffi.rb:6:in `rescue in <top (required)>'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/ffi-1.14.2/lib/ffi.rb:3:in `<top (required)>'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/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:68:in `require'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/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:68:in `require'
/Applications/MAMP/Library/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:131:in `block (2 levels) in versions'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:124:in `map'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:124:in `block in versions'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:479:in `concurrent_requests_catching_errors'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:121:in `versions'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/specification/set.rb:99:in `block in versions_by_source'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/specification/set.rb:98:in `each'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/specification/set.rb:98:in `each_with_object'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/specification/set.rb:98:in `versions_by_source'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/specification/set.rb:56:in `specification_name'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:216:in `search'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/source/aggregate.rb:83:in `block in search'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/source/aggregate.rb:83:in `select'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/source/aggregate.rb:83:in `search'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:416:in `create_set_from_sources'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:385:in `find_cached_set'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:165:in `search_for'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:267:in `each'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:267:in `sort_by'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in `block in sort_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in `sort_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:746:in `require_nested_dependencies_for'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:729:in `activate_new_spec'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:686:in `attempt_to_activate'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/resolver.rb:94:in `resolve'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1074:in `block in resolve_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours: https://github.com/CocoaPods/CocoaPods/search?q=dlopen%28%2FApplications%2FMAMP%2FLibrary%2Flib%2Fruby%2Fgems%2F2.3.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle%2C+9%29%3A+no+suitable+image+found.++Did+find%3A%0A%09%2FApplications%2FMAMP%2FLibrary%2Flib%2Fruby%2Fgems%2F2.3.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle%3A+code+signature+in+%28%2FApplications%2FMAMP%2FLibrary%2Flib%2Fruby%2Fgems%2F2.3.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle%29+not+valid+for+use+in+process+using+Library+Validation%3A+mapped+file+has+no+cdhash%2C+completely+unsigned%3F+Code+has+to+be+at+least+ad-hoc+signed.+-+%2FApplications%2FMAMP%2FLibrary%2Flib%2Fruby%2Fgems%2F2.3.0%2Fgems%2Fffi-1.14.2%2Flib%2Fffi_c.bundle&type=Issues

If none exists, create a ticket, with the template displayed above, on: https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket: https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods... Searching for inspections failed: undefined method `map' for nil:NilClass Did you mean? tap error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

jcush commented 3 years ago

@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

crose-88 commented 3 years ago

Hi has there been any movement on this. I've just started using a Mac having previously used a Redhat environment and I'm hitting this

Traceback (most recent call last):

   2: from test.rb:1:in `<main>'

   1: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

/opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- ffi (LoadError)

   6: from test.rb:1:in `<main>'

   5: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'

   4: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'

   3: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'

   2: from /Users/*******/.chefdk/gem/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:4:in `<top (required)>'

   1: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

/opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- 2.6/ffi_c (LoadError)

   7: from test.rb:1:in `<main>'

   6: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'

   5: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'

   4: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'

   3: from /Users/****/.chefdk/gem/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:3:in `<top (required)>'

   2: from /Users/*****/.chefdk/gem/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in `rescue in <top (required)>'

   1: from /opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

/opt/chefdk/embedded/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/**/.chefdk/gem/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 9): no suitable image found. Did find: (LoadError)

   /Users/*****/.chefdk/gem/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle: code signature in (/Users/*****/.chefdk/gem/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. - /Users/******/.chefdk/gem/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle

  My test file is just trying to require ffi to reproduce this. What's interesting is outside of chefdk (which comes bundled with Ruby 2.6) I've got ruby 2.5.7 installed via homebrew and that doesn't have this issue. I even tried getting the ruby 2.5.7 installation of the ffi gem with this bundle and copying it into the location for chefdk and that didn't solve it. Is this potentially caused by ruby 2.6 seeing as 2.5 doesn't seem to hit this.

  Any help is really appreciated, I've been trying to solve this for weeks and it's holding me up progressing my current projects.
jcush commented 3 years ago

@oleg-moseyko (I think it was Oleg...) emailed me some time ago with a possible solution which worked for me - maybe he'd be kind enough to share that here?

lon9man commented 3 years ago

@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 commented 3 years ago

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

paulojunior commented 3 years ago

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!

works for me, tks.

nbelopolov commented 2 years ago

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