Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

애플실리콘 대응 universal binary 배포 #746

Open
youknowone opened this issue Nov 28, 2020 · 6 comments
Open

애플실리콘 대응 universal binary 배포 #746

youknowone opened this issue Nov 28, 2020 · 6 comments
Assignees

Comments

@youknowone
Copy link
Member

No description provided.

@youknowone youknowone self-assigned this Nov 28, 2020
@ssut
Copy link

ssut commented Dec 1, 2020

Screen Shot 2020-12-01 at 8 46 04 PM

현재 M1 Mac Mini에서 구름 입력기를 사용 중입니다. (당연하지만) Rosetta 2로는 잘 돌아가고 있습니다.
arm64 빌드의 경우 ffi 지원 등의 문제로 어려움이 있는데. 미리 확인하시는데 도움이 되고자 개발 환경 설정 & 빌드 시 발생한 오류 첨부해드립니다. 참고로 brew의 경우 arm64용으로 사용하고 있습니다 (= always build from source.)

brew install 시 발생하는 문제

brew install shellcheck
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/services).
==> New Formulae
t-rec                                                                     youtube-dlc
==> Updated Formulae
Updated 63 formulae.
==> Deleted Formulae
curl-openssl

Warning: You are running macOS on a arm64 CPU architecture.
We do not provide support for this (yet).
Reinstall Homebrew under Rosetta 2 until we support it.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
unsupported configuration.

Warning: You are using macOS 11.0.
We do not provide support for this released but not yet supported version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
released but not yet supported version.

==> Downloading https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz
######################################################################## 100.0%
==> Downloading https://downloads.haskell.org/~ghc/8.8.3/ghc-8.8.3-x86_64-apple-darwin.tar.xz
######################################################################## 100.0%
==> Downloading https://downloads.haskell.org/~ghc/8.8.4/ghc-8.8.4-src.tar.xz
######################################################################## 100.0%
==> Downloading https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz
Already downloaded: /Users/ssut/Library/Caches/Homebrew/downloads/cd41316e9be93b60d33eab0f04d9015aa07a94f544d74efe38ac7825b62731c4--gmp-6.1.2.tar.xz
==> Downloading https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-x86_64-apple-darwin.tar.xz
######################################################################## 100.0%
==> Downloading https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-src.tar.xz
######################################################################## 100.0%
==> Downloading https://github.com/haskell/cabal/commit/b6f7ec5f3598f69288bddbdba352e246e337fb90.patch?full_index=1
######################################################################## 100.0%
==> Downloading https://hackage.haskell.org/package/cabal-install-3.2.0.0/cabal-install-3.2.0.0.tar.gz
######################################################################## 100.0%
==> Downloading https://hackage.haskell.org/package/pandoc-2.11.2/pandoc-2.11.2.tar.gz
######################################################################## 100.0%
==> Downloading https://github.com/koalaman/shellcheck/archive/v0.7.1.tar.gz
==> Downloading from https://codeload.github.com/koalaman/shellcheck/tar.gz/v0.7.1
##O#- #
==> Installing dependencies for shellcheck: ghc@8.8, ghc, cabal-install and pandoc
==> Installing shellcheck dependency: ghc@8.8
==> ./configure --prefix=/opt/homebrew/Cellar/ghc@8.8/8.8.4_1/libexec/integer-gmp --with-pic --disable-shared --build=arm_vortex_tempest-apple-darw
Last 15 lines from /Users/ssut/Library/Logs/Homebrew/ghc@8.8/01.configure:
2020-12-01 20:35:28 +0900

./configure
--prefix=/opt/homebrew/Cellar/ghc@8.8/8.8.4_1/libexec/integer-gmp
--with-pic
--disable-shared
--build=arm_vortex_tempest-apple-darwin20

checking build system type... Invalid configuration `arm_vortex_tempest-apple-darwin20': machine `arm_vortex_tempest-apple' not recognized
configure: error: /bin/sh ./config.sub arm_vortex_tempest-apple-darwin20 failed

Do not report this issue to Homebrew/brew or Homebrew/core!

pod install 시 발생하는 문제

Stack

   CocoaPods : 1.10.0
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
    RubyGems : 3.0.3
        Host : macOS 11.0.1 (20B29)
       Xcode : 12.2 (12B45b)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

오류

LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:3:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:131:in `block (2 levels) in versions'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:124:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:124:in `block in versions'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:479:in `concurrent_requests_catching_errors'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:121:in `versions'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/specification/set.rb:99:in `block in versions_by_source'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/specification/set.rb:98:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/specification/set.rb:98:in `each_with_object'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/specification/set.rb:98:in `versions_by_source'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/specification/set.rb:56:in `specification_name'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/cdn_source.rb:216:in `search'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/source/aggregate.rb:83:in `block in search'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/source/aggregate.rb:83:in `select'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.0/lib/cocoapods-core/source/aggregate.rb:83:in `search'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:416:in `create_set_from_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:385:in `find_cached_set'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:165:in `search_for'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:267:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:267:in `sort_by'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in `block in sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in `sort_dependencies'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:288:in `initial_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:210:in `start_resolution'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:168:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1074:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

관련 이슈: CocoaPods/CocoaPods#10220

이후 과정은 이슈에 있는 내용대로 x86_64로 architecture를 강제(Rosetta 2)하고 pod / ffi 를 설치하고 진행했습니다.

build 시 발생하는 문제

ld: warning: ignoring file /Users/ssut/dev/gureum/Pods/Crashlytics/OSX/Crashlytics.framework/Crashlytics, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/ssut/dev/gureum/Pods/Fabric/OSX/Fabric.framework/Fabric, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_Answers", referenced from:
      objc-class-ref in AnswersHelper.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

추가로 필요한 정보 있으시면 언제든지 말씀해주세요. 감사합니다.

@ssut
Copy link

ssut commented Dec 1, 2020

Screen Shot 2020-12-01 at 10 09 12 PM

Screen Shot 2020-12-01 at 10 09 37 PM

Firebase Crashlytics가 문제였네요. 아래와 같이 수정하고 Apple Silicon (arm64)용으로 문제없이 빌드했습니다.

diff --git a/OSX/AnswersHelper.swift b/OSX/AnswersHelper.swift
index 39d3cd9..9dab6fe 100644
--- a/OSX/AnswersHelper.swift
+++ b/OSX/AnswersHelper.swift
@@ -6,7 +6,6 @@
 //  Copyright © 2019 youknowone.org. All rights reserved.
 //
 
-import Crashlytics
 import Fabric
 import GureumCore
 
@@ -15,32 +14,15 @@ import GureumCore
     let launchedTime = Date()
 
     func logLaunch() {
-        let report = configuration.persistentDomain().mapValues { "\($0)" }
-        Answers.logLogin(withMethod: "Launch",
-                         success: true,
-                         customAttributes: report)
     }
 
     @objc func logUptime() {
-        let uptime = -launchedTime.timeIntervalSinceNow
-        Answers.logContentView(withName: "Uptime",
-                               contentType: "Indicator",
-                               contentId: "uptime",
-                               customAttributes: ["uptime": uptime])
     }
 
     func logMenu(name: String) {
-        Answers.logContentView(withName: "Menu",
-                               contentType: "Indicator",
-                               contentId: "menu-\(name)",
-                               customAttributes: ["name": name])
     }
 
     func logUpdateNotification(updating: Bool) {
-        Answers.logContentView(withName: "Notification",
-                               contentType: "Indicator",
-                               contentId: "update-\(updating)",
-                               customAttributes: ["updating": updating])
     }
 }
 
diff --git a/OSX/GureumAppDelegate.swift b/OSX/GureumAppDelegate.swift
index 918782c..adacbbe 100644
--- a/OSX/GureumAppDelegate.swift
+++ b/OSX/GureumAppDelegate.swift
@@ -7,7 +7,6 @@
 //
 
 import Cocoa
-import Crashlytics
 import Fabric
 import Foundation
 import GureumCore
@@ -60,7 +59,6 @@ class GureumAppDelegate: NSObject, NSApplicationDelegate, GureumApplicationDeleg
             // Fabric.with([Answers.self])
             GureumShowPreferencesWindow()
         #else
-            Fabric.with([Crashlytics.self, Answers.self])
         #endif
 
         UpdateManager.shared.notifyUpdateIfNeeded()
diff --git a/OSX/Version.xcconfig b/OSX/Version.xcconfig
index 0c26a83..79fc689 100644
--- a/OSX/Version.xcconfig
+++ b/OSX/Version.xcconfig
@@ -1 +1 @@
-// Do not commit this file
+VERSION = 1.11.1-21-g92f948b-Debug
diff --git a/Podfile b/Podfile
index c7d7be0..00fa842 100644
--- a/Podfile
+++ b/Podfile
@@ -1,6 +1,6 @@
 workspace 'Gureum'
 use_frameworks!
-platform :osx, "10.13"
+platform :osx, "11.0"
 
 target 'OSXCore' do
     project 'Gureum.xcodeproj'
@@ -15,7 +15,6 @@ target 'OSX' do
     project 'Gureum.xcodeproj'
     pod 'FoundationExtension', '~> 2.1.0'
     pod 'Fabric'
-    pod 'Crashlytics'
     pod 'MASShortcut'
 end
 target 'Preferences' do
diff --git a/Podfile.lock b/Podfile.lock
index 513a07a..071828c 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -1,7 +1,5 @@
 PODS:
   - cdebug (1.3)
-  - Crashlytics (3.14.0):
-    - Fabric (~> 1.10.2)
   - Fabric (1.10.2)
   - FoundationExtension (2.1.0):
     - cdebug (~> 1.3)
@@ -25,7 +23,6 @@ PODS:
 
 DEPENDENCIES:
   - cdebug
-  - Crashlytics
   - Fabric
   - FoundationExtension (~> 2.1.0)
   - Fuse
@@ -37,7 +34,6 @@ DEPENDENCIES:
 SPEC REPOS:
   trunk:
     - cdebug
-    - Crashlytics
     - Fabric
     - FoundationExtension
     - Fuse
@@ -48,7 +44,6 @@ SPEC REPOS:
 
 SPEC CHECKSUMS:
   cdebug: 0d0b7207fa996236ee9e07e5988e5e39a1d94a28
-  Crashlytics: 9220f5bc89e7a618df411b4f639389dbfb0e03d2
   Fabric: ea977e3cd9c20425516d3dafd3bf8c941c51223f
   FoundationExtension: 56c1c923c9a3bc69c5a5ac08c47c8f2f57b06288
   Fuse: 48eaf66d0c407c7f8b0ddb168888dc4637e87f14
@@ -57,6 +52,6 @@ SPEC CHECKSUMS:
   SwiftCoreServices: e4aebffc7143ff3e06920ecb89654f7c81f9768a
   SwiftIOKit: 58e9b718109ba7c6681fc45c5888838627df28f1
 
-PODFILE CHECKSUM: 23f21676782824efc75f42faca3d9b5707e45732
+PODFILE CHECKSUM: e5d3df1653abe15798192b38bd496c6ed4137068
 
 COCOAPODS: 1.10.0

전체 과정은

  1. sudo gem install cocoapods && sudo gem install xcpretty -- ruby가 이미 arm64e(= Apple prebuilt)로 나와있는 상태기 때문에 문제 없이 설치 됩니다.
  2. sudo arch -x86_64 gem install ffi (ffi arm64 지원 문제)
  3. 위 패치 적용
  4. arch -x86_64 pod install
  5. 빌드

입니다.

@youknowone
Copy link
Member Author

큰 도움 주셔서 감사합니다! 단순히 빌드 타겟만 arm을 추가하면 되는게 아닐까 했는데 생각보다 복잡한 일이었던것 같네요. 참고하여 진행해 보도록 하겠습니다

@ssut
Copy link

ssut commented Dec 5, 2020

firebase/firebase-ios-sdk#1732
이 문제가 좀 걸리는 것 같습니다. Crashlytics 패키지로는 apple silicon target 빌드가 안되고, Firebase/Crashlytics 패키지로는 빌드가 되는데 Fabric 지원이 끊겼다보니 + Firebase/Analytics 패키지가 macOS Catalyst 지원이 안 되는 탓에 어떻게 해도 빌드를 할 수가 없네요. (Crashlytics + Fabric은 현재 deprecated 상태입니다.)

위 링크 이슈에도 나와있지만(firebase/firebase-ios-sdk#1732 (comment)) MS App Center 등의 workaround를 고려해보시는 건 어떨까 제안드려봅니다.

@youknowone
Copy link
Member Author

이미 macOS에서 fabric을 실행해도 google analytics로는 정상적으로 데이터 수집이 안되는 상황이라 제거한다고 해서 현재 상황보다 나빠지지 않으므로 그냥 제거해도 될 것 같습니다.
다른 트래킹 툴은 나중에 따로 추가해야겠네요.

@yous
Copy link
Member

yous commented Aug 6, 2022

1.12.2 버전부터 유니버설 바이너리로 배포하고 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants