Hi-Rez / Satin

A 3D Graphics Framework built on Apple's Metal
MIT License
785 stars 51 forks source link

Issues Installing Dependencies on M1 chip #12

Closed maxemitchell closed 3 years ago

maxemitchell commented 3 years ago

It looks like there's an issue with the ffi gem not supporting the M1 chip yet, which causes an issue when you initially setup the examples and try to run

bundle exec pod install

I get the following error:

Analyzing dependencies
Pre-downloading: `Forge` from `https://github.com/Hi-Rez/Forge.git`, commit `4d1c7760cb12e129fb027e4e250037a8bed520a3`
/Users/USER/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi/library.rb:275: [BUG] Bus Error at 0x0000000100cb4000
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]

And relevant crash report info:

Process:               ruby [1268]
Path:                  /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
Identifier:            ruby
Version:               145.100.1
Code Type:             ARM-64 (Native)
Parent Process:        zsh [1107]
Responsible:           Terminal [519]
User ID:               501

PlugIn Path:             /Users/USER/Desktop/*/ffi_c.bundle
PlugIn Identifier:       ffi_c.bundle
PlugIn Version:          ??? (0)

Date/Time:             2021-04-29 14:16:58.436 -0500
OS Version:            macOS 11.3 (20E232)
Report Version:        12
Anonymous UUID:        72AB6060-84EC-29E6-9538-A204D5EB2E7D

Time Awake Since Boot: 450 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x0000000100cb4000
Exception Note:        EXC_CORPSE_NOTIFY

I'm going to try the suggestions on the StackOverflow thread, but wanted to document the issue here as well.

maxemitchell commented 3 years ago

Quck update after trying to run under Rosetta mode (arch -x86_64 before each command), you get a different error with the last pod install:

Command

/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/bin/pod install

Stack

   CocoaPods : 1.10.1
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
    RubyGems : 3.0.3
        Host : macOS 11.3 (20E232)
       Xcode : 12.5 (12E262)
         Git : git version 2.30.1 (Apple Git-130)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : 

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

install! 'cocoapods',
         :generate_multiple_pod_projects => true,
         :incremental_installation => true,
         :preserve_pod_file_structure => true

pod 'Forge', :git => 'https://github.com/Hi-Rez/Forge.git'
pod 'Satin', :path => '../'

use_frameworks!

target 'FXAA-macOS' do
  platform :osx, '10.15'
end

target 'Camera-macOS' do
  platform :osx, '10.15'
end

target 'Export-macOS' do
  platform :osx, '10.15'
end

target 'Camera-iOS' do
    platform :ios, '13.0'
end

target 'BufferCompute-macOS' do
  platform :osx, '10.15'
end

target 'BufferCompute-iOS' do
    platform :ios, '13.0'
end

target 'BufferCompute-tvOS' do
    platform :tvos, '13.0'
end

target 'ExtrudedText-macOS' do
  platform :osx, '10.15'
end

target 'ExtrudedText-iOS' do
    platform :ios, '13.0'
end

target 'ExtrudedText-tvOS' do
    platform :tvos, '13.0'
end

target 'Text-macOS' do
  platform :osx, '10.15'
end

target 'Text-iOS' do
    platform :ios, '13.0'
end

target 'Text-tvOS' do
    platform :tvos, '13.0'
end

target 'DepthMaterial-macOS' do
  platform :osx, '10.15'
end

target 'DepthMaterial-iOS' do
  platform :ios, '13.0'
end

target 'DepthMaterial-tvOS' do
  platform :tvos, '13.0'
end

target 'PBR-macOS' do
  platform :osx, '10.15'
end

target 'PBR-iOS' do
  platform :ios, '13.0'
end

target 'TextureCompute-macOS' do
  platform :osx, '10.15'
end

target 'TextureCompute-iOS' do
  platform :ios, '13.0'
end

target 'TextureCompute-tvOS' do
  platform :tvos, '13.0'
end

target 'Cubemap-macOS' do
  platform :osx, '10.15'
end

target 'Cubemap-iOS' do
  platform :ios, '13.0'
end

target 'Cubemap-tvOS' do
  platform :tvos, '13.0'
end

target 'Geometry-macOS' do
  platform :osx, '10.15'
end

target 'Geometry-iOS' do
    platform :ios, '13.0'
end

target 'Geometry-tvOS' do
  platform :tvos, '13.0'
end

target 'LiveCode-macOS' do
  platform :osx, '10.15'
end

target 'MatCap-macOS' do
  platform :osx, '10.15'
end

target 'MatCap-iOS' do
    platform :ios, '13.0'
end

target 'MatCap-tvOS' do
  platform :tvos, '13.0'
end

target '3D-iOS' do
    platform :ios, '13.0'
end

target '3D-macOS' do
  platform :osx, '10.15'
end

target '3D-tvOS' do
  platform :tvos, '13.0'
end

target 'Obj-iOS' do
    platform :ios, '13.0'
end

target 'Obj-macOS' do
  platform :osx, '10.15'
end

target 'Obj-tvOS' do
  platform :tvos, '13.0'
end

target '2D-iOS' do
    platform :ios, '13.0'
end

target '2D-macOS' do
  platform :osx, '10.15'
end

target '2D-tvOS' do
  platform :tvos, '13.0'
end

target 'AR-iOS' do
  platform :ios, '13.0'
end

Error

LoadError - dlopen(/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
    /Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture
    /Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture - /Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in `require'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in `rescue in <top (required)>'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:3:in `<top (required)>'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `require'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `require'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:74:in `require'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:74:in `cdn_url?'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:36:in `create_source_with_url'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:21:in `find_or_create_source_with_url'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:177:in `map'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:177:in `sources'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/bin/pod:23:in `load'
/Users/maxemitchell/Desktop/code/Satin/Example/vendor/bundle/ruby/2.6.0/bin/pod:23:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/cli/exec.rb:63:in `load'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/cli/exec.rb:28:in `run'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/cli.rb:494:in `exec'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/cli.rb:30:in `dispatch'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/cli.rb:24:in `start'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/exe/bundle:49:in `block in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.16/exe/bundle:37:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

I also tried installing ffi in Rosetta mode as suggested by some of the stackOverflow posts, but that seemed to do nothing.

rezaali commented 3 years ago

@maxemitchell thank you for letting me know, I think it might be time for me to get one of those fancy M1 Macs

rezaali commented 3 years ago

@maxemitchell do you have the latest developer tools installed that come with Xcode?

rezaali commented 3 years ago

@maxemitchell please try following the steps https://stackoverflow.com/questions/64901180/running-cocoapods-on-apple-silicon-m1 and let me know if that works for you (thank you Mike Tucker for finding this fix)

maxemitchell commented 3 years ago

@rezaali Besides this issue the fancy M1 mac has been great! I just got it to work by updating the dependencies with bundle update and before running bundle exec pod install, though that introduced a new error with rexml needing to be included in the Gemfile. I did a new Ruby install with rbenv before this which may also be necessary on M1 macs.

I'm going to experiment with the original Ruby install and see if my changes to the lock files fixed those errors as well, and if so I'll make a pull request. If the clean ruby install is needed I'll add that documentation to the readme as well for any future M1 users.