alexsorokoletov / objc-automatic

[Not supported anymore] Automation tool to bind CocoaPods to NuGet packages for Xamarin.iOS
45 stars 15 forks source link

Running build failed. Error #17

Open Emixam23 opened 6 years ago

Emixam23 commented 6 years ago

Hey, I just tried to follow your video but with no luck :( I am looking to bind TwitterKit3 for iOS

MacBook-Pro-de-Emixam23:objc-automatic-master emixam23$ sh bind.sh POD=lottie-ios
Checking Paket version (downloading latest stable)...
Version 5.176.4 not found in cache.
Starting download from https://github.com/fsprojects/Paket/releases/download/5.176.4/paket.exe
Done.
Paket version 5.176.4
Skipping resolver for group Auto since it is already up-to-date
Skipping resolver for group Main since it is already up-to-date
Locked version resolution written to /Users/emixam23/Downloads/objc-automatic-master/paket.lock
Installing into projects:
 - Creating model and downloading packages.
Downloading FAKE 4.62.6 (Auto)
Downloading Zlib.Portable 1.11 (Auto)
Download of Zlib.Portable 1.11 (Auto) done in 1 second. (391 kbit/s, 0 MB)
Download of FAKE 4.62.6 (Auto) done in 2 seconds. (38149 kbit/s, 13 MB)
Downloading FSharp.Data 2.3.3 (Auto)
Download of FSharp.Data 2.3.3 (Auto) done in 1 second. (44482 kbit/s, 6 MB)
Performance:
 - Disk IO: 3 seconds
 - Average Download Time: 918 milliseconds
 - Number of downloads: 3
 - Average Request Time: 421 milliseconds
 - Number of Requests: 3
 - Runtime: 7 seconds
Building project with version: LocalBuild
Shortened DependencyGraph for Target Bind:
<== Bind

The running order is:
  - Bind
Running build with 1 worker
Starting Target: Bind 
VERBOSE IS false
List of pods: ["lottie-ios"]
Sorted dependency graph: ["lottie-ios"]
/Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode does not exist.
Creating /Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode
/Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode already exists.
pod install
Generating C# bindings for non-Framework pod lottie-ios
/Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode/build-out does not exist.
Creating /Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode/build-out
/Users/emixam23/Downloads/objc-automatic-master/bindings/lottie_ios does not exist.
Creating /Users/emixam23/Downloads/objc-automatic-master/bindings/lottie_ios
xcodebuild clean build -workspace EmptyProject.xcworkspace -scheme EmptyProject -sdk "iphoneos" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO BUILD_DIR=/Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode/build-out
xcodebuild clean build -workspace EmptyProject.xcworkspace -scheme EmptyProject -arch i386 -arch x86_64 -sdk "iphonesimulator" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO BUILD_DIR=/Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode/build-out
lipo -create -output pods/lottie_ios/XCode/build-out/liblottie-ios.a /Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode/build-out/liblottie-ios.device.a /Users/emixam23/Downloads/objc-automatic-master/pods/lottie_ios/XCode/build-out/liblottie-ios.sim.a
sharpie bind -output bindings/lottie_ios -sdk "iphoneos" -scope pods/lottie_ios/XCode/build-out/Debug-iphoneos/lottie-ios  -n DreamTeam.Xamarin.lottie_ios -c  -I pods/lottie_ios/XCode/Pods/Headers/Private -Ipods/lottie_ios/XCode/Pods/Headers/Public -v
Running build failed.
Error:
System.Exception: Error during sharpie bind -output bindings/lottie_ios -sdk "iphoneos" -scope pods/lottie_ios/XCode/build-out/Debug-iphoneos/lottie-ios  -n DreamTeam.Xamarin.lottie_ios -c  -I pods/lottie_ios/XCode/Pods/Headers/Private -Ipods/lottie_ios/XCode/Pods/Headers/Public -v 
  at FSI_0005.Build+generateCSharpBindingsForCustom@383.Invoke (System.String message) [0x00001] in <8522aaec47f74042918d8c6776923e3e>:0 
  at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[TResult].Finalize () [0x00012] in <5893d081904cf4daa745038381d09358>:0 
  at Microsoft.FSharp.Core.PrintfImpl+Final1@224[TState,TResidue,TResult,A].Invoke (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] env, A a) [0x00038] in <5893d081904cf4daa745038381d09358>:0 
  at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5893d081904cf4daa745038381d09358>:0 
  at FSI_0005.Build.generateCSharpBindingsForCustom (FSI_0005.Build+Pod pod) [0x0029e] in <8522aaec47f74042918d8c6776923e3e>:0 
  at FSI_0005.Build.generateBindingForPod (FSI_0005.Build+Pod pod) [0x00143] in <8522aaec47f74042918d8c6776923e3e>:0 
  at FSI_0005.Build+clo@780-4.Invoke (FSI_0005.Build+Pod pod) [0x00001] in <8522aaec47f74042918d8c6776923e3e>:0 
  at Microsoft.FSharp.Primitives.Basics.List.iter[T] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] f, Microsoft.FSharp.Collections.FSharpList`1[T] x) [0x00019] in <5893d081904cf4daa745038381d09358>:0 
  at Microsoft.FSharp.Collections.ListModule.Iterate[T] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] action, Microsoft.FSharp.Collections.FSharpList`1[T] list) [0x00001] in <5893d081904cf4daa745038381d09358>:0 
  at FSI_0005.Build+clo@767-2.Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x0014d] in <8522aaec47f74042918d8c6776923e3e>:0 
  at Fake.TargetHelper+targetFromTemplate@209-1[a].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00001] in <5978411fccf1c534a74503831f417859>:0 
  at Fake.TargetHelper.runSingleTarget (Fake.TargetHelper+TargetTemplate`1[a] target) [0x0004b] in <5978411fccf1c534a74503831f417859>:0 

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target     Duration
------     --------
Bind       Failure
---------------------------------------------------------------------
Status:    Failure
---------------------------------------------------------------------
lookup_data_table () failed for 0x7fcb99d03ef0

bind.sh: line 15:  1543 Abort trap: 6           mono --debug --runtime=v4.0 packages/Auto/FAKE/tools/FAKE.exe ./build.fsx $@
alexsorokoletov commented 6 years ago

@Emixam23 Maxime, do you have all the prerequisites installed? Specifically, can you run sharpie in your terminal and make sure it is starting?

Emixam23 commented 6 years ago

Hey :)

I already tried to bind a static library but it generates 18k lines of code for APIDefinitions and 25k for StructsAndEnums. At least, it shows that sharpie seems to work

MacBook-Pro-de-Emixam23:XamarinIOS_Bindings emixam23$ sharpie bind -output Test2 -namespace Test2 -sdk iphoneos11.2 Test2/Test2/Test2.h Parsing 1 header files...

Binding... [write] ApiDefinitions.cs [write] StructsAndEnums.cs

Binding Analysis: Automated binding is complete, but there are a few APIs which have been flagged with [Verify] attributes. While the entire binding should be audited for best API design practices, look more closely at APIs with the following Verify attribute hints:

ConstantsInterfaceAssociation (101 instances): There's no foolproof way to determine with which Objective-C interface an extern variable declaration may be associated. Instances of these are bound as [Field] properties in a partial interface into a nearby concrete interface to produce a more intuitive API, possibly eliminating the 'Constants' interface altogether.

MethodToProperty (121 instances): An Objective-C method was bound as a C# property due to convention such as taking no parameters and returning a value (non-void return). Often methods like these should be bound as properties to surface a nicer API, but sometimes false-positives can occur and the binding should actually be a method.

StronglyTypedNSArray (21 instances): A native NSArray was bound as NSObject[]. It might be possible to more strongly type the array in the binding based on expectations set through API documentation (e.g. comments in the header file) or by examining the array contents through testing. For example, an NSArray containing only NSNumber* instances can be bound as NSNumber[] instead of NSObject[].

PlatformInvoke (2407 instances): In general P/Invoke bindings are not as correct or complete as Objective-C bindings (at least currently). You may need to fix up the library name (it defaults to '__Internal') and return/parameter types manually to conform to C calling conventionsfor the target platform. You may find you don't even want to expose the C API in your binding, but if you do, you'll probably also want to relocate the definition to a more appropriate class and expose a stronger type-safe wrapper. For P/Invoke guidance, see http://www.mono-project.com/docs/advanced/pinvoke/.

InferredFromMemberPrefix (24 instances): The name of this originally anonymous declaration was taken from a common prefix of its members.

Once you have verified a Verify attribute, you should remove it from the binding source code. The presence of Verify attributes intentionally cause build failures.

For more information about the Verify attribute hints above, consult the Objective Sharpie documentation by running 'sharpie docs' or visiting the following URL:

http://xmn.io/sharpie-docs

Done.


The code I have:

Test2.h

//
//  Test2.h
//  Test2
//
//  Created by Emixam23 on 07/08/2018.
//  Copyright © 2018 Noname. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Test2 : NSObject

+ (void) PrintCustomLog : (NSString*) data;

@end

Test2.m

//
//  Test2.m
//  Test2
//
//  Created by Emixam23 on 07/08/2018.
//  Copyright © 2018 Noname. All rights reserved.
//

#import "Test2.h"

@implementation Test2

+ (void) PrintCustomLog : (NSString*) data
{
    NSLog(@"%@", data);
}

@end
alexsorokoletov commented 5 years ago

@Emixam23 I can reproduce your problem, looking into it. Long story short, lottie (as an example) had an update to it's structure and so XCode and cocoapods. Since lottie is not a conventional framework cocoapod and just something that "looks like it", there is a lot of custom dance involved in the objc-automatic to guess the right settings for that kind of pods.

Working on a small update as well as some documentation on how to address and detect these issues