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

Make install_buck and Make debug Error #2

Open
Solace-Studios opened this issue Aug 6, 2022 · 4 comments
Open

Make install_buck and Make debug Error #2

Solace-Studios opened this issue Aug 6, 2022 · 4 comments

Comments

@Solace-Studios
Copy link

Solace-Studios commented Aug 6, 2022

Trying to get the example to run

My machine:

Model Name: Mac Studio
Model Identifier: Mac13,1
Chip: Apple M1 Max
Total Number of Cores: 10 (8 performance and 2 efficiency)
Memory: 32 GB

make install_buck currently doesn't work, the pex file doesn't exist at the current location. I updated install_buck to this instead:

install_buck:
	curl https://jitpack.io/com/github/airbnb/buck/626d201d241a051e79cbeafc63b78574b1d1e463/buck-626d201d241a051e79cbeafc63b78574b1d1e463.pex --output tools/buck
	chmod u+x tools/buck

This installs buck correctly. Before I push up the fix, I want to make sure my make debug works as well.

Running make debug in the root of the project gives the following error

make debug
tools/buck.pex install //App:TicTacToeApp --run --simulator-name '"iPhone 11"'
Unable to connect to Buck daemon, restarting it...
Buck daemon started.
Parsing buck files: finished in 3.1 sec
Creating action graph: finished in 1.1 sec
Building... 40.1 sec (68%) 60/87 jobs, 58 updated
 - IDLE
 - IDLE
 - IDLE
 - IDLE
 - IDLE
 - IDLE
 - //Libraries/Models:Models#apple-swift-compile,iphoneos-arm64... 0.1 sec
 - //Pods:RxCocoa#apple-swift-compile,iphoneos-arm64... 0.1 sec
 - IDLE
 - //Pods:RIBs#apple-swift-compile,iphoneos-arm64... 0.1 sec
Libraries/Models/Sources/Core/ScoreStream.swift:29:30: error: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol ScoreStream: class {
                             ^~~~~
                             AnyObject
Pods/RIBs/ios/RIBs/Classes/DI/Component.swift:67:24: error: cannot find 'NSRecursiveLock' in scope
    private let lock = NSRecursiveLock()
                       ^~~~~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift:32:49: error: cannot find type 'TimeInterval' in scope
    public static func execute(withDelay delay: TimeInterval, maxFrameDuration: Int = 33, logic: @escaping () -> ()) {
                                                ^~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift:33:22: error: cannot find 'DispatchTimeInterval' in scope
        let period = DispatchTimeInterval.milliseconds(maxFrameDuration / 3)
                     ^~~~~~~~~~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift:34:31: error: cannot find 'Date' in scope
        var lastRunLoopTime = Date().timeIntervalSinceReferenceDate
                              ^~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift:38:20: error: cannot find 'DispatchTimeInterval' in scope
            .timer(DispatchTimeInterval.milliseconds(0), period: period, scheduler: MainScheduler.instance)
                   ^~~~~~~~~~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:77:66: error: cannot find type 'TimeInterval' in scope
    public func expectDeallocate(object: AnyObject, inTime time: TimeInterval = LeakDefaultExpectationTime.deallocation) -> LeakDetectionHandle {
                                                                 ^~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:117:63: error: cannot find type 'UIViewController' in scope
    public func expectViewControllerDisappear(viewController: UIViewController, inTime time: TimeInterval = LeakDefaultExpectationTime.viewDisappear) -> LeakDetectionHandle {
                                                              ^~~~~~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:117:94: error: cannot find type 'TimeInterval' in scope
    public func expectViewControllerDisappear(viewController: UIViewController, inTime time: TimeInterval = LeakDefaultExpectationTime.viewDisappear) -> LeakDetectionHandle {
                                                                                             ^~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:162:35: error: cannot find 'NSMapTable' in scope
    private let trackingObjects = NSMapTable<AnyObject, AnyObject>.strongToWeakObjects()
                                  ^~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:166:35: error: cannot find 'ProcessInfo' in scope
        if let environmentValue = ProcessInfo().environment["DISABLE_LEAK_DETECTION"] {
                                  ^~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:81:70: error: cannot find type 'NSString' in scope
        let objectId = String(ObjectIdentifier(object).hashValue) as NSString
                                                                     ^~~~~~~~

[2022-08-06 13:04:17.534][error][command:9087a655-f2c1-4185-944a-5a7fb7ca018a][tid:120][com.facebook.buck.swift.SwiftCompileStep] Error running /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -frontend -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -target arm64-apple-ios15.5 -Xcc -I -Xcc buck-out/gen/Pods/RxRelay#apple-swift-objc-generated-header,iphoneos-arm64.hmap -Xcc -I -Xcc buck-out/gen/Pods/RxSwift#apple-swift-objc-generated-header,iphoneos-arm64.hmap -Xcc -I -Xcc buck-out/gen/Pods/RxRelay#header-mode-symlink-tree-with-umbrella-header-modulemap,headers,iphoneos-arm64 -Xcc -I -Xcc buck-out/gen/Pods/RxRelay#apple-swift-compile,iphoneos-arm64/RxRelay.swiftmodule -Xcc -I -Xcc buck-out -Xcc -I -Xcc buck-out/gen/Pods/RxSwift#header-mode-symlink-tree-with-umbrella-header-modulemap,headers,iphoneos-arm64 -Xcc -I -Xcc buck-out/gen/Pods/RxSwift#apple-swift-compile,iphoneos-arm64/RxSwift.swiftmodule -I buck-out/gen/Pods/RxRelay#apple-swift-compile,iphoneos-arm64 -I buck-out/gen/Pods/RxSwift#apple-swift-compile,iphoneos-arm64 -c -enable-objc-interop -parse-as-library -serialize-debugging-options -module-name RIBs -emit-module -emit-module-path buck-out/gen/Pods/RIBs#apple-swift-compile,iphoneos-arm64/RIBs.swiftmodule -emit-objc-header-path buck-out/gen/Pods/RIBs#apple-swift-compile,iphoneos-arm64/RIBs-Swift.h -o buck-out/gen/Pods/RIBs#apple-swift-compile,iphoneos-arm64/RIBs.o -swift-version 5 -DBUCK -whole-module-optimization -Onone -DDEBUG -enable-testing -g -suppress-warnings -filelist /Users/michaelmanahan/Desktop/Repos/example-buck-ribs-needle/buck-out/bin/Pods/RIBs#apple-swift-compile,iphoneos-arm64__filelist.txt: Optional[Pods/RIBs/ios/RIBs/Classes/DI/Component.swift:67:24: error: cannot find 'NSRecursiveLock' in scope
    private let lock = NSRecursiveLock()
                       ^~~~~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift:32:49: error: cannot find type 'TimeInterval' in scope
    public static func execute(withDelay delay: TimeInterval, maxFrameDuration: Int = 33, logic: @escaping () -> ()) {
                                                ^~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift:33:22: error: cannot find 'DispatchTimeInterval' in scope
        let period = DispatchTimeInterval.milliseconds(maxFrameDuration / 3)
                     ^~~~~~~~~~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift:34:31: error: cannot find 'Date' in scope
        var lastRunLoopTime = Date().timeIntervalSinceReferenceDate
                              ^~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift:38:20: error: cannot find 'DispatchTimeInterval' in scope
            .timer(DispatchTimeInterval.milliseconds(0), period: period, scheduler: MainScheduler.instance)
                   ^~~~~~~~~~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:77:66: error: cannot find type 'TimeInterval' in scope
    public func expectDeallocate(object: AnyObject, inTime time: TimeInterval = LeakDefaultExpectationTime.deallocation) -> LeakDetectionHandle {
                                                                 ^~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:117:63: error: cannot find type 'UIViewController' in scope
    public func expectViewControllerDisappear(viewController: UIViewController, inTime time: TimeInterval = LeakDefaultExpectationTime.viewDisappear) -> LeakDetectionHandle {
                                                              ^~~~~~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:117:94: error: cannot find type 'TimeInterval' in scope
    public func expectViewControllerDisappear(viewController: UIViewController, inTime time: TimeInterval = LeakDefaultExpectationTime.viewDisappear) -> LeakDetectionHandle {
                                                                                             ^~~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:162:35: error: cannot find 'NSMapTable' in scope
    private let trackingObjects = NSMapTable<AnyObject, AnyObject>.strongToWeakObjects()
                                  ^~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:166:35: error: cannot find 'ProcessInfo' in scope
        if let environmentValue = ProcessInfo().environment["DISABLE_LEAK_DETECTION"] {
                                  ^~~~~~~~~~~
Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift:81:70: error: cannot find type 'NSString' in scope
        let objectId = String(ObjectIdentifier(object).hashValue) as NSString
                                                                     ^~~~~~~~

]

Command failed with exit code 1.

command: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc, -frontend, -sdk, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk, -target, arm64-apple-ios15.5, -Xcc, -I, -Xcc, buck-out/gen/Pods/RxRelay#apple-swift-objc-generated-header,i...
<truncated>
...

stderr: Libraries/Models/Sources/Core/ScoreStream.swift:29:30: error: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
public protocol ScoreStream: class {
                             ^~~~~
                             AnyObject

    When running <swift compile>.
    When building rule //Libraries/Models:Models#apple-swift-compile,iphoneos-arm64.
make: *** [debug] Error 1
@Solace-Studios
Copy link
Author

Would you be so kind as to take a look at this? @Angel-Cortez

@Solace-Studios
Copy link
Author

Fixed, would you give me permission to push up a branch? @Angel-Cortez

@theangelperalta
Copy link
Owner

theangelperalta commented Aug 7, 2022

Fixed, would you give me permission to push up a branch? @Angel-Cortez

Create a PR with the fix, and we'll get this sorted

@Solace-Studios

@Solace-Studios
Copy link
Author

Solace-Studios commented Aug 17, 2022

@Angel-Cortez so it wasn't as simple as I thought. Part of this was actually modifying the RIBs dependency files that were downloaded, part of this was building a fork of buck, part of this was the order of commands and modifying the make file to work with M1 machines.

For RIBs itself, I had to:

  • switch class keyword to AnyObject
  • Add import Foundation to
    - Carthage/Checkouts/RxSwift/Sources/RxTest/DeprecationWarner.swift
    - Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift
    - Pods/RIBs/ios/RIBs/Classes/LeakDetector/Executor.swift
    - Pods/RIBs/ios/RIBs/Classes/DI/Component.swift
  • Add import UIKit to
    - Pods/RIBs/ios/RIBs/Classes/LeakDetector/LeakDetector.swift

Then, I had a lot of issues making project. I found a fork of buck that supports M1 with java 11.0.16-librc https://github.com/traveloka/buck , I built that using:

ant
./bin/buck build --config java.target_level=11 --config java.source_level=11 --show-output buck
buck-out/gen/ce9b6f2e/programs/buck.pex  --help

Then I modified the make file to use that newly generated buck.pex I pasted into tools/buck.pex and use flags --config java.target_level=11 --config java.source_level=11 when using buck.

To make the project, first I run make build then make project. If I do make project first, I get an architecture error. But if I run make build first, then it's okay. I can still push what I have up, but maybe I'd need to make a fork of RIBs as well with these fixes.

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

2 participants